- Home /
The question is answered, right answer was accepted
[SOLVED] Does someone have a working script sample with Handheld.Playfullscreenmovie on Android ?
Hello Everybody!
I am working on project under Unity 4.2 pro.
I spent hours to find a solution but no way. I need your help :
I would like to play movies with Handheld.PlayfullScreenMovie(). Do you have a working project or a sample that i can try to export on android ?
I created "StreamingAssets" folder
under "Assets" folder.I put into it my movie "doseriche.mp4".
Then the path in Handheld.PlayFullScreenMovie should be "doseriche.mp4" under Android, am i wrong ?
In Player settings, i set "Write Access" to "External".
I tried different paths.
But it still doesn't work.
Here is my code :
using UnityEngine;
using System.Collections;
public class test_handheld : MonoBehaviour
{
string fileName = "doseriche";
string fileExtension = ".mp4";
string filepath;
string s = string.Empty;
string url = "http://[...]/tests_devonly/";
private Vector2 scrollPosition;
bool done = false;
void Play(string p)
{
//iPhoneUtils.PlayMovie(p, Color.white);
s += p + ": " + Handheld.PlayFullScreenMovie(p, Color.white, FullScreenMovieControlMode.Full, FullScreenMovieScalingMode.Fill) + "\n";
}
void Start()
{
Handheld.PlayFullScreenMovie(fileName + fileExtension);
StartCoroutine(BeginDownload());
}
void OnGUI()
{
GUILayout.Box(s);
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
{
if (GUILayout.Button("file://" + fileName + fileExtension, GUILayout.Height(30)))
Play("file://" + fileName + fileExtension);
if (GUILayout.Button(fileName + fileExtension, GUILayout.Height(30)))
Play(fileName + fileExtension);
if (GUILayout.Button("file://" + fileName, GUILayout.Height(30)))
Play("file://" + fileName);
if (GUILayout.Button(fileName, GUILayout.Height(30)))
Play(fileName);
if (GUILayout.Button("jar:file://" + Application.dataPath + "!/assets/" + fileName + fileExtension, GUILayout.Height(30)))
Play("jar:file://" + Application.dataPath + "!/assets/" + fileName + fileExtension);
if (GUILayout.Button("jar:file://" + Application.dataPath + "!/assets/" + fileName, GUILayout.Height(30)))
Play("jar:file://" + Application.dataPath + "!/assets/" + fileName);
if (GUILayout.Button(Application.streamingAssetsPath + "/" + fileName + fileExtension, GUILayout.Height(30)))
Play(Application.streamingAssetsPath + "/" + fileName + fileExtension);
if (GUILayout.Button(Application.streamingAssetsPath + "/" + fileName, GUILayout.Height(30)))
Play(Application.streamingAssetsPath + "/" + fileName);
}
GUILayout.EndScrollView();
if (done)
{
if (GUILayout.Button(filepath, GUILayout.Height(30)))
Play(filepath);
if (GUILayout.Button("file://" + filepath, GUILayout.Height(30)))
Play("file://" + filepath);
}
}
#region comment download under Android
IEnumerator BeginDownload()
{
string path = Application.persistentDataPath;
filepath = path + "/" + fileName + fileExtension;
WWW www = new WWW(url + fileName + fileExtension);
yield return www;
s += "DONE!" + "\n";
done = true;
System.IO.File.WriteAllBytes(filepath, www.bytes);
}
#endregion
}
Do you have a working project i can try to export to android ?
Thanks a lot for any help !!
I'm sorry this is unrelated but WOW 0_0, over 3000 views in 3 $$anonymous$$utes! Now that, sir, was a great question.
Answer by PommPoirAbricot · Jun 13, 2014 at 02:25 PM
Solved Playfullscreenmovie is a Android Pro feature ! This is not indicated in documentation
using UnityEngine;
using System.Collections;
public class playmovie : MonoBehaviour {
private string movPath = "doseriche.mp4";
// Use this for initialization
void Start () {
StartCoroutine(PlayStreamingVideo(movPath));
}
private IEnumerator PlayStreamingVideo(string url)
{
Handheld.PlayFullScreenMovie(url, Color.black, FullScreenMovieControlMode.Full, FullScreenMovieScalingMode.AspectFill);
yield return new WaitForEndOfFrame();
yield return new WaitForEndOfFrame();
Debug.Log("Video playback completed.");
}
}
[1]: https://store.unity3d.com/products/v24/feature_4_pro.en.html
So I just spent half a day trying to do the impossible?
Why would they not include this very important info in the docs?!
It's in there somewhere. Docs are improved continuously, I think it's tough for Unity $$anonymous$$m to spot everything :P
Good job finding the answer. If you need a short (SHORT!) clip, you could use @Eric5h5's awesome, simple and elegant Texture Swap Animator.
Follow this Question
Related Questions
Need help with Handeld.PlayFullScreenMovie for Android 1 Answer
PlayFullScreenMovie on Android shows black frames at start and end of video 2 Answers
Add some text overlay on when playing Handheld.playfullscreen 0 Answers
Android can't AutoOrientation when do Handheld.PlayFullScreenMovie 0 Answers
Android Handheld.PlayfullscreenMovie not working from Cloud Build 1 Answer