Streaming video as MovieTexture
Hi everyone, I'm trying to load a video as a MovieTexture using WWW but my script is not working. It shows this error: MoviePlayback::LoadMovieData got NULL
Here is my script, hope you guys can give me a hand with this:
public WWW wwwData;
public string url = "http://unity3d.com/files/docs/sample.ogg";
public GUITexture gt;
void Start() {
wwwData = new WWW(url);
gt = GetComponent<GUITexture>();
gt.texture = wwwData.movie;
}
void Update() {
MovieTexture m = gt.texture as MovieTexture;
if (!m.isPlaying && m.isReadyToPlay)
m.Play();
}
Regards, Santhiago
Answer by ludo6577 · Aug 30, 2016 at 11:40 AM
Lots of people are experiencing the same issue.
It says here that it is fixed, but it is not... https://issuetracker.unity3d.com/issues/movietexture-fmod-error-when-trying-to-play-video-using-www-class
I've been trying different ways to load the $$anonymous$$ovieTexture and in every single way I tried, I got the same error. Finally I found a way to make it work, but still getting the error.
Thanks!
@San$$anonymous$$ Can you share the way you used to make it work ? I am still searching for a solution to load a movie with WWW ....
Sure @ludo6577 I used this script:
using UnityEngine; using System.Collections;
public class anotherTry : $$anonymous$$onoBehaviour {
public string url = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv";
IEnumerator Start () {
var www = new WWW (url);
var movieTexture = www.movie;
while (!movieTexture.isReadyToPlay)
yield return movieTexture;
GetComponent<Renderer>().material.mainTexture = movieTexture;
movieTexture.Play ();
}
}
As I said, the error still appeas, but the video works. Hope it helps.
Answer by WenM · Sep 19, 2016 at 07:56 AM
Hi, @Santhiago, I have met the same problem, but after i built up my program, it worked OK. But I want it work in Editor. Can you share the way you used to make it work ?
Hi @Wen$$anonymous$$, sorry for taking too long to answer. The method I used to make it work in the editor it's in the answers above this one. Let me know if it works.
Your answer
Follow this Question
Related Questions
Issues with video player coroutine 2 Answers
Differentiate movie and audio file on game object 1 Answer
Stream Audio from a URL? 3 Answers
Video Streaming with New Unity Video Player issue 0 Answers
MovieTexture not playing in playmode 1 Answer