1

I looked at the MovieTexture class, to play videos from Unity's C# scripting, but MovieTexture is for Unity Pro, and I don't have the Pro version.

I also looked at PlayFullScreenMovie, to play videos, but that works only if I import the video as an asset inside Unity's Project folder.

My question is: Is there a way to play a video in Unity Personal edition, without importing the video as an asset? Like, can I use the video's file location (filepath) in the computer as the source url to play the video from? Thanks.

Armenak
  • 31
  • 1
  • 8
Mark Jackson
  • 75
  • 1
  • 2
  • 10
  • I thought we talked about [this](http://stackoverflow.com/questions/41144054/using-new-unity-videoplayer-and-videoclip-api-to-play-video). Why not use Unity 5.6? – Programmer Mar 18 '17 at 19:58
  • yes yu were very helpful with that but the problem is I'm not allowed to use Unity 5.6 beta lol. I must use that 5.5 edition and that's the restriction. Otherwise, I would've been so happy to use that 5.6 edition – Mark Jackson Mar 18 '17 at 20:31
  • You haven't said why you are not allowed to use 5.6. Anyways, check my answer. Those are the only options you have now. – Programmer Mar 18 '17 at 20:33

1 Answers1

2

I looked at the MovieTexture class to play videos from Unity's C# scripting but MovieTexture is for Unity Pro and I don't have the Pro version

Not true. After Unity 5.0 release, pro only API and tools in Unity became available in all version of Unity. You can use MovieTexture in Unity 5.5.

I also looked at PlayFullScreenMovie to play videos but that works only if I import the video as an asset inside Unity's Project folder

If your goal is to play video from the internet, url, local network or folder, forget about PlayFullScreenMovie. It's not made for that.

Like can I use the video's file location (filepath) in the computer as the source url to play the video from?

You can do this with MovieTexture. Note that there is a big limitation with MovieTexture. For example, I've never seen it play .mp4 video before. It plays .ogg movie. Since you don't want to use Unity 5.6, you are very limited to things you can do with MovieTexture. It can't play video on mobile devices.

MovieTexture movieTexture;
AudioSource vidAudio;
public RawImage rawImage;

void Start()
{
    WWW www = new WWW("http://techslides.com/demos/sample-videos/small.ogv");
    movieTexture = www.GetMovieTexture();
    rawImage.texture = movieTexture;

    vidAudio = gameObject.AddComponent<AudioSource>();
    vidAudio.clip = movieTexture.audioClip;
}

void Update()
{
    if (movieTexture.isReadyToPlay && !movieTexture.isPlaying)
    {
        movieTexture.Play();
        vidAudio.Play();
    }

    if (movieTexture.isPlaying)
    {
        rawImage.texture = movieTexture;
    }
}

That remaining option left is to buy a video plugin or make one. These are very expensive so here are the top working ones. AVPro Video and Easy Movie Texture.

Community
  • 1
  • 1
Programmer
  • 121,791
  • 22
  • 236
  • 328
  • oh ok now it makes sense. The fact that Movietexture can be used for personal edition is very helpful. The reason I can't use 5.6 beta is because I started off the project in 5.5 and didn't want to switch to a new version. i dont have any intensions of playing videos in mobile just pc. this is very helpful. thank you – Mark Jackson Mar 18 '17 at 20:43
  • 1
    *"I dont have any intensions of playing videos in mobile just pc"* MovieTexture should be fine in this case as long as you are only playing .ogg or ogv videos. Anything else will be a problem. Unity 5.6 will be released this month and to be honest, it what you are looking for which is playing video. That's the biggest feature in 5.6. A video player that plays .ogg file only is pretty much useless so you may have to take some time off and start upgrading your app to 5.6. – Programmer Mar 18 '17 at 20:49
  • wow man i was thinking about playing like avi files but this will have to do for now. thank you so much for this information – Mark Jackson Mar 18 '17 at 20:52