Ignore:
Timestamp:
06/11/08 13:04:11 (5 years ago)
Author:
jeroen
Message:

fixed a lot of small issues with playlist-playback by allowing each model to continue to exist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/as3/com/jeroenwijering/models/HTTPModel.as

    r6 r8  
    6161                stream.client = this; 
    6262                video = new Video(320,240); 
    63                 video.attachNetStream(stream); 
    6463                transform = new SoundTransform(); 
    6564                stream.soundTransform = transform; 
     
    8483                } 
    8584                for (var i=0; i< keyframes.times.length; i++) { 
    86                         if(keyframes.times[i] <= pos && keyframes.times[i+1] >= pos) { 
     85                        if((keyframes.times[i] <= pos || i ==0) && (keyframes.times[i+1] >= pos || !keyframes.times[i+1])) { 
    8786                                if(tme == true) { 
    8887                                        off = keyframes.times[i]; 
     
    9392                        } 
    9493                } 
     94                trace(off); 
    9595                return off; 
    9696        }; 
     
    9999        /** Load content. **/ 
    100100        public function load() { 
     101                video.attachNetStream(stream); 
    101102                stream.close(); 
    102103                var url = model.playlist[model.config['item']]['file']; 
     
    147148 
    148149 
     150        /** Handler for onLastSecond call. **/ 
     151        public function onLastSecond(info:Object) { }; 
     152 
     153 
    149154        /** Get metadata information from netstream class. **/ 
    150155        public function onMetaData(info:Object) { 
    151156                if(h264) { return; } 
    152                 video.width = info.width; 
    153                 video.height = info.height; 
    154                 model.mediaHandler(video); 
     157                if(info.width) { 
     158                        video.width = info.width; 
     159                        video.height = info.height; 
     160                        model.mediaHandler(video); 
     161                } else {  
     162                        model.mediaHandler(); 
     163                } 
    155164                if(info.seekpoints) { 
    156165                        h264 = true; 
     
    215224                        timeoffset = getOffset(pos,true); 
    216225                        load(); 
     226                        trace('===LOADING-==='); 
    217227                } else { 
     228                        trace('===SEEKING==='); 
    218229                        if(h264) { 
    219230                                stream.seek(pos-timeoffset); 
     
    241252        private function statusHandler(evt:NetStatusEvent) { 
    242253                if(evt.info.code == "NetStream.Play.Stop") { 
    243                         if(model.config['state'] == ModelStates.COMPLETED) { 
    244                                 stream.close(); 
    245                         } else {  
     254                        if(model.config['state'] != ModelStates.COMPLETED) {  
    246255                                clearInterval(timeinterval); 
    247256                                model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.COMPLETED}); 
     
    251260                        model.sendEvent(ModelEvent.ERROR,{message:"Video stream not found: " +  
    252261                                model.playlist[model.config['item']]['file']}); 
    253                 } 
    254                 model.sendEvent(ModelEvent.META,{info:evt.info.code}); 
     262                } else {  
     263                        model.sendEvent(ModelEvent.META,{info:evt.info.code}); 
     264                } 
    255265        }; 
    256266 
Note: See TracChangeset for help on using the changeset viewer.