- Home /
Big problem with mobile movies
I'm trying to use Handheld.PlayFullScreenMovie on Android. I'm following the instructions. Got code here: http://answers.unity3d.com/questions/218362/bundle-up-a-movie-file-for-handheld.html
But Unity won't BUILD the Android project, giving me this:
'MovieTexture' is not supported when building for Android.
Asset: 'Assets/Resources/SSSuccess.mp4'
UnityEditor.HostView:OnGUI()
I tried putting it in StreamingAssets and got the same problem. Note this is at BUILD time, not compile time. I'm not trying to code a MovieTexture. I just have it lying around.
NEED HELP!
Comment out all the code that that uses movie texture. If you can't find the code, remove the movie texture from the unity project folder, you may get a null exception in your code, go to this location and comment out the code that's trying to use the .mp4 file.
If you have the basic version of unity, you cannot load movies except through native plugins.
Answer by artie · Jan 24, 2013 at 11:03 AM
Found it, but leaving this here in case anyone else runs into this: I had assigned the movie to a texture (for web/pc builds). So I had to set that texture to 'none'.
Answer by Xorxor · Dec 19, 2015 at 08:37 AM
In order to support both Windows and Android I had to do the following:
1 Use Platform Dependent Compilation to remove references to MovieTexture
#if UNITY_ANDROID && !UNITY_EDITOR
// Android Code
public string movieString;
#else
// Windows Code
public MovieTexture movieTexture;
#endif
Or
#if UNITY_STANDALONE || UNITY_EDITOR
// Windows Code
public MovieTexture movieTexture;
#endif
2 Make sure that there are no references to any MovieTextures in any fields including Materials.
3 I need to load my MovieTextures dynamically at runtime on Windows so I keep them in the Assets/Resources folder. This is an issue for Android builds because the contents of Resources gets copied to whatever build even if the build can't support the contents. In order to overcome this I use a build script to build my project which temporarily moves the Resources folder when building for Android.
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System.IO;
using System.Collections;
public class Build: MonoBehaviour
{
#if UNITY_EDITOR
// Build Android
// % (ctrl on Windows, cmd on OS X), # (shift), & (alt)
[MenuItem("Build/Build Android %&#b")]
static void BuildAndroid()
{
//_________________________________________
// Pre Build
// Move Resources to a dummy folder
// FIXME: Check if these folders exist
string moveResourcesAway = AssetDatabase.MoveAsset("Assets/Resources", "Assets/StandaloneResources");
Debug.Log(moveResourcesAway);
//_________________________________________
// Build
string[] levels = null; // { "Assets/Scene1.unity", "Assets/Scene2.unity" };
BuildOptions buildOptions = BuildOptions.AutoRunPlayer;
BuildPipeline.BuildPlayer(levels, "Build/BuildAndroid.apk", BuildTarget.Android, buildOptions);
//_________________________________________
// Post Build
// Move Resources back
string moveResourcesBack = AssetDatabase.MoveAsset("Assets/StandaloneResources", "Assets/Resources");
Debug.Log(moveResourcesBack);
}
#endif
}
Xorxor, I am trying to play a video using RawImage inside the Canvas. Works fine in the Editor however I am getting the following error when I try to "build & run" for Android. "error CS0246: The type or namespace name `$$anonymous$$ovieTexture' could not be found. Are you missing a using directive or an assembly reference?" In the inspector I have my movie as the Texture in RawImage and as well as the variable "movie" in the script Code is as follows: using UnityEngine; using System.Collections; using UnityEngine.UI;
[RequireComponent (typeof(AudioSource))]
public class VideoTEst : $$anonymous$$onoBehaviour {
public $$anonymous$$ovieTexture movie;
private AudioSource audio;
void Awake()
{
audio = GetComponent<AudioSource>();
}
void Start ()
{
audio.clip = movie.audioClip;
movie.loop = true;
movie.Play();
audio.Play();
}
}
Any thoughts on what I need to do?
Just discovered that $$anonymous$$ovieTexture is NOT supported by Android. Back to the drawing board. http://docs.unity3d.com/$$anonymous$$anual/android-unsupported.html
Answer by sysG · Apr 16, 2015 at 07:31 PM
I just removed movie files from Resources folder and its all ok) Also i made a dummy of MovieTexture class
Answer by whaison · Aug 14, 2015 at 05:27 AM
save filetype .bytes
and
string url = "http://www.mywebsite.com/mygame/assetbundles/assetbundle1.unity3d"; IEnumerator Start () { // Start a download of the given URL WWW www = WWW.LoadFromCacheOrDownload (url, 1);
// Wait for download to complete
yield return www;
// Load and retrieve the AssetBundle
AssetBundle bundle = www.assetBundle;
// Load the TextAsset object
TextAsset txt = bundle.Load("myBinaryAsText", typeof(TextAsset)) as TextAsset;
// Retrieve the binary data as an array of bytes
byte[] bytes = txt.bytes;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613091519im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Movies on Android. Is it possible? 2 Answers
Is it possible to play a movie on Android OS? 3 Answers
How stocked the video in full screen in the background? 0 Answers
BCE0018: 'MovieTexture' does not denote a valid type ('not found'). 1 Answer
Movie Textures not working - "Not ready to play" (Unity Pro) 0 Answers