Changeset 810
- Timestamp:
- 01/27/10 17:36:32 (3 years ago)
- Location:
- trunk/fl5
- Files:
-
- 6 edited
-
player.swf (modified) (previous)
-
src/com/longtailvideo/jwplayer/media/HTTPMediaProvider.as (modified) (8 diffs)
-
src/com/longtailvideo/jwplayer/media/MediaProvider.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/media/RTMPMediaProvider.as (modified) (4 diffs)
-
src/com/longtailvideo/jwplayer/media/VideoMediaProvider.as (modified) (2 diffs)
-
src/com/longtailvideo/jwplayer/player/PlayerVersion.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fl5/src/com/longtailvideo/jwplayer/media/HTTPMediaProvider.as
r806 r810 25 25 protected var _transformer:SoundTransform; 26 26 /** ID for the _position interval. **/ 27 protected var _positionInterval: Number;27 protected var _positionInterval:uint; 28 28 /** Save whether metadata has already been sent. **/ 29 29 protected var _meta:Boolean; … … 36 36 /** Boolean for mp4 / flv streaming. **/ 37 37 protected var _mp4:Boolean; 38 /** Load offset for bandwidth checking. **/39 protected var _loadtimer:Number;40 38 /** Variable that takes reloading into account. **/ 41 39 protected var _iterator:Number; … … 46 44 /** Whether the enitre video has been buffered **/ 47 45 private var _bufferingComplete:Boolean; 46 /** Whether we have checked the bandwidth. **/ 47 private var _bandwidthSwitch:Boolean = true; 48 /** Whether we have checked bandwidth **/ 49 private var _bandwidthChecked:Boolean; 50 /** Bandwidth check delay **/ 51 private var _bandwidthTimeout:Number = 2000; 48 52 49 53 /** Constructor; sets up the connection and display. **/ … … 152 156 _bufferFull = false; 153 157 _bufferingComplete = false; 158 _bandwidthChecked = false; 159 _bandwidthSwitch = true; 160 161 if (item.levels.length > 0) { item.setLevel(item.getLevel(config.bandwidth, config.width)); } 162 154 163 if (_stream.bytesLoaded + _byteoffset < _stream.bytesTotal) { 155 164 _stream.close(); … … 157 166 media = _video; 158 167 _stream.play(getURL()); 159 160 if (!_positionInterval) { 161 _positionInterval = setInterval(positionInterval, 100); 162 } 163 if (!_loadtimer) { 164 _loadtimer = setTimeout(loadTimeout, 3000); 165 } 168 169 clearInterval(_positionInterval); 170 _positionInterval = setInterval(positionInterval, 100); 171 166 172 setState(PlayerState.BUFFERING); 167 173 sendBufferEvent(0, 0); … … 171 177 172 178 173 /** timeout for checking the bitrate. **/ 174 protected function loadTimeout():void { 175 var obj:Object = new Object(); 176 obj.bandwidth = Math.round(_stream.bytesLoaded / 1024 / 3 * 8); 177 if (item.duration) { 178 obj.bitrate = Math.round(_stream.bytesTotal / 1024 * 8 / item.duration); 179 } 180 sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata: obj}); 181 } 182 179 /** Bandwidth is checked as long the stream hasn't completed loading. **/ 180 private function checkBandwidth(lastLoaded:Number):void { 181 var currentLoaded:Number = _stream.bytesLoaded; 182 var bandwidth:Number = Math.ceil((currentLoaded - lastLoaded) / 1024) * 8 / (_bandwidthTimeout / 1000); 183 184 if (currentLoaded < _stream.bytesTotal) { 185 if (bandwidth > 0) { 186 config.bandwidth = bandwidth; 187 var obj:Object = {bandwidth:bandwidth}; 188 if (item.duration > 0) { 189 obj.bitrate = Math.ceil(_stream.bytesTotal / 1024 * 8 / item.duration); 190 } 191 sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata: obj}); 192 } 193 if (_bandwidthSwitch) { 194 _bandwidthSwitch = false; 195 if (item.currentLevel != item.getLevel(config.bandwidth, config.width)) { 196 load(item); 197 return; 198 } 199 } 200 setTimeout(checkBandwidth, _bandwidthTimeout, currentLoaded); 201 } 202 } 183 203 184 204 /** Get metadata information from netstream class. **/ … … 246 266 bufferFill = _stream.bufferLength/_stream.bufferTime * 100; 247 267 } 248 268 269 if (!_bandwidthChecked && _stream.bytesLoaded > 0 && _stream.bytesLoaded < _stream.bytesTotal) { 270 _bandwidthChecked = true; 271 setTimeout(checkBandwidth, _bandwidthTimeout, _stream.bytesLoaded); 272 } 273 249 274 if (bufferFill < 25 && state == PlayerState.PLAYING) { 250 275 _bufferFull = false; … … 344 369 super.setVolume(vol); 345 370 } 371 372 /** Handle a resize event **/ 373 override public function resize(width:Number, height:Number):void { 374 super.resize(width, height); 375 if (item.levels.length > 0 && item.getLevel(config.bandwidth, config.width) != item.currentLevel) { 376 _byteoffset = getOffset(position); 377 _timeoffset = _position = getOffset(position,true); 378 load(item); 379 } 380 } 346 381 } 347 382 } -
trunk/fl5/src/com/longtailvideo/jwplayer/media/MediaProvider.as
r806 r810 320 320 if (m) { 321 321 _media = new MovieClip(); 322 //_media.visible = false;322 _media.visible = false; 323 323 _media.addChild(m); 324 324 if (_width * _height > 0) { -
trunk/fl5/src/com/longtailvideo/jwplayer/media/RTMPMediaProvider.as
r807 r810 31 31 **/ 32 32 public class RTMPMediaProvider extends MediaProvider { 33 /** Save if the bandwidth checkin already occurs. **/34 private var _bandwidthChecked:Boolean;33 /** Save if the bandwidth checkin already occurs. **/ 34 private var _bandwidthChecked:Boolean; 35 35 /** Interval for bw checking - with dynamic streaming. **/ 36 36 private var _bandwidthInterval:Number; 37 /** Whether to connect to a stream when bandwidth is detected. **/ 38 private var _bandwidthSwitch:Boolean; 37 39 /** NetConnection object for setup of the video stream. **/ 38 40 private var _connection:NetConnection; … … 147 149 _position = 0; 148 150 _bufferFull = false; 151 _bandwidthSwitch = false; 149 152 _timeoffset = item.start; 150 153 if (item.levels.length > 0) { item.setLevel(item.getLevel(config.bandwidth, config.width)); } … … 237 240 config.bandwidth = dat.bandwidth; 238 241 Configger.saveCookie('bandwidth', dat.bandwidth); 239 setStream(); 242 if (_bandwidthSwitch) { 243 _bandwidthSwitch = false; 244 setStream(); 245 } 240 246 } 241 247 if (dat.code == 'NetStream.Play.TransitionComplete') { … … 395 401 } else { 396 402 _bandwidthChecked = true; 403 _bandwidthSwitch = true; 397 404 _connection.call('checkBandwidth', null); 398 405 } -
trunk/fl5/src/com/longtailvideo/jwplayer/media/VideoMediaProvider.as
r806 r810 176 176 private function checkBandwidth(lastLoaded:Number):void { 177 177 var currentLoaded:Number = _stream.bytesLoaded; 178 var bandwidth:Number = ((currentLoaded - lastLoaded) / 1024) * 8 / (_bandwidthTimeout / 1000);178 var bandwidth:Number = Math.ceil((currentLoaded - lastLoaded) / 1024) * 8 / (_bandwidthTimeout / 1000); 179 179 if (currentLoaded < _stream.bytesTotal) { 180 180 if (bandwidth > 0) { … … 182 182 var obj:Object = {bandwidth:bandwidth}; 183 183 if (item.duration > 0) { 184 obj.bitrate = Math. round(_stream.bytesTotal / 1024 * 8 / item.duration);184 obj.bitrate = Math.ceil(_stream.bytesTotal / 1024 * 8 / item.duration); 185 185 } 186 186 sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_META, {metadata: obj}); -
trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as
r809 r810 3 3 4 4 public class PlayerVersion { 5 protected static var _version:String = "5.1.8 09";5 protected static var _version:String = "5.1.810"; 6 6 7 7 public static function get version():String {
Note: See TracChangeset
for help on using the changeset viewer.
