1
\$\begingroup\$

my script is correct in pc platform but when i switch on android platform i have compiler error cs0246, why i can not export my apk file. how i can play movie in unity android platform by other way?

     public class NewBehaviourScript : MonoBehaviour {
     public MovieTexture myMovie;

     void Start()
     {
         myMovie.Play();
     }

     void OnGUI()
     {
         GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), myMovie);
     }
 }

enter image description here

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

I ran into the same issue with a cross platform port I needed to do with WebGL, WebPlayer, and other platforms that are unable to play videos in Unity. Unfortunately, the process is too involved to write your own implementation for each platform in Unity. Though it is possible.

After researching and going through the many assets for movie playback in Unity (I also needed to support video scrubbing), I came upon the AVI video playback plugin for Unity, which has ample support and works on every platform regardless of your settings. The greatest part of the plugin is it gives way more granular support than Unity's MovieTextures. It supports rewind, frame-by-frame step backward/forward, pause, fast forward, and looping. The only major drawback is that your videos have to be in the plugin's AVI format, and the plugin itself is slightly expensive (currently $49). I'd recommend waiting for it to be on sale, though the amount of time and effort you'll save will definitely be worth the price.

Here's the Asset Store link: https://www.assetstore.unity3d.com/en/#!/content/15580

Here's the forum thread about the plugin as well: http://forum.unity3d.com/threads/movieplayer-for-unity-plays-mjpeg.229458/

\$\endgroup\$
1
  • \$\begingroup\$ This looks good. \$\endgroup\$
    – Almo
    Nov 19, 2015 at 23:29
0
\$\begingroup\$

MovieTexture is desktop only. You can't use these on mobile platforms. That includes Windows Phone, iOS and Android (at least).

There are some plugins on the Asset Store that do this on the various platforms, but not all of them have been updated to work with Unity 5. Tread carefully when trying to solve this problem.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .