Whenever I call MovieTexture.Duration it returns a consistent but incorrect duration for my videos. (all videos are .ogv format).
For example, a video of ~5 seconds returns the float 23.40637.
A video of ~1:26 returns the float 33.26076.
I am confused as to why this is happening. I was under the impression that it should return the duration of the movie in seconds. My code is below:
currentTime = 0f;
if(targetRender ==null) targetRender = GetComponent<MeshRenderer> ();
if(targetAudio ==null) targetAudio = GetComponent<AudioSource> ();
string url = "";
url = url +workingDirectory+ "/ogv_Video/" + Path.GetFileNameWithoutExtension (sceneLoader.getSceneParams () [0]) + ".ogv";
WWW request = new WWW (url);
while (request.isDone == false) {
yield return 0;
}
loadedTexture = request.movie;
while (loadedTexture.isReadyToPlay == false) {
yield return 0;
}
targetRender.material.mainTexture = loadedTexture;
targetAudio.clip = loadedTexture.audioClip;
//targetAudio.Play ();
loadedTexture.Play ();
movieDuration = loadedTexture.duration;
Debug.Log ("Movie Duration = "+movieDuration);
currentTime = 0f;