Changeset 758
- Timestamp:
- 12/15/09 13:41:24 (3 years ago)
- Location:
- trunk/as3
- Files:
-
- 3 edited
-
com/jeroenwijering/models/RTMPModel.as (modified) (8 diffs)
-
com/jeroenwijering/player/Player.as (modified) (1 diff)
-
player.swf (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/as3/com/jeroenwijering/models/RTMPModel.as
r720 r758 30 30 /** Is dynamic streaming possible. **/ 31 31 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;36 32 /** ID for the position interval. **/ 37 33 private var interval:Number; … … 96 92 97 93 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 109 94 /** Catch security errors. **/ 110 95 private function errorHandler(evt:ErrorEvent):void { … … 211 196 super.resize(); 212 197 } 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; 220 200 } 221 201 if(dat.type == 'complete') { … … 260 240 if(bfr < 0.25 && pos < item['duration']-5 && model.config['state'] != ModelStates.BUFFERING) { 261 241 model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.BUFFERING}); 242 stream.bufferTime = model.config['bufferlength']; 262 243 } else if (bfr > 1 && model.config['state'] != ModelStates.PLAYING) { 263 244 model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.PLAYING}); 245 stream.bufferTime = model.config['bufferlength']*4; 264 246 } 265 247 if(model.config['state'] != ModelStates.PLAYING) { … … 272 254 stream.pause(); 273 255 clearInterval(interval); 256 if(stream && item['duration'] == 0) { stop(); } 274 257 model.sendEvent(ModelEvent.STATE,{newstate:ModelStates.COMPLETED}); 275 258 } … … 298 281 clearInterval(interval); 299 282 clearInterval(bwinterval); 300 clearInterval(dvrInterval);301 283 interval = setInterval(positionInterval,100); 302 284 if(item['levels'] && getLevel() != model.config['level']) { … … 315 297 stream.play(getID(item['file'])); 316 298 } 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'])); 320 302 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 }329 303 if(dynamics) { 330 304 bwinterval = setInterval(getBandwidth,2000); … … 430 404 clearInterval(interval); 431 405 clearInterval(bwinterval); 432 clearInterval(dvrInterval);433 406 position = 0; 434 407 timeoffset = item['start']; -
trunk/as3/com/jeroenwijering/player/Player.as
r708 r758 69 69 id:undefined, 70 70 plugins:undefined, 71 version:'4.7.7 07'71 version:'4.7.758' 72 72 }; 73 73 /** Reference to all stage graphics. **/
Note: See TracChangeset
for help on using the changeset viewer.
