hi
i have problem.
i use clip as raw image texture.
in play mode and windows every thing is ok.
i cant export this project for android for these errors.
-
Assets/Video player/Playerclip.cs(5,8): error CS0246: The type or namespace name `MovieTexture’ could not be found. Are you missing a using directive or an assembly reference?
-
Error building Player because scripts had compiler errors
please help.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Playerclip : MonoBehaviour {
public MovieTexture movie2;
// Use this for initialization
void Start () {
movie2.Play ();
}
// Update is called once per frame
void Update () {
}
}
using UnityEngine;
using System.Collections;
public class PlayerClip : MonoBehaviour {
public MovieTexture movie2;
void Start() {
GetComponent<Renderer>().material.mainTexture = movie2;
movie2.Play();
Straight out of the manual. You could modify this a bit to fit your movie texture.
I have same problem. I need WebGl build.
Here I have share my code
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class MoivePlay : MonoBehaviour {
public Text progressGUI;
public MeshRenderer targetRender = null;
public AudioSource targetAudio = null;
//public string URLString = “http://localhost/prasanna/forgetmenott/uploads/howit/video_1.ogg”;
public MovieTexture loadedTexture;
IEnumerator Start() {
GetComponent<Renderer> ().material.mainTexture = loadedTexture;
if(targetRender ==null) targetRender = GetComponent<MeshRenderer> ();
if(targetAudio ==null) targetAudio = GetComponent<AudioSource> ();
var txt = new WWW("http://eternal3d.com/unityfiles/VideoOne.php");
// var txt = new WWW("http://localhost/prasanna/forgetmenott/unityfiles/VideoOne.php");
yield return txt;
//print (txt.text);
string itemsDataString = txt.text;
WWW www = new WWW (itemsDataString);
while (www.isDone == false) {
if(progressGUI !=null) progressGUI.text = "Progresso do video: " + (int)(100.0f * www.progress) + "%";
yield return 0;
}
loadedTexture = www.GetMovieTexture();
while (loadedTexture.isReadyToPlay == false) {
yield return 0;
}
targetRender.material.mainTexture = loadedTexture;
targetAudio.clip = loadedTexture.audioClip;
targetAudio.Pause();
loadedTexture.Pause();
}
public void PlayStop()
{
if (loadedTexture.isPlaying)
{
targetAudio.Pause();
loadedTexture.Pause();
}
else
{
targetAudio.Play();
loadedTexture.Play();
}
}
public void restart()
{
StartCoroutine(Start());
}
}
Please help me.