It has some use of MovieTexture objects, but when I try to make a build for a mobile it drops me an error: “error CS0246: The type or namespace name `MovieTexture’ could not be found. Are you missing a using directive or an assembly reference?”
As far as I understand you guys (Unity development team) forgot to make a MovieTexture object for mobile platforms, which is really bad for me, because since there are no preprocessor directives available I can’t do something like:
#ifdef IPHONE #else
public MovieTexture mTex; #endif
So how can I solve this issue without making 2 separate folders in my SVN, because I really need to make changes for all the files in project (not only mobile related)?
They didn’t forget it, its technically not possible to use MovieTextures on mobiles, only fullscreen playback, so making any code that tries to use it fail is the best thing to do so you know the code is not mobile usable.
As for your approach: You are looking for
#if !UNITY_IPHONE
... use movie texture
#else
... now we are on iphone
#endif
Take look at the manual page for platform dependent compilation for all possible defines
yeah, thanks, actually already figured out that myself.
I just created this:
//#define MOBILE_PLATFORM
using UnityEngine;
using System.Collections;
#if (MOBILE_PLATFORM)
public class MovieTexture : Texture
{
// Constructors
public MovieTexture ();
// Methods
public void Play ();
public void Stop ();
public void Pause ();
// Properties
public AudioClip audioClip { get; }
public bool loop { get; set; }
public bool isPlaying { get; }
public bool isReadyToPlay { get; }
}
#endif
so when you uncomment the first row - you’re ready to go mobile compilation A bit crippled solution but it works.
I would recommend to do yourself the favor and follow the adviced manual page, then yo ucan get rid of this crippled solution in favor of one that will work just automatically
sorry i know this is old thread, but i have the same problem i can’t build my MovieTexture on android, but i can play it on standalone.
i look the code above solved it, but i don’t understand how to use it and what’s inside of that code…
anyone can please help me?
this is my code for detail :
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
[RequireComponent(typeof(AudioListener))]
public class Movie : MonoBehaviour {
public MovieTexture movie;
private float movieTimer;
void OnGUI(){
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), movie);
movie.Play();
if(movie.duration < movieTimer){
movie.Stop();
print("Movie Finish");
}
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
movieTimer += Time.deltaTime;
}
}
The code above simply creates a stub class to replace the desktop MovieTexture class that is unavailable on mobile platforms. It doesn’t actually allow you to play a MovieTexture on a mobile device.
I used following way to run movie texture on android platfrom
//#define MOBILE_PLATFORM
using UnityEngine;
using System.Collections;
#if (MOBILE_PLATFORM)
public class MovieTexture : Texture
{
// Constructors
public MovieTexture ();
// Methods
public void Play ();
public void Stop ();
public void Pause ();
// Properties
public AudioClip audioClip { get; }
public bool loop { get; set; }
public bool isPlaying { get; }
public bool isReadyToPlay { get; }
}
#endif
But after using above code I am getting following errors.
For those who will stumble on this thread, and will read the last few posts (which are technically correct but kind of misleading if you don’t read the whole thread): as of 2015/10/6, MovieTextures are still not supported on Android and iOs, and the aforementioned workaround is just a mean to allow a smooth compilation on mixed platforms (and not a way to enable some hidden feature).
If you want to play movie texture-like content, you can roll it yourself (ouch!) or use one of the many plugin on the store. The good news is that they are quite cheap, and work with unity personal edition (for those who are eligible), the bad one, is that your mileage for what concern the integration might vary…
Unity has no proper support for this. But you can make a native plugin and render the video to an unity texture, the mobile phones themselves support this. I wrote such a plugin for Android a while ago and can confirm it works, although you need some opengl experience. I made a similar one for ios.
The majority of “video” players in the unity store are just able to show slideshows from a series of images you extract from a video. This results in gigantic “video” files, with no synced audio track, and is not the proper way to play videos.
@riccardo_fablab@TOES2 which plugin would you suggest? I am making a mobile platform project, that uses videotexture with alpha. I already made the alpha videotexture work using a special shader and a “special video” (see sample pic attached): has two sections, the upper one has the color map, and the lower one has the mask.
I have done this kind of project using Total Immersion D´fusion SDK, but it´s not supported anymore… now I am having headaches using Unity + Vuforia!
Thanks in advanced for your advice