Changeset 760
- Timestamp:
- 12/16/09 06:53:43 (4 years ago)
- Files:
-
- 6 edited
-
testing/files/bitrates.xml (modified) (2 diffs)
-
trunk/as3/com/jeroenwijering/models/HTTPModel.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/models/RTMPModel.as (modified) (10 diffs)
-
trunk/as3/com/jeroenwijering/models/VideoModel.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/player/Player.as (modified) (1 diff)
-
trunk/as3/player.swf (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
testing/files/bitrates.xml
r586 r760 33 33 <description>Bitrate switching for RTMP streaming is done on startup and with every seek and fullscreen switch.</description> 34 34 <media:group> 35 <media:content bitrate="1600" width="1080" url="http://hwcdn.net/i6s8g7u7/fms/dynamic/8Juv1MVa-67727.mp4 " />36 <media:content bitrate="1200" width="720" url="http://hwcdn.net/i6s8g7u7/fms/dynamic/8Juv1MVa-485.mp4 " />37 <media:content bitrate="800" width="480" url="http://hwcdn.net/i6s8g7u7/fms/dynamic/8Juv1MVa-484.mp4 " />38 <media:content bitrate="400" width="320" url="http://hwcdn.net/i6s8g7u7/fms/dynamic/8Juv1MVa-483.mp4 " />35 <media:content bitrate="1600" width="1080" url="http://hwcdn.net/i6s8g7u7/fms/dynamic/8Juv1MVa-67727.mp4?dopproto=rtmpt" /> 36 <media:content bitrate="1200" width="720" url="http://hwcdn.net/i6s8g7u7/fms/dynamic/8Juv1MVa-485.mp4?dopproto=rtmpt" /> 37 <media:content bitrate="800" width="480" url="http://hwcdn.net/i6s8g7u7/fms/dynamic/8Juv1MVa-484.mp4?dopproto=rtmpt" /> 38 <media:content bitrate="400" width="320" url="http://hwcdn.net/i6s8g7u7/fms/dynamic/8Juv1MVa-483.mp4?dopproto=rtmpt" /> 39 39 <media:thumbnail url="http://content.bitsontherun.com/thumbs/8Juv1MVa-480.jpg" /> 40 40 </media:group> … … 54 54 </media:group> 55 55 <jwplayer:type>rtmp</jwplayer:type> 56 <jwplayer:streamer>rtmp ://fms.12E5.edgecastcdn.net/0012E5</jwplayer:streamer>56 <jwplayer:streamer>rtmpt://fms.12E5.edgecastcdn.net/0012E5</jwplayer:streamer> 57 57 </item> 58 58 -
trunk/as3/com/jeroenwijering/models/HTTPModel.as
r739 r760 91 91 92 92 93 /** Bandwidth is checked every fourseconds as long as there's loading. **/93 /** Bandwidth is checked every two seconds as long as there's loading. **/ 94 94 private function getBandwidth(old:Number):void { 95 95 var ldd:Number = stream.bytesLoaded; 96 96 var bdw:Number = Math.round((ldd-old)*4/1000); 97 97 if(ldd < stream.bytesTotal) { 98 if(bdw > 0) { model.config['bandwidth'] = bdw; } 98 if(bdw > 0) { 99 model.config['bandwidth'] = bdw; 100 Configger.saveCookie('bandwidth',bdw); 101 } 99 102 if(bwswitch) { 100 103 bwswitch = false; 101 104 if(item['levels'] && getLevel() != model.config['level']) { 102 byteoffset = -1; 103 seek(position); 105 load(item); 104 106 return; 105 107 } -
trunk/as3/com/jeroenwijering/models/RTMPModel.as
r758 r760 30 30 /** Is dynamic streaming possible. **/ 31 31 private var dynamics:Boolean; 32 /** The currently playing RTMP stream. **/ 33 private var file:String; 32 34 /** ID for the position interval. **/ 33 35 private var interval:Number; … … 101 103 /** Bandwidth checking for dynamic streaming. **/ 102 104 private function getBandwidth():void { 103 try { 104 model.config['bandwidth']= Math.round(stream.info.maxBytesPerSecond*8/1024);105 try { 106 var bdw:Number = Math.round(stream.info.maxBytesPerSecond*8/1024); 105 107 } catch(err:Error) { 106 108 clearInterval(bwinterval); 107 } 109 return; 110 } 111 if(bdw < 100 || bdw > 99999) { 112 return; 113 } else { 114 bdw = Math.round(model.config['bandwidth']/2+bdw/2); 115 } 116 model.config['bandwidth'] = bdw; 117 Configger.saveCookie('bandwidth',bdw); 108 118 if(item['levels'] && getLevel() != model.config['level']) { 109 119 swap(); … … 115 125 private function getID(url:String):String { 116 126 var ext:String = url.substr(-4); 117 if( model.config['rtmp.prepend'] == false) {127 if(url.indexOf(':') > -1) { 118 128 return url; 119 129 } else if(ext == '.mp3') { … … 208 218 if(dat.type == 'bandwidth') { 209 219 model.config['bandwidth'] = dat.bandwidth; 220 Configger.saveCookie('bandwidth',dat.bandwidth); 210 221 setStream(); 211 222 } … … 281 292 clearInterval(interval); 282 293 clearInterval(bwinterval); 283 interval = setInterval(positionInterval,100);284 294 if(item['levels'] && getLevel() != model.config['level']) { 285 295 model.config['level'] = getLevel(); … … 299 309 stream.play(getID(item['file']),0,-1); 300 310 } else { 301 stream.play(getID(item['file'])); 311 if(file != item['file']) { 312 file = item['file']; 313 stream.play(getID(item['file'])); 314 } 302 315 if(timeoffset) { stream.seek(timeoffset); } 303 316 if(dynamics) { … … 306 319 } 307 320 streaming = true; 321 interval = setInterval(positionInterval,100); 308 322 }; 309 323 … … 348 362 setStream(); 349 363 } 350 if(item['file'].substr(-4) == '.mp3' ) {364 if(item['file'].substr(-4) == '.mp3' || item['file'].substr(0,4) == 'mp3:') { 351 365 connection.call("getStreamLength",new Responder(streamlengthHandler),getID(item['file'])); 352 366 } … … 401 415 if(stream && stream.time) { stream.close(); } 402 416 streaming = false; 417 file = undefined; 403 418 connection.close(); 404 419 clearInterval(interval); … … 428 443 model.config['level'] = getLevel(); 429 444 Logger.log('transition to level '+getLevel()+' initiated'); 430 item['file'] = item['levels'][model.config['level']].url;445 item['file'] = file = item['levels'][model.config['level']].url; 431 446 var nso:NetStreamPlayOptions = new NetStreamPlayOptions(); 432 447 nso.streamName = getID(item['file']); -
trunk/as3/com/jeroenwijering/models/VideoModel.as
r679 r760 68 68 var bdw:Number = Math.round((ldd-old)*4/1000); 69 69 if(ldd < stream.bytesTotal) { 70 if(bdw > 0) { model.config['bandwidth'] = bdw; } 70 if(bdw > 0) { 71 model.config['bandwidth'] = bdw; 72 Configger.saveCookie('bandwidth',bdw); 73 } 71 74 if(bwswitch) { 72 75 bwswitch = false; -
trunk/as3/com/jeroenwijering/player/Player.as
r758 r760 47 47 48 48 autostart:false, 49 bandwidth: 5000,49 bandwidth:1500, 50 50 bufferlength:1, 51 51 displayclick:'play',
Note: See TracChangeset
for help on using the changeset viewer.
