Changeset 758


Ignore:
Timestamp:
12/15/09 13:41:24 (3 years ago)
Author:
pablo
Message:

Branching off 4.7 dvr changes

Location:
trunk/as3
Files:
3 edited

Legend:

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

    r720 r758  
    3030        /** Is dynamic streaming possible. **/ 
    3131        private var dynamics:Boolean; 
    32         /** Duration of the DVR stream (grows with a timer). **/ 
    33         private var dvrDuration:Number = 0; 
    34         /** Interval ID for griowing the DVR duration. **/ 
    35         private var dvrInterval:Number; 
    3632        /** ID for the position interval. **/ 
    3733        private var interval:Number; 
     
    9692 
    9793 
    98         /** If there's a DVR stream, we simply add up the time. **/ 
    99         private function dvrPosition():void { 
    100                 dvrDuration++; 
    101                 if(model.config['duration'] && dvrDuration < model.config['duration']) { 
    102                         model.sendEvent(ModelEvent.LOADED,{loaded:dvrDuration,total:model.config['duration']}); 
    103                 } else if (!model.config['duration']) { 
    104                         item['duration'] = dvrDuration; 
    105                 } 
    106         }; 
    107  
    108  
    10994        /** Catch security errors. **/ 
    11095        private function errorHandler(evt:ErrorEvent):void { 
     
    211196                        super.resize(); 
    212197                } 
    213                 if(dat.duration) { 
    214                         if(model.config['rtmp.dvr'] || item['rtmp.dvr']) { 
    215                                 // Save the DVR duration differently, adding a small buffer. 
    216                                 dvrDuration = dat.duration + 3; 
    217                         } else if(!item['duration']) { 
    218                                 item['duration'] = dat.duration; 
    219                         } 
     198                if(dat.duration && !item['duration']) { 
     199                        item['duration'] = dat.duration; 
    220200                } 
    221201                if(dat.type == 'complete') { 
     
    260240                if(bfr < 0.25 && pos < item['duration']-5 && model.config['state'] != ModelStates.BUFFERING) { 
    261241                        model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.BUFFERING}); 
     242                        stream.bufferTime = model.config['bufferlength']; 
    262243                } else if (bfr > 1 && model.config['state'] != ModelStates.PLAYING) { 
    263244                        model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.PLAYING}); 
     245                        stream.bufferTime = model.config['bufferlength']*4; 
    264246                } 
    265247                if(model.config['state'] != ModelStates.PLAYING) { 
     
    272254                        stream.pause(); 
    273255                        clearInterval(interval); 
     256                        if(stream && item['duration'] == 0) { stop(); } 
    274257                        model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.COMPLETED}); 
    275258                } 
     
    298281                clearInterval(interval); 
    299282                clearInterval(bwinterval); 
    300                 clearInterval(dvrInterval); 
    301283                interval = setInterval(positionInterval,100); 
    302284                if(item['levels'] && getLevel() != model.config['level']) { 
     
    315297                        stream.play(getID(item['file'])); 
    316298                } else if(model.config['rtmp.dvr'] || item['rtmp.dvr']) { 
    317                         if(model.config['state'] != ModelStates.PLAYING) { 
    318                                 stream.play(getID(item['file']),0,-1); 
    319                         } 
     299                        stream.play(getID(item['file']),0,-1); 
     300                } else { 
     301                        stream.play(getID(item['file'])); 
    320302                        if(timeoffset) { stream.seek(timeoffset); } 
    321                         dvrInterval = setInterval(dvrPosition,1000); 
    322                 } else { 
    323                         if(model.config['state'] != ModelStates.PLAYING) { 
    324                                 stream.play(getID(item['file'])); 
    325                         } 
    326                         if(timeoffset) { 
    327                                 stream.seek(timeoffset); 
    328                         } 
    329303                        if(dynamics) { 
    330304                                bwinterval = setInterval(getBandwidth,2000); 
     
    430404                clearInterval(interval); 
    431405                clearInterval(bwinterval); 
    432                 clearInterval(dvrInterval); 
    433406                position = 0; 
    434407                timeoffset = item['start']; 
  • trunk/as3/com/jeroenwijering/player/Player.as

    r708 r758  
    6969                id:undefined, 
    7070                plugins:undefined, 
    71                 version:'4.7.707' 
     71                version:'4.7.758' 
    7272        }; 
    7373        /** Reference to all stage graphics. **/ 
Note: See TracChangeset for help on using the changeset viewer.