Changeset 651
- Timestamp:
- 11/19/09 16:25:51 (3 years ago)
- Location:
- trunk/fl5
- Files:
-
- 4 edited
-
player.swf (modified) (previous)
-
src/com/longtailvideo/jwplayer/media/SoundMediaProvider.as (modified) (8 diffs)
-
src/com/longtailvideo/jwplayer/media/YouTubeMediaProvider.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/SoundMediaProvider.as
r642 r651 8 8 import com.longtailvideo.jwplayer.model.PlaylistItem; 9 9 import com.longtailvideo.jwplayer.player.PlayerState; 10 10 11 11 import flash.events.*; 12 12 import flash.media.*; … … 26 26 /** ID for the position interval. **/ 27 27 protected var _positionInterval:Number; 28 28 /** Whether the buffer has filled **/ 29 private var _bufferFull:Boolean; 29 30 30 31 /** Constructor; sets up the connection and display. **/ … … 71 72 /** Load the _sound. **/ 72 73 override public function load(itm:PlaylistItem):void { 73 _item = itm;74 74 _position = 0; 75 _sound = new Sound(); 76 _sound.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); 77 _sound.addEventListener(Event.ID3, id3Handler); 78 _sound.addEventListener(ProgressEvent.PROGRESS, positionHandler); 79 _sound.load(new URLRequest(_item.file), _context); 80 _positionInterval = setInterval(positionHandler, 100); 75 if (_item != itm) { 76 _item = itm; 77 _sound = new Sound(); 78 _sound.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); 79 _sound.addEventListener(Event.ID3, id3Handler); 80 _sound.addEventListener(ProgressEvent.PROGRESS, positionHandler); 81 _sound.load(new URLRequest(_item.file), _context); 82 } 83 if (!_positionInterval) { 84 _positionInterval = setInterval(positionHandler, 100); 85 } 86 _bufferFull = false; 81 87 setState(PlayerState.BUFFERING); 82 88 sendBufferEvent(0); … … 88 94 /** Pause the _sound. **/ 89 95 override public function pause():void { 90 if (_ channel){96 if (_positionInterval){ 91 97 clearInterval(_positionInterval); 92 98 _positionInterval = undefined; 99 } 100 if (_channel) { 93 101 _channel.stop(); 94 102 } … … 106 114 _positionInterval = setInterval(positionHandler, 100); 107 115 } 116 if (_channel){ 117 _channel.stop(); 118 _channel = null; 119 } 108 120 _channel = _sound.play(_position * 1000, 0, _transformer); 109 121 _channel.addEventListener(Event.SOUND_COMPLETE, completeHandler); … … 115 127 protected function positionHandler(progressEvent:ProgressEvent=null):void { 116 128 var bufferPercent:Number; 129 117 130 if (_sound.bytesLoaded / _sound.bytesTotal > 0.1 && _item.duration <= 0) { 118 131 _item.duration = _sound.length / 1000 / _sound.bytesLoaded * _sound.bytesTotal; 119 132 } 133 120 134 if (_channel) { 121 135 _position = Math.round(_channel.position / 100) / 10; … … 124 138 bufferPercent = Math.floor(progressEvent.bytesLoaded / progressEvent.bytesTotal * 100); 125 139 } 140 126 141 if (_sound.isBuffering == true && _sound.bytesTotal > _sound.bytesLoaded) { 127 142 if (state != PlayerState.BUFFERING) { … … 129 144 _channel.stop(); 130 145 } 131 setState(PlayerState.BUFFERING); 132 } else { 146 _bufferFull = false; 147 if (!progressEvent) { 148 setState(PlayerState.BUFFERING); 149 } 150 } 151 } else if (state == PlayerState.BUFFERING && _sound.isBuffering == false && !_bufferFull) { 152 sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL); 153 _bufferFull = true; 154 } 155 156 if (state == PlayerState.BUFFERING) { 157 if (!isNaN(bufferPercent)){ 133 158 sendBufferEvent(bufferPercent); 134 159 } 135 } else if (state == PlayerState.BUFFERING && _sound.isBuffering == false) { 136 sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL); 137 } 138 if (_position < _item.duration) { 139 sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {position: _position, 140 duration: _item.duration, bufferPercent: bufferPercent}); 160 } else if (_position < _item.duration) { 161 if (state == PlayerState.PLAYING){ 162 sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {position: _position, duration: _item.duration, bufferPercent: bufferPercent}); 163 } 141 164 } else if (_item.duration > 0) { 142 165 complete(); -
trunk/fl5/src/com/longtailvideo/jwplayer/media/YouTubeMediaProvider.as
r650 r651 179 179 if (state != PlayerState.BUFFERING && state != PlayerState.IDLE) { 180 180 complete(); 181 _offset = 0; 181 182 } 182 183 break; … … 244 245 super.setVolume(pct); 245 246 } 246 247 /** Complete playback **/248 override protected function complete():void {249 sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE);250 setState(PlayerState.IDLE);251 _position = _offset = 0;252 }253 247 } 254 248 } -
trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as
r650 r651 3 3 4 4 public class PlayerVersion { 5 protected static var _version:String = "5.0.6 49beta";5 protected static var _version:String = "5.0.651 beta"; 6 6 7 7 public static function get version():String {
Note: See TracChangeset
for help on using the changeset viewer.
