Search code examples
flashflvplayback

Flash: VideoPlayer.load method sometimes fails...thoughts on why and how to recover?


I have a movie that loads an flv using the VideoPlayer class. It does it with the load function.

Here is a code sample of what I'm doing:

_root.createEmptyMovieClip("SlideA", 1);

...

SlideA.loadMovie(urlContainingFunctionForLoadVideo);

...  // SlideA has completely loaded

SlideA.loadVideo(urlToFLV);

function loadVideo(url)
{
     this.attachMovie("VideoPlayer", "my_vp", this.getNextHighestDepth(), {x:0, y:0});
     my_vp.load(url);
}

I'm using the Flash 8 IDE exporting to Flash 8 and ActionScript 2.0. What I'm seeing is that sometimes this function fails but only when something else has been loaded into SlideA first. The loading movie is a Flash 6 movie using ActionScript 1.0. I'm seeing that when the load fails that VideoPlayer.bytesTotal is undefined and that never changes. The file can be cached or not cached and this happens. Thoughts on how to deal with this?


Solution

  • I found out that using VideoPlayer was just the wrong idea and instead just used NetStream and NetConnection directly.