A battle with FLVPlayback

So I’m having a lot of fun adding video to my project. I’ve run into quite a few errors and I’m sure someone here can give quick answers.

Here is my vid class.


package {

    import fl.data.DataProvider;
    import flash.display.*;
    import flash.events.*;
    import fl.video.FLVPlayback;
    import fl.video.VideoEvent;
    import fl.video.VideoError;
    import flash.text.TextField;

    public class video_player extends MovieClip {
        public function video_player() {
            player.autoRewind = true;
            player.bufferTime = 1;
            player.idleTimeout = 100000;
            player.autoPlay = true;
            player.addEventListener(VideoEvent.READY, video_ready);
            //player.addEventListener(VideoError.NO_CONNECTION, ios);
        }
        public function ios(e){
            trace(e);
        }
        public function play_vid(id) {
            player.stop();
            player.ncMgr.close();
            player.play("http://mydomain.com/videos/"+id+".flv");
            player.autoPlay = true;
        }
        public function video_ready(e:VideoEvent) {
            trace(player.totalTime);
            if (player.totalTime) {
                total_te.text = "Total: " + player.totalTime.toString() + "sec.";
            }
        }
        public function set_meta_data(date:String, start_time:String, stop_time:String) {
            start_t.text = "Start:" + start_time + "sec.";
            stop_t.text = "Stop:" + stop_time + "sec.";
            date_t.text = "Date:"+ date;

        }
        public function set_tags(t:String) {
            vid_tags.text = t;
        }
    }
}

Simple enough. So in my main you click some buttons and it sends IDs to the player which is in this classes movieclip.

#1 How do i catch video errors? Sometimes a user will try to play a video that no longer exists. Flash traces this…

Error opening URL 'http://mydomain.com/videos/3020.flv'
VideoError: 1000: Unable to make connection to server or to find FLV on server
    at fl.video::VideoPlayer/stop()
    at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::showFirstStream()
    at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::setState()
    at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::httpNetStatus()

After that happens I can no longer play ANY movies. I just keep getting VideoError: 1000 even though I know the clips exist.

So how do I fix this, how do I catch this error? And why does all playing functionality stop after this error occurs?

Also, does anyone have suggestions for playing 3 separate FLV files back to back (as close to seamless as I can get)?

Otherwise, AS3 video is pretty neat. I liked how you can simply drop control components (seek bar, volume…) onto to stage and they automatically get associated with the instance of FLVPlayback component. Pretty sweet.

Anyways, if people have advice or know of good tutorials on video playback in AS3… please let me know. Maybe using the VideoPlayer instead of FLVPlayback would be better?

thanks,

david