Question

I'm totally at a loss as to how to detect if my instance of FLVPlayback component has been handed a source that either doesn't exist or it can't play for one reason or another.

I've attached handlers to every event I can think of... specifically...

        videoPlayer.addEventListener(VideoEvent.COMPLETE, vidEnd);
        videoPlayer.addEventListener(VideoEvent.READY, vidStart);
        videoPlayer.addEventListener(VideoEvent.PLAYHEAD_UPDATE, vidMoved);         
        videoPlayer.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);           
        videoPlayer.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

But none of those fire when the clip is missing or corrupted.

I also tried this:

            try{
                videoPlayer.source = "http://localhost:18888/" + folder + "/" + nextUrl;
            }catch(e:VideoError){
                trace("http://localhost:18888/" + folder + "/" + nextUrl + " couldn't be found");
                playNextItem();
            }

But that doesn't work either. I'm totally stumped. What's the correct way to do this?

TIA

Was it helpful?

Solution

If you can, don't use FLVPlayback, because it does too many "magic" things behind the scenes and is a bit buggy. It's basically just a wrapper around the VideoPlayer class.

If you have to use FLVPlayback, you can access the VideoPlayer being wrapped with FLVPlayback.getVideoPlayer, then listen to VideoState.STATE_CHANGE and monitor VideoPlayer.state. If it's VideoState.CONNECTION_ERROR, it means your video feed cannot be loaded or played.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top