How to get movie duration

I am using following code to play a movie file in unity.
the problem i am having is I can’t find out the duration of the movie. I want to load next scene after the end of the movie.

	void Start () {
		
		wwwData 				= new WWW(url);
        guiTexture.texture 		= wwwData.movie;
		movieTexture			= guiTexture.texture as MovieTexture;
		
	}
	
	void Update () 
	{
		
		
        if (!movieTexture.isPlaying && movieTexture.isReadyToPlay)
		{
			audio.clip = movieTexture.audioClip;
			audio.Play();
            movieTexture.Play();
			
			WaitTillMovieIsOver();
			
		}
		
		
	}
	
	IEnumerator WaitTillMovieIsOver() 
	{
		Debug.Log("started movie");
		
 		while(movieTexture.isPlaying)
		{
			yield return null;
		}
 
 
		Debug.Log("movie over");
	}

wwwData.movie.duration always return -1

for some reason WaitTillMovieIsOver is also not getting called …

can anyone provide some help on this?

You need a “StartCoroutine” on the line where you call the Ienumerator function. You always need to use that with Yield code.
line 19:

StartCoroutine(WaitTillMovieIsOver());

As for the movie length, you can use MovieTexture.isPlaying

if(wwwdata.movie.isPlaying)
{
movieisplaying = true;
}