Changeset 2043
- Timestamp:
- 01/06/12 14:47:17 (17 months ago)
- Location:
- branches/fl5_instream
- Files:
-
- 1 added
- 12 edited
-
js/bin-debug/jwplayer.js (modified) (16 diffs)
-
js/src/api/jwplayer.api.instream.js (modified) (2 diffs)
-
js/src/html5/jwplayer.html5.api.js (modified) (2 diffs)
-
js/src/html5/jwplayer.html5.instream.js (added)
-
js/src/html5/jwplayer.html5.mediavideo.js (modified) (6 diffs)
-
js/src/html5/jwplayer.html5.model.js (modified) (1 diff)
-
js/src/html5/jwplayer.html5.view.js (modified) (3 diffs)
-
js/src/jwplayer.js (modified) (1 diff)
-
js/test/examples/instream.html (modified) (4 diffs)
-
player.swf (modified) (previous)
-
src/com/longtailvideo/jwplayer/player/JavascriptInstreamAPI.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/player/PlayerVersion.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/view/View.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/fl5_instream/js/bin-debug/jwplayer.js
r2042 r2043 19 19 var $jw = jwplayer; 20 20 21 jwplayer.version = '5.9.204 2';21 jwplayer.version = '5.9.2043'; 22 22 23 23 // "Shiv" method for older IE browsers; required for parsing media tags … … 2994 2994 2995 2995 function _addInternalListener(player, type) { 2996 _player. instream_jwAddEventListener(type, 'function(dat) { jwplayer("' + _api.id + '").dispatchInstreamEvent("' + type + '", dat); }');2996 _player.jwInstreamAddEventListener(type, 'function(dat) { jwplayer("' + _api.id + '").dispatchInstreamEvent("' + type + '", dat); }'); 2997 2997 }; 2998 2998 … … 3092 3092 3093 3093 this.play = function(state) { 3094 _player. instream_jwPlay(state);3094 _player.jwInstreamPlay(state); 3095 3095 }; 3096 3096 this.pause= function(state) { 3097 _player. instream_jwPause(state);3097 _player.jwInstreamPause(state); 3098 3098 }; 3099 3099 this.seek = function(pos) { 3100 _player. instream_jwSeek(pos);3100 _player.jwInstreamSeek(pos); 3101 3101 }; 3102 3102 this.destroy = function() { 3103 _player. instream_jwDestroy();3103 _player.jwInstreamDestroy(); 3104 3104 }; 3105 3105 this.getState = function() { 3106 return _player. instream_jwGetState();3106 return _player.jwInstreamGetState(); 3107 3107 } 3108 3108 this.getDuration = function() { 3109 return _player. instream_jwGetDuration();3109 return _player.jwInstreamGetDuration(); 3110 3110 } 3111 3111 this.getPosition = function() { 3112 return _player. instream_jwGetPosition();3112 return _player.jwInstreamGetPosition(); 3113 3113 } 3114 3114 … … 4236 4236 var _falseFullscreen = false; 4237 4237 var _normalscreenWidth, _normalscreenHeight; 4238 var _instremArea; 4238 4239 4239 4240 function createWrapper() { … … 4288 4289 _box.id = _wrapper.id + "_displayarea"; 4289 4290 _wrapper.appendChild(_box); 4291 4292 _instreamArea = document.createElement("div"); 4293 _instreamArea.id = _wrapper.id + "_instreamarea"; 4294 _css(_instreamArea, { 4295 overflow: "hidden", 4296 position: "absolute", 4297 top: 0, 4298 left: 0, 4299 bottom: 0, 4300 right: 0, 4301 background: '000000', 4302 display: 'none' 4303 }); 4304 _wrapper.appendChild(_instreamArea); 4290 4305 } 4291 4306 … … 4684 4699 return false; 4685 4700 } 4686 4701 /// public function setupInstream(_instreamDisplay:DisplayObject, plugin:IPlugin):void { 4702 4703 this.setupInstream = function(instreamDisplay) { 4704 _instreamArea.style.display = "block"; 4705 _box.style.display = "none"; 4706 _instreamArea.appendChild(instreamDisplay); 4707 } 4708 4709 /// public function destroyInstream():void { 4710 var _destroyInstream = this.destroyInstream = function() { 4711 _instreamArea.style.display = "none"; 4712 _box.style.display = "block"; 4713 } 4687 4714 }; 4688 4715 … … 7013 7040 }; 7014 7041 })(jwplayer); 7042 /** 7043 * API to control instream playback without interrupting currently playing video 7044 * 7045 * @author pablo 7046 * @version 5.9 7047 */ 7048 (function(jwplayer) { 7049 var _utils = jwplayer.utils; 7050 7051 jwplayer.html5.instream = function(item, options, api, model, view, controller) { 7052 var _item = new jwplayer.html5.playlistitem(item), 7053 _api = api, 7054 _options = options, 7055 _model = model, 7056 _view = view, 7057 _controller = controller, 7058 _currentItem = _model.item, 7059 _currentPlaylist = _model.playlist, 7060 _video, _oldsrc, _oldsources, _oldpos, 7061 _self = this, 7062 _provider, _cbar, 7063 _dispatcher = new jwplayer.html5.eventdispatcher(); 7064 7065 7066 function _init() { 7067 var _thing = document.createElement("div"); 7068 _thing.id = _self.id; 7069 7070 _controller.pause(); 7071 _video = _controller.detachMedia(); 7072 // _video.style.zIndex = 10; 7073 7074 7075 _oldsrc = _video.src; 7076 _oldsources = _video.getElementsByTagName("source"); 7077 _oldpos = _video.currentPosition; 7078 7079 _view.setupInstream(_thing); 7080 7081 _setupProvider(); 7082 7083 _cbar = new jwplayer.html5.controlbar(_self, _utils.extend({},_model.plugins.config.controlbar, {position:"OVER"})); 7084 7085 _thing.appendChild(_cbar.getDisplayElement()); 7086 7087 7088 _resize(_api.jwGetWidth(), _api.jwGetHeight()); 7089 7090 _provider.load(_item); 7091 7092 return; 7093 }; 7094 7095 function _setupProvider() { 7096 _provider = new jwplayer.html5.mediavideo(_model, _model.getMedia() ? _model.getMedia().getDisplayElement() : _model.container); 7097 _provider.addGlobalListener( 7098 function(evt) { 7099 _dispatcher.sendEvent(evt.type, evt); 7100 } 7101 ); 7102 _provider.addEventListener(jwplayer.api.events.JWPLAYER_MEDIA_COMPLETE, function(evt) { 7103 _self.jwInstreamDestroy(); 7104 }); 7105 } 7106 7107 function _resize(width, height) { 7108 _css(_cbar.getDisplayElement(), { 7109 position: "absolute", 7110 width: width, 7111 height: height, 7112 zIndex: 1000 7113 }); 7114 _cbar.resize(width, height); 7115 } 7116 7117 this.jwInstreamAddEventListener = _dispatcher.addEventListener; 7118 this.jwInstreamRemoveEventListener = _dispatcher.removeEventListener; 7119 7120 this.jwInstreamPlay = function() { 7121 } 7122 7123 this.jwInstreamPause = function() { 7124 } 7125 7126 this.jwInstreamSeek = function(position) { 7127 } 7128 7129 7130 this.jwInstreamGetState = function() { 7131 } 7132 7133 this.jwInstreamGetPosition = function() { 7134 } 7135 7136 this.jwInstreamGetDuration = function() { 7137 } 7138 7139 this.jwInstreamDestroy = function() { 7140 _video.pause(); 7141 _video.src = _oldsrc; 7142 for (var i=0; i < _oldsources.length; i++) { 7143 _video.appendChild(_oldsources[i]); 7144 } 7145 _video.currentPosition = _oldpos; 7146 _video.load(); 7147 _view.destroyInstream(); 7148 7149 _controller.attachMedia(); 7150 // _model.getMedia().load(_currentPlaylist[_currentItem]); 7151 // _video.pause(); 7152 //_utils.setOuterHTML(_video, _videoHTML); 7153 } 7154 7155 7156 /** Duplicate main html5 api **/ 7157 this.skin = _api.skin; 7158 7159 this.jwPlay = function(state) {}; 7160 this.jwPause = function(state) {}; 7161 this.jwSeek = function(position) {}; 7162 this.jwStop = function() {}; 7163 this.jwGetItem = function() {}; 7164 this.jwGetPosition = function() {}; 7165 this.jwGetDuration = function() {}; 7166 7167 this.jwGetWidth = _api.jwGetWidth; 7168 this.jwGetHeight = _api.jwGetHeight; 7169 7170 this.jwGetFullscreen = _api.jwGetFullscreen; 7171 this.jwSetFullscreen = _api.jwSetFullscreen; 7172 7173 this.jwGetVolume = _api.jwGetVolume; 7174 this.jwSetVolume = _api.jwSetVolume; 7175 7176 this.jwGetMute = _api.jwGetMute; 7177 this.jwSetMute = _api.setMute; 7178 7179 this.jwGetState = function() {}; 7180 7181 this.jwGetPlaylist = function() { 7182 return [_item]; 7183 }; 7184 this.jwGetPlaylistIndex = function() { 7185 return 0; 7186 }; 7187 7188 this.jwAddEventListener = function(type, handler) { 7189 _dispatcher.addEventListener(type, handler); 7190 } 7191 this.jwRemoveEventListener = _dispatcher.removeEventListener; 7192 7193 this.id = _api.id; 7194 7195 _init(); 7196 7197 return this; 7198 }; 7199 })(jwplayer); 7200 7015 7201 /** 7016 7202 * JW Player logo component … … 7208 7394 7209 7395 var _utils = jwplayer.utils; 7210 var _css = _utils.css;7211 7396 var _isMobile = _utils.isMobile(); 7212 7397 … … 7253 7438 _emptied = false, 7254 7439 _attached = false, 7440 _userDuration = false, 7255 7441 _bufferingComplete, _bufferFull, 7256 7442 _sourceError; … … 7276 7462 7277 7463 _currentItem = item; 7464 _userDuration = (_currentItem.duration > 0); 7465 _model.duration = _currentItem.duration; 7466 7278 7467 _utils.empty(_video); 7279 7468 … … 7314 7503 item.start = 0; 7315 7504 } 7316 _model.duration = item.duration;7317 7505 _eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_MEDIA_LOADED); 7318 7506 if((!_isMobile && item.levels.length == 1) || !_emptied) { … … 7491 7679 /** Initializes the HTML5 video and audio media provider **/ 7492 7680 function _init() { 7493 _video = document.createElement("video"); 7681 if (!_video) { 7682 if (_container.tagName.toLowerCase() == "video") { 7683 _video = _container; 7684 } else { 7685 _video = document.createElement("video"); 7686 } 7687 } 7494 7688 _state = jwplayer.api.events.state.IDLE; 7495 7689 … … 7641 7835 duration: newDuration 7642 7836 }; 7643 if ( (_model.duration < newDuration || isNaN(_model.duration)) && event.target.duration != Infinity) { 7644 _model.duration = newDuration; 7837 if (!_userDuration) { 7838 if ( (_model.duration < newDuration || isNaN(_model.duration)) && event.target.duration != Infinity) { 7839 _model.duration = newDuration; 7840 } 7645 7841 } 7646 7842 _eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_MEDIA_META, { … … 8001 8197 position: 0, 8002 8198 buffer: 0, 8199 container: _container, 8003 8200 config: { 8004 8201 width: 480, … … 9134 9331 * 9135 9332 * @author zach 9136 * @version 5. 89333 * @version 5.9 9137 9334 */ 9138 9335 (function(jwplayer) { … … 9247 9444 _api.jwDisplayHide = _componentCommandFactory("display", "hide"); 9248 9445 9446 9447 var _instreamPlayer; 9448 9449 //InStream API 9450 _api.jwLoadInstream = function(item, options) { 9451 _instreamPlayer = new jwplayer.html5.instream(item, options, _api, _model, _view, _controller); 9452 } 9453 _api.jwInstreamDestroy = function() { 9454 if (_instreamPlayer) { 9455 _instreamPlayer.jwInstreamDestroy(); 9456 _instreamPlayer = null; 9457 } 9458 } 9459 9460 _api.jwInstreamAddEventListener = _callInstream('jwInstreamAddEventListener'); 9461 _api.jwInstreamRemoveEventListener = _callInstream('jwInstreamRemoveEventListener'); 9462 _api.jwInstreamGetState = _callInstream('jwInstreamGetState'); 9463 _api.jwInstreamGetDuration = _callInstream('jwInstreamGetDuration'); 9464 _api.jwInstreamGetPosition = _callInstream('jwInstreamGetPosition'); 9465 _api.jwInstreamPlay = _callInstream('jwInstreamPlay'); 9466 _api.jwInstreamPause = _callInstream('jwInstreamPause'); 9467 _api.jwInstreamSeek = _callInstream('jwInstreamSeek'); 9468 9469 function _callInstream(funcName) { 9470 return function() { 9471 if (_instreamPlayer && typeof _instreamPlayer[funcName] == "function") { 9472 return _instreamPlayer[funcName].apply(this, arguments); 9473 } else { 9474 _utils.log("Could not call instream method - instream API not initialized"); 9475 } 9476 } 9477 } 9478 9479 9249 9480 //UNIMPLEMENTED 9250 9481 _api.jwGetLevel = function() { -
branches/fl5_instream/js/src/api/jwplayer.api.instream.js
r2040 r2043 21 21 22 22 function _addInternalListener(player, type) { 23 _player. instream_jwAddEventListener(type, 'function(dat) { jwplayer("' + _api.id + '").dispatchInstreamEvent("' + type + '", dat); }');23 _player.jwInstreamAddEventListener(type, 'function(dat) { jwplayer("' + _api.id + '").dispatchInstreamEvent("' + type + '", dat); }'); 24 24 }; 25 25 … … 119 119 120 120 this.play = function(state) { 121 _player. instream_jwPlay(state);121 _player.jwInstreamPlay(state); 122 122 }; 123 123 this.pause= function(state) { 124 _player. instream_jwPause(state);124 _player.jwInstreamPause(state); 125 125 }; 126 126 this.seek = function(pos) { 127 _player. instream_jwSeek(pos);127 _player.jwInstreamSeek(pos); 128 128 }; 129 129 this.destroy = function() { 130 _player. instream_jwDestroy();130 _player.jwInstreamDestroy(); 131 131 }; 132 132 this.getState = function() { 133 return _player. instream_jwGetState();133 return _player.jwInstreamGetState(); 134 134 } 135 135 this.getDuration = function() { 136 return _player. instream_jwGetDuration();136 return _player.jwInstreamGetDuration(); 137 137 } 138 138 this.getPosition = function() { 139 return _player. instream_jwGetPosition();139 return _player.jwInstreamGetPosition(); 140 140 } 141 141 -
branches/fl5_instream/js/src/html5/jwplayer.html5.api.js
r2021 r2043 3 3 * 4 4 * @author zach 5 * @version 5. 85 * @version 5.9 6 6 */ 7 7 (function(jwplayer) { … … 116 116 _api.jwDisplayHide = _componentCommandFactory("display", "hide"); 117 117 118 119 var _instreamPlayer; 120 121 //InStream API 122 _api.jwLoadInstream = function(item, options) { 123 _instreamPlayer = new jwplayer.html5.instream(item, options, _api, _model, _view, _controller); 124 } 125 _api.jwInstreamDestroy = function() { 126 if (_instreamPlayer) { 127 _instreamPlayer.jwInstreamDestroy(); 128 _instreamPlayer = null; 129 } 130 } 131 132 _api.jwInstreamAddEventListener = _callInstream('jwInstreamAddEventListener'); 133 _api.jwInstreamRemoveEventListener = _callInstream('jwInstreamRemoveEventListener'); 134 _api.jwInstreamGetState = _callInstream('jwInstreamGetState'); 135 _api.jwInstreamGetDuration = _callInstream('jwInstreamGetDuration'); 136 _api.jwInstreamGetPosition = _callInstream('jwInstreamGetPosition'); 137 _api.jwInstreamPlay = _callInstream('jwInstreamPlay'); 138 _api.jwInstreamPause = _callInstream('jwInstreamPause'); 139 _api.jwInstreamSeek = _callInstream('jwInstreamSeek'); 140 141 function _callInstream(funcName) { 142 return function() { 143 if (_instreamPlayer && typeof _instreamPlayer[funcName] == "function") { 144 return _instreamPlayer[funcName].apply(this, arguments); 145 } else { 146 _utils.log("Could not call instream method - instream API not initialized"); 147 } 148 } 149 } 150 151 118 152 //UNIMPLEMENTED 119 153 _api.jwGetLevel = function() { -
branches/fl5_instream/js/src/html5/jwplayer.html5.mediavideo.js
r2032 r2043 16 16 17 17 var _utils = jwplayer.utils; 18 var _css = _utils.css;19 18 var _isMobile = _utils.isMobile(); 20 19 … … 61 60 _emptied = false, 62 61 _attached = false, 62 _userDuration = false, 63 63 _bufferingComplete, _bufferFull, 64 64 _sourceError; … … 84 84 85 85 _currentItem = item; 86 _userDuration = (_currentItem.duration > 0); 87 _model.duration = _currentItem.duration; 88 86 89 _utils.empty(_video); 87 90 … … 122 125 item.start = 0; 123 126 } 124 _model.duration = item.duration;125 127 _eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_MEDIA_LOADED); 126 128 if((!_isMobile && item.levels.length == 1) || !_emptied) { … … 299 301 /** Initializes the HTML5 video and audio media provider **/ 300 302 function _init() { 301 _video = document.createElement("video"); 303 if (!_video) { 304 if (_container.tagName.toLowerCase() == "video") { 305 _video = _container; 306 } else { 307 _video = document.createElement("video"); 308 } 309 } 302 310 _state = jwplayer.api.events.state.IDLE; 303 311 … … 449 457 duration: newDuration 450 458 }; 451 if ( (_model.duration < newDuration || isNaN(_model.duration)) && event.target.duration != Infinity) { 452 _model.duration = newDuration; 459 if (!_userDuration) { 460 if ( (_model.duration < newDuration || isNaN(_model.duration)) && event.target.duration != Infinity) { 461 _model.duration = newDuration; 462 } 453 463 } 454 464 _eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_MEDIA_META, { -
branches/fl5_instream/js/src/html5/jwplayer.html5.model.js
r2032 r2043 17 17 position: 0, 18 18 buffer: 0, 19 container: _container, 19 20 config: { 20 21 width: 480, -
branches/fl5_instream/js/src/html5/jwplayer.html5.view.js
r2021 r2043 23 23 var _falseFullscreen = false; 24 24 var _normalscreenWidth, _normalscreenHeight; 25 var _instremArea; 25 26 26 27 function createWrapper() { … … 75 76 _box.id = _wrapper.id + "_displayarea"; 76 77 _wrapper.appendChild(_box); 78 79 _instreamArea = document.createElement("div"); 80 _instreamArea.id = _wrapper.id + "_instreamarea"; 81 _css(_instreamArea, { 82 overflow: "hidden", 83 position: "absolute", 84 top: 0, 85 left: 0, 86 bottom: 0, 87 right: 0, 88 background: '000000', 89 display: 'none' 90 }); 91 _wrapper.appendChild(_instreamArea); 77 92 } 78 93 … … 471 486 return false; 472 487 } 473 488 /// public function setupInstream(_instreamDisplay:DisplayObject, plugin:IPlugin):void { 489 490 this.setupInstream = function(instreamDisplay) { 491 _instreamArea.style.display = "block"; 492 _box.style.display = "none"; 493 _instreamArea.appendChild(instreamDisplay); 494 } 495 496 /// public function destroyInstream():void { 497 var _destroyInstream = this.destroyInstream = function() { 498 _instreamArea.style.display = "none"; 499 _box.style.display = "block"; 500 } 474 501 }; 475 502 -
branches/fl5_instream/js/src/jwplayer.js
r2042 r2043 11 11 var $jw = jwplayer; 12 12 13 jwplayer.version = '5.9.204 2';13 jwplayer.version = '5.9.2043'; 14 14 15 15 // "Shiv" method for older IE browsers; required for parsing media tags -
branches/fl5_instream/js/test/examples/instream.html
r2041 r2043 23 23 document.write("<h1>" + document.title + "</h1>"); 24 24 </script> 25 <p>26 This sets up a player for IE9, FF, Chrome, Safari, and Opera, however, playback will fail in FF and Opera. IE < 9 will simply display "HTML5 Player should replace this".27 </p>28 29 <hr/>30 25 31 26 <form> … … 238 233 stretching: stretching, 239 234 width: playlist == "none" ? 480 : 680, 240 repeat: repeat 235 repeat: repeat, 236 plugins: { 237 // 'hd-2': { file: '/testing/files/oorlogswinter.mp4' } 238 } 241 239 }; 242 240 if (skin) { … … 254 252 {file:"http://content.bitsontherun.com/videos/yYul4DRz-1Lq5Mnwq.webm"} 255 253 ], 256 duration: 15254 duration: 5 257 255 }, instreamOptions); 258 256 … … 264 262 document.getElementById("instreamInit").style.display = "none"; 265 263 setupEvents(); 266 267 264 } else { 268 265 alert("Instream Player not present"); -
branches/fl5_instream/src/com/longtailvideo/jwplayer/player/JavascriptInstreamAPI.as
r2040 r2043 47 47 try { 48 48 // Event handlers 49 ExternalInterface.addCallback(" instream_jwAddEventListener", js_addEventListener);50 ExternalInterface.addCallback(" instream_jwRemoveEventListener", js_removeEventListener);49 ExternalInterface.addCallback("jwInstreamAddEventListener", js_addEventListener); 50 ExternalInterface.addCallback("jwInstreamRemoveEventListener", js_removeEventListener); 51 51 52 52 // Getters 53 ExternalInterface.addCallback(" instream_jwGetState", js_getState);54 ExternalInterface.addCallback(" instream_jwGetDuration", js_getDuration);55 ExternalInterface.addCallback(" instream_jwGetPosition", js_getPosition);53 ExternalInterface.addCallback("jwInstreamGetState", js_getState); 54 ExternalInterface.addCallback("jwInstreamGetDuration", js_getDuration); 55 ExternalInterface.addCallback("jwInstreamGetPosition", js_getPosition); 56 56 57 57 // Player API Calls 58 ExternalInterface.addCallback(" instream_jwPlay", js_play);59 ExternalInterface.addCallback(" instream_jwPause", js_pause);60 ExternalInterface.addCallback(" instream_jwSeek", js_seek);58 ExternalInterface.addCallback("jwInstreamPlay", js_play); 59 ExternalInterface.addCallback("jwInstreamPause", js_pause); 60 ExternalInterface.addCallback("jwInstreamSeek", js_seek); 61 61 62 62 // Instream API 63 ExternalInterface.addCallback(" instream_jwDestroy", js_destroyInstream);63 ExternalInterface.addCallback("jwInstreamDestroy", js_destroyInstream); 64 64 65 65 } catch(e:Error) { -
branches/fl5_instream/src/com/longtailvideo/jwplayer/player/PlayerVersion.as
r2042 r2043 3 3 4 4 public class PlayerVersion { 5 protected static var _version:String = '5.9.204 2';5 protected static var _version:String = '5.9.2043'; 6 6 7 7 public static function get version():String { -
branches/fl5_instream/src/com/longtailvideo/jwplayer/view/View.as
r2042 r2043 613 613 } 614 614 615 public function setupInstream( _instreamDisplay:DisplayObject, plugin:IPlugin):void {615 public function setupInstream(instreamDisplay:DisplayObject, plugin:IPlugin):void { 616 616 _instreamPlugin = plugin; 617 if ( _instreamDisplay) {618 _instreamLayer.addChild( _instreamDisplay);617 if (instreamDisplay) { 618 _instreamLayer.addChild(instreamDisplay); 619 619 } 620 620 try {
Note: See TracChangeset
for help on using the changeset viewer.
