Changeset 2040
- Timestamp:
- 01/04/12 20:47:59 (17 months ago)
- Location:
- branches/fl5_instream
- Files:
-
- 15 added
- 26 edited
-
build/build.xml (modified) (1 diff)
-
js/bin-debug/jwplayer.js (modified) (10 diffs)
-
js/src/api/jwplayer.api.instream.js (added)
-
js/src/api/jwplayer.api.js (modified) (6 diffs)
-
js/src/embed/jwplayer.embed.flash.js (modified) (1 diff)
-
js/src/jwplayer.js (modified) (1 diff)
-
js/src/utils/jwplayer.utils.js (modified) (1 diff)
-
js/test/examples/index.html (modified) (1 diff)
-
js/test/examples/instream (added)
-
js/test/examples/instream.html (added)
-
js/test/examples/instream/ad1.xml (added)
-
js/test/examples/instream/ad2.xml (added)
-
js/test/examples/instream/adschedule.xml (added)
-
player.swf (modified) (previous)
-
src/com/longtailvideo/jwplayer/controller/Controller.as (modified) (11 diffs)
-
src/com/longtailvideo/jwplayer/controller/PlayerSetup.as (modified) (2 diffs)
-
src/com/longtailvideo/jwplayer/events/InstreamEvent.as (added)
-
src/com/longtailvideo/jwplayer/events/MediaEvent.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/model/ControlbarSeekOptions.as (added)
-
src/com/longtailvideo/jwplayer/model/IInstreamOptions.as (added)
-
src/com/longtailvideo/jwplayer/model/InstreamOptions.as (added)
-
src/com/longtailvideo/jwplayer/model/Model.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/model/PlayerConfig.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/player/IInstreamPlayer.as (added)
-
src/com/longtailvideo/jwplayer/player/IPlayer.as (modified) (2 diffs)
-
src/com/longtailvideo/jwplayer/player/InstreamPlayer.as (added)
-
src/com/longtailvideo/jwplayer/player/JavascriptAPI.as (modified) (5 diffs)
-
src/com/longtailvideo/jwplayer/player/JavascriptInstreamAPI.as (added)
-
src/com/longtailvideo/jwplayer/player/Player.as (modified) (3 diffs)
-
src/com/longtailvideo/jwplayer/player/PlayerVersion.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/plugins/AbstractPlugin.as (added)
-
src/com/longtailvideo/jwplayer/plugins/InStreamAdPlugin.as (added)
-
src/com/longtailvideo/jwplayer/utils/Animations.as (modified) (4 diffs)
-
src/com/longtailvideo/jwplayer/utils/DisplayObjectUtils.as (modified) (2 diffs)
-
src/com/longtailvideo/jwplayer/utils/JavascriptSerialization.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/utils/Stacker.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/view/View.as (modified) (7 diffs)
-
src/com/longtailvideo/jwplayer/view/components/ControlbarComponentV4.as (modified) (7 diffs)
-
src/com/longtailvideo/jwplayer/view/components/CoreComponent.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/view/components/DisplayComponent.as (modified) (5 diffs)
-
src/com/longtailvideo/jwplayer/view/interfaces/IDisplayComponent.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/fl5_instream/build/build.xml
r2032 r2040 250 250 <fileset dir="${basedir}/js/src/plugins" includes="jwplayer.plugins.js" /> 251 251 <fileset dir="${basedir}/js/src/plugins" includes="**/*.js" excludes="jwplayer.plugins.js" /> 252 <fileset dir="${basedir}/js/src/api" includes="**/*.js" /> 252 <fileset dir="${basedir}/js/src/api" includes="jwplayer.api.js" /> 253 <fileset dir="${basedir}/js/src/api" includes="jwplayer.api.instream.js" /> 253 254 <fileset dir="${basedir}/js/src/embed" includes="jwplayer.embed.js" /> 254 255 <fileset dir="${basedir}/js/src/embed" includes="**/*.js" excludes="jwplayer.embed.js" /> -
branches/fl5_instream/js/bin-debug/jwplayer.js
r2032 r2040 19 19 var $jw = jwplayer; 20 20 21 jwplayer.version = '5.9.20 32';21 jwplayer.version = '5.9.2040'; 22 22 23 23 // "Shiv" method for older IE browsers; required for parsing media tags … … 874 874 } 875 875 876 /* Normalizes differences between Flash and HTML5 internal players' event responses. */ 877 jwplayer.utils.translateEventResponse = function(type, eventProperties) { 878 var translated = jwplayer.utils.extend({}, eventProperties); 879 if (type == jwplayer.api.events.JWPLAYER_FULLSCREEN && !translated.fullscreen) { 880 translated.fullscreen = translated.message == "true" ? true : false; 881 delete translated.message; 882 } else if (typeof translated.data == "object") { 883 // Takes ViewEvent "data" block and moves it up a level 884 translated = jwplayer.utils.extend(translated, translated.data); 885 delete translated.data; 886 } 887 888 var rounders = ["position", "duration", "offset"]; 889 for (var rounder in rounders) { 890 if (translated[rounders[rounder]]) { 891 translated[rounders[rounder]] = Math.round(translated[rounders[rounder]] * 1000) / 1000; 892 } 893 } 894 895 return translated; 896 } 876 897 877 898 })(jwplayer); … … 2312 2333 var _playerReady = false; 2313 2334 var _queuedCalls = []; 2335 var _instream = undefined; 2314 2336 2315 2337 var _originalHTML = jwplayer.utils.getOuterHTML(container); … … 2537 2559 return this; 2538 2560 }; 2561 this.loadInstream = function(item, instreamOptions) { 2562 _instream = new jwplayer.api.instream(this, _player, item, instreamOptions); 2563 return _instream; 2564 }; 2539 2565 // Player Events 2540 2566 this.onBufferChange = function(callback) { … … 2709 2735 this.dispatchEvent = function(type) { 2710 2736 if (_listeners[type]) { 2711 var args = translateEventResponse(type, arguments[1]);2737 var args = _utils.translateEventResponse(type, arguments[1]); 2712 2738 for (var l = 0; l < _listeners[type].length; l++) { 2713 2739 if (typeof _listeners[type][l] == 'function') { … … 2717 2743 } 2718 2744 }; 2719 2720 function translateEventResponse(type, eventProperties) { 2721 var translated = jwplayer.utils.extend({}, eventProperties); 2722 if (type == jwplayer.api.events.JWPLAYER_FULLSCREEN && !translated.fullscreen) { 2723 translated.fullscreen = translated.message == "true" ? true : false; 2724 delete translated.message; 2725 } else if (typeof translated.data == "object") { 2726 // Takes ViewEvent "data" block and moves it up a level 2727 translated = jwplayer.utils.extend(translated, translated.data); 2728 delete translated.data; 2729 } 2730 2731 var rounders = ["position", "duration", "offset"]; 2732 for (var rounder in rounders) { 2733 if (translated[rounders[rounder]]) { 2734 translated[rounders[rounder]] = Math.round(translated[rounders[rounder]] * 1000) / 1000; 2735 } 2736 } 2737 2738 return translated; 2739 } 2740 2741 this.callInternal = function(funcName, args) { 2745 2746 this.dispatchInstreamEvent = function(type) { 2747 if (_instream) { 2748 _instream.dispatchEvent(type, arguments); 2749 } 2750 }; 2751 2752 this.callInternal = function() { 2742 2753 /*this.callInternal = function() { 2743 2754 var funcName = arguments[0], … … 2746 2757 args[argument] = arguments[argument]; 2747 2758 }*/ 2759 2748 2760 if (_playerReady) { 2761 var funcName = arguments[0], 2762 args = []; 2763 2764 for (var argument = 1; argument < arguments.length; argument++) { 2765 args.push(arguments[argument]); 2766 } 2767 2749 2768 if (typeof _player != "undefined" && typeof _player[funcName] == "function") { 2750 if (jwplayer.utils.exists(args)) { 2751 //return (_player[funcName]).apply(this, args); 2752 return (_player[funcName])(args); 2769 if (args.length == 2) { 2770 return (_player[funcName])(args[0], args[1]); 2771 } else if (args.length == 1) { 2772 return (_player[funcName])(args[0]); 2753 2773 } else { 2754 2774 return (_player[funcName])(); … … 2867 2887 JWPLAYER_PLAYER_STATE: 'jwplayerPlayerState', 2868 2888 JWPLAYER_PLAYLIST_LOADED: 'jwplayerPlaylistLoaded', 2869 JWPLAYER_PLAYLIST_ITEM: 'jwplayerPlaylistItem' 2889 JWPLAYER_PLAYLIST_ITEM: 'jwplayerPlaylistItem', 2890 JWPLAYER_INSTREAM_CLICK: 'jwplayerInstreamClicked', 2891 JWPLAYER_INSTREAM_DESTROYED: 'jwplayerInstreamDestroyed' 2870 2892 }; 2871 2893 … … 2950 2972 } 2951 2973 }; 2974 /** 2975 * InStream API 2976 * 2977 * @author Pablo 2978 * @version 5.9 2979 */ 2980 (function(jwplayer) { 2981 2982 jwplayer.api.instream = function(api, player, item, options) { 2983 2984 var _api = api; 2985 var _player = player; 2986 var _item = item; 2987 var _options = options; 2988 var _listeners = {}; 2989 var _stateListeners = {}; 2990 2991 function _init() { 2992 _api.callInternal("jwLoadInstream", item, options); 2993 } 2994 2995 function _addInternalListener(player, type) { 2996 _player.instream_jwAddEventListener(type, 'function(dat) { jwplayer("' + _api.id + '").dispatchInstreamEvent("' + type + '", dat); }'); 2997 }; 2998 2999 function _eventListener(type, callback) { 3000 if (!_listeners[type]) { 3001 _listeners[type] = []; 3002 _addInternalListener(_player, type); 3003 } 3004 _listeners[type].push(callback); 3005 return this; 3006 }; 3007 3008 function _stateListener(state, callback) { 3009 if (!_stateListeners[state]) { 3010 _stateListeners[state] = []; 3011 _eventListener(jwplayer.api.events.JWPLAYER_PLAYER_STATE, _stateCallback(state)); 3012 } 3013 _stateListeners[state].push(callback); 3014 return this; 3015 }; 3016 3017 function _stateCallback(state) { 3018 return function(args) { 3019 var newstate = args.newstate, oldstate = args.oldstate; 3020 if (newstate == state) { 3021 var callbacks = _stateListeners[newstate]; 3022 if (callbacks) { 3023 for (var c = 0; c < callbacks.length; c++) { 3024 if (typeof callbacks[c] == 'function') { 3025 callbacks[c].call(this, { 3026 oldstate: oldstate, 3027 newstate: newstate, 3028 type: args.type 3029 }); 3030 } 3031 } 3032 } 3033 } 3034 }; 3035 } 3036 this.dispatchEvent = function(type, calledArguments) { 3037 if (_listeners[type]) { 3038 var args = _utils.translateEventResponse(type, calledArguments[1]); 3039 for (var l = 0; l < _listeners[type].length; l++) { 3040 if (typeof _listeners[type][l] == 'function') { 3041 _listeners[type][l].call(this, args); 3042 } 3043 } 3044 } 3045 } 3046 3047 3048 this.onError = function(callback) { 3049 return _eventListener(jwplayer.api.events.JWPLAYER_ERROR, callback); 3050 }; 3051 this.onFullscreen = function(callback) { 3052 return _eventListener(jwplayer.api.events.JWPLAYER_FULLSCREEN, callback); 3053 }; 3054 this.onMeta = function(callback) { 3055 return _eventListener(jwplayer.api.events.JWPLAYER_MEDIA_META, callback); 3056 }; 3057 this.onMute = function(callback) { 3058 return _eventListener(jwplayer.api.events.JWPLAYER_MEDIA_MUTE, callback); 3059 }; 3060 this.onComplete = function(callback) { 3061 return _eventListener(jwplayer.api.events.JWPLAYER_MEDIA_COMPLETE, callback); 3062 }; 3063 this.onSeek = function(callback) { 3064 return _eventListener(jwplayer.api.events.JWPLAYER_MEDIA_SEEK, callback); 3065 }; 3066 this.onTime = function(callback) { 3067 return _eventListener(jwplayer.api.events.JWPLAYER_MEDIA_TIME, callback); 3068 }; 3069 this.onVolume = function(callback) { 3070 return _eventListener(jwplayer.api.events.JWPLAYER_MEDIA_VOLUME, callback); 3071 }; 3072 // State events 3073 this.onBuffer = function(callback) { 3074 return _stateListener(jwplayer.api.events.state.BUFFERING, callback); 3075 }; 3076 this.onPause = function(callback) { 3077 return _stateListener(jwplayer.api.events.state.PAUSED, callback); 3078 }; 3079 this.onPlay = function(callback) { 3080 return _stateListener(jwplayer.api.events.state.PLAYING, callback); 3081 }; 3082 this.onIdle = function(callback) { 3083 return _stateListener(jwplayer.api.events.state.IDLE, callback); 3084 }; 3085 // Instream events 3086 this.onInstreamClick = function(callback) { 3087 return _eventListener(jwplayer.api.events.JWPLAYER_INSTREAM_CLICK, callback); 3088 }; 3089 this.onInstreamDestroyed = function(callback) { 3090 return _eventListener(jwplayer.api.events.JWPLAYER_INSTREAM_DESTROYED, callback); 3091 }; 3092 3093 this.play = function(state) { 3094 _player.instream_jwPlay(state); 3095 }; 3096 this.pause= function(state) { 3097 _player.instream_jwPause(state); 3098 }; 3099 this.seek = function(pos) { 3100 _player.instream_jwSeek(pos); 3101 }; 3102 this.destroy = function() { 3103 _player.instream_jwDestroy(); 3104 }; 3105 this.getState = function() { 3106 return _player.instream_jwGetState(); 3107 } 3108 this.getDuration = function() { 3109 return _player.instream_jwGetDuration(); 3110 } 3111 this.getPosition = function() { 3112 return _player.instream_jwGetPosition(); 3113 } 3114 3115 _init(); 3116 3117 3118 } 3119 3120 })(jwplayer); 3121 2952 3122 /** 2953 3123 * Embedder for the JW Player … … 3733 3903 var providers = ["video", "http", "sound", "image"]; 3734 3904 // Provider is set, and is not video, http, sound, image - play in Flash 3735 if (provider && (providers.toString().indexOf(provider < 0))) {3905 if (provider && (providers.toString().indexOf(provider) < 0) ) { 3736 3906 return true; 3737 3907 } -
branches/fl5_instream/js/src/api/jwplayer.api.js
r2032 r2040 19 19 var _playerReady = false; 20 20 var _queuedCalls = []; 21 var _instream = undefined; 21 22 22 23 var _originalHTML = jwplayer.utils.getOuterHTML(container); … … 244 245 return this; 245 246 }; 247 this.loadInstream = function(item, instreamOptions) { 248 _instream = new jwplayer.api.instream(this, _player, item, instreamOptions); 249 return _instream; 250 }; 246 251 // Player Events 247 252 this.onBufferChange = function(callback) { … … 416 421 this.dispatchEvent = function(type) { 417 422 if (_listeners[type]) { 418 var args = translateEventResponse(type, arguments[1]);423 var args = _utils.translateEventResponse(type, arguments[1]); 419 424 for (var l = 0; l < _listeners[type].length; l++) { 420 425 if (typeof _listeners[type][l] == 'function') { … … 424 429 } 425 430 }; 426 427 function translateEventResponse(type, eventProperties) { 428 var translated = jwplayer.utils.extend({}, eventProperties); 429 if (type == jwplayer.api.events.JWPLAYER_FULLSCREEN && !translated.fullscreen) { 430 translated.fullscreen = translated.message == "true" ? true : false; 431 delete translated.message; 432 } else if (typeof translated.data == "object") { 433 // Takes ViewEvent "data" block and moves it up a level 434 translated = jwplayer.utils.extend(translated, translated.data); 435 delete translated.data; 436 } 437 438 var rounders = ["position", "duration", "offset"]; 439 for (var rounder in rounders) { 440 if (translated[rounders[rounder]]) { 441 translated[rounders[rounder]] = Math.round(translated[rounders[rounder]] * 1000) / 1000; 442 } 443 } 444 445 return translated; 446 } 447 448 this.callInternal = function(funcName, args) { 431 432 this.dispatchInstreamEvent = function(type) { 433 if (_instream) { 434 _instream.dispatchEvent(type, arguments); 435 } 436 }; 437 438 this.callInternal = function() { 449 439 /*this.callInternal = function() { 450 440 var funcName = arguments[0], … … 453 443 args[argument] = arguments[argument]; 454 444 }*/ 445 455 446 if (_playerReady) { 447 var funcName = arguments[0], 448 args = []; 449 450 for (var argument = 1; argument < arguments.length; argument++) { 451 args.push(arguments[argument]); 452 } 453 456 454 if (typeof _player != "undefined" && typeof _player[funcName] == "function") { 457 if (jwplayer.utils.exists(args)) { 458 //return (_player[funcName]).apply(this, args); 459 return (_player[funcName])(args); 455 if (args.length == 2) { 456 return (_player[funcName])(args[0], args[1]); 457 } else if (args.length == 1) { 458 return (_player[funcName])(args[0]); 460 459 } else { 461 460 return (_player[funcName])(); … … 574 573 JWPLAYER_PLAYER_STATE: 'jwplayerPlayerState', 575 574 JWPLAYER_PLAYLIST_LOADED: 'jwplayerPlaylistLoaded', 576 JWPLAYER_PLAYLIST_ITEM: 'jwplayerPlaylistItem' 575 JWPLAYER_PLAYLIST_ITEM: 'jwplayerPlaylistItem', 576 JWPLAYER_INSTREAM_CLICK: 'jwplayerInstreamClicked', 577 JWPLAYER_INSTREAM_DESTROYED: 'jwplayerInstreamDestroyed' 577 578 }; 578 579 -
branches/fl5_instream/js/src/embed/jwplayer.embed.flash.js
r1799 r2040 238 238 var providers = ["video", "http", "sound", "image"]; 239 239 // Provider is set, and is not video, http, sound, image - play in Flash 240 if (provider && (providers.toString().indexOf(provider < 0))) {240 if (provider && (providers.toString().indexOf(provider) < 0) ) { 241 241 return true; 242 242 } -
branches/fl5_instream/js/src/jwplayer.js
r2032 r2040 11 11 var $jw = jwplayer; 12 12 13 jwplayer.version = '5.9.20 32';13 jwplayer.version = '5.9.2040'; 14 14 15 15 // "Shiv" method for older IE browsers; required for parsing media tags -
branches/fl5_instream/js/src/utils/jwplayer.utils.js
r2011 r2040 849 849 } 850 850 851 /* Normalizes differences between Flash and HTML5 internal players' event responses. */ 852 jwplayer.utils.translateEventResponse = function(type, eventProperties) { 853 var translated = jwplayer.utils.extend({}, eventProperties); 854 if (type == jwplayer.api.events.JWPLAYER_FULLSCREEN && !translated.fullscreen) { 855 translated.fullscreen = translated.message == "true" ? true : false; 856 delete translated.message; 857 } else if (typeof translated.data == "object") { 858 // Takes ViewEvent "data" block and moves it up a level 859 translated = jwplayer.utils.extend(translated, translated.data); 860 delete translated.data; 861 } 862 863 var rounders = ["position", "duration", "offset"]; 864 for (var rounder in rounders) { 865 if (translated[rounders[rounder]]) { 866 translated[rounders[rounder]] = Math.round(translated[rounders[rounder]] * 1000) / 1000; 867 } 868 } 869 870 return translated; 871 } 851 872 852 873 })(jwplayer); -
branches/fl5_instream/js/test/examples/index.html
r2032 r2040 200 200 "Player 5.9": { 201 201 "Features": { 202 "onBeforePlay Event": "onbeforeplay.html" 202 "onBeforePlay Event": "onbeforeplay.html", 203 "InStream API": "instream.html" 203 204 } 204 205 } -
branches/fl5_instream/src/com/longtailvideo/jwplayer/controller/Controller.as
r2032 r2040 85 85 /** Load after unlock - My favorite variable ever **/ 86 86 protected var _unlockAndLoad:Boolean; 87 /** The lock swallowed the complete action; we should go to the next playlist item if necessary **/ 88 protected var _completeOnUnlock:Boolean; 87 89 /** Whether the playlist has been loaded yet **/ 88 90 protected var _playlistReady:Boolean = false; … … 229 231 protected function playlistItemHandler(evt:PlaylistEvent):void { 230 232 _model.config.item = _model.playlist.currentIndex; 233 _interruptPlay = false; 231 234 load(_model.playlist.currentItem); 232 235 } … … 245 248 246 249 247 protected function completeHandler(evt:MediaEvent):void { 250 protected function completeHandler(evt:MediaEvent=null):void { 251 if (locking) { 252 _completeOnUnlock = true; 253 return; 254 } 255 248 256 switch (_model.config.repeat) { 249 257 case RepeatOptions.SINGLE: … … 287 295 if (_lockManager.lock(plugin, callback)) { 288 296 // If it was playing, pause playback and plan to resume when you're done 289 if (_player.state == PlayerState.PLAYING || _player.state == PlayerState.BUFFERING || _preplay ) {297 if (_player.state == PlayerState.PLAYING || _player.state == PlayerState.BUFFERING || _preplay || continueOnRepeat) { 290 298 if (!_preplay) { 291 299 _model.media.pause(); 292 300 } 293 301 _lockingResume = true; 294 } 302 _interruptPlay = false; 303 } else { 304 _interruptPlay = true; 305 } 306 295 307 296 308 // Tell everyone you're locked … … 317 329 } 318 330 if (!locking) { 319 if (_unlockAndLoad) { 331 if (_completeOnUnlock) { 332 _completeOnUnlock = false; 333 completeHandler(); 334 _interruptPlay = false; 335 return true; 336 } else if (_unlockAndLoad) { 320 337 load(_player.playlist.currentItem); 321 338 _unlockAndLoad = false; … … 328 345 } 329 346 } 347 _interruptPlay = false; 330 348 return true; 331 349 } … … 336 354 337 355 public function setVolume(vol:Number):Boolean { 338 if (locking) { 339 return false; 340 } 356 /* if (locking) { 357 return false; 358 } 359 */ 341 360 if (_model.media) { 342 361 mute(false); … … 351 370 352 371 public function mute(muted:Boolean):Boolean { 353 if (locking) { 354 return false; 355 } 372 /* if (locking) { 373 return false; 374 } 375 */ 356 376 if (muted && !_model.mute) { 357 377 _model.mute = true; … … 370 390 if (!_preplay) { 371 391 _preplay = true; 372 dispatchEvent(new PlayerEvent(MediaEvent.JWPLAYER_MEDIA_BEFOREPLAY));392 dispatchEvent(new MediaEvent(MediaEvent.JWPLAYER_MEDIA_BEFOREPLAY)); 373 393 _preplay = false; 374 394 if (_interruptPlay) { … … 512 532 stop(); 513 533 _player.playlist.currentIndex = index; 534 _interruptPlay = false; 514 535 play(); 515 536 return true; … … 720 741 Configger.saveCookie(name, value); 721 742 } 743 744 protected function get continueOnRepeat():Boolean { 745 return (_model.config.repeat != RepeatOptions.NONE); 746 } 722 747 723 748 } -
branches/fl5_instream/src/com/longtailvideo/jwplayer/controller/PlayerSetup.as
r1794 r2040 6 6 import com.longtailvideo.jwplayer.player.IPlayer; 7 7 import com.longtailvideo.jwplayer.plugins.IPlugin; 8 import com.longtailvideo.jwplayer.plugins.InStreamAdPlugin; 8 9 import com.longtailvideo.jwplayer.plugins.PluginConfig; 9 10 import com.longtailvideo.jwplayer.plugins.V4Plugin; … … 223 224 // Compiled in plugins go here. Example: 224 225 // _view.addPlugin("test", new TestPlugin()); 226 //_view.addPlugin("instreamads", new InStreamAdPlugin()); 225 227 } 226 228 -
branches/fl5_instream/src/com/longtailvideo/jwplayer/events/MediaEvent.as
r2032 r2040 176 176 */ 177 177 public static var JWPLAYER_MEDIA_BEFOREPLAY:String = "jwplayerMediaBeforePlay"; 178 178 /** 179 * The MediaEvent.JWPLAYER_MEDIA_BEFORECOMPLETE constant defines the value of the 180 * <code>type</code> property of the event object 181 * for a <code>jwplayerMediaBeforeComplete</code> event. 182 * 183 * <table class="innertable"> 184 * <tr><th>Property</th><th>Value</th></tr> 185 * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> 186 * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> 187 * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> 188 * </table> 189 * 190 * @eventType jwplayerMediaBeforePlay 191 */ 192 public static var JWPLAYER_MEDIA_BEFORECOMPLETE:String = "jwplayerMediaBeforeComplete"; 179 193 /** 180 194 * The <code>MediaEvent.JWPLAYER_MEDIA_MUTE</code> constant defines the value of the -
branches/fl5_instream/src/com/longtailvideo/jwplayer/model/Model.as
r2032 r2040 212 212 protected function forwardEvents(evt:Event):void { 213 213 if (evt is PlayerEvent) { 214 if (evt.type == MediaEvent.JWPLAYER_MEDIA_ERROR) { 214 if (evt.type == MediaEvent.JWPLAYER_MEDIA_COMPLETE) { 215 dispatchEvent(new MediaEvent(MediaEvent.JWPLAYER_MEDIA_BEFORECOMPLETE)); 216 } else if (evt.type == MediaEvent.JWPLAYER_MEDIA_ERROR) { 215 217 // Translate media error into player error. 216 218 dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_ERROR, (evt as MediaEvent).message)); -
branches/fl5_instream/src/com/longtailvideo/jwplayer/model/PlayerConfig.as
r1858 r2040 388 388 } 389 389 390 /** 391 * Overwrites a plugin's configuration. Use with caution. 392 **/ 393 public function setPluginConfig(pluginId:String, pluginConfig:PluginConfig):void { 394 if (pluginId && pluginConfig) { 395 _pluginConfig[pluginId] = pluginConfig; 396 } 397 } 398 390 399 /** A list of available pluginConfig keys. **/ 391 400 public function get pluginIds():Array { -
branches/fl5_instream/src/com/longtailvideo/jwplayer/player/IPlayer.as
r1246 r2040 1 1 package com.longtailvideo.jwplayer.player { 2 2 import com.longtailvideo.jwplayer.events.IGlobalEventDispatcher; 3 import com.longtailvideo.jwplayer.model.IInstreamOptions; 3 4 import com.longtailvideo.jwplayer.model.IPlaylist; 4 5 import com.longtailvideo.jwplayer.model.PlayerConfig; 6 import com.longtailvideo.jwplayer.model.PlaylistItem; 5 7 import com.longtailvideo.jwplayer.plugins.IPlugin; 6 8 import com.longtailvideo.jwplayer.view.IPlayerComponents; … … 73 75 function get controls():IPlayerComponents; 74 76 function overrideComponent(plugin:IPlayerComponent):void; 77 function loadInstream(target:IPlugin, item:PlaylistItem, options:IInstreamOptions=null):IInstreamPlayer; 75 78 } 76 79 } -
branches/fl5_instream/src/com/longtailvideo/jwplayer/player/JavascriptAPI.as
r2032 r2040 1 1 package com.longtailvideo.jwplayer.player { 2 2 import com.longtailvideo.jwplayer.events.ComponentEvent; 3 import com.longtailvideo.jwplayer.events.InstreamEvent; 3 4 import com.longtailvideo.jwplayer.events.MediaEvent; 4 5 import com.longtailvideo.jwplayer.events.PlayerEvent; … … 6 7 import com.longtailvideo.jwplayer.events.PlaylistEvent; 7 8 import com.longtailvideo.jwplayer.events.ViewEvent; 9 import com.longtailvideo.jwplayer.model.IInstreamOptions; 10 import com.longtailvideo.jwplayer.model.InstreamOptions; 8 11 import com.longtailvideo.jwplayer.model.Playlist; 12 import com.longtailvideo.jwplayer.model.PlaylistItem; 13 import com.longtailvideo.jwplayer.plugins.AbstractPlugin; 14 import com.longtailvideo.jwplayer.plugins.IPlugin; 9 15 import com.longtailvideo.jwplayer.utils.JavascriptSerialization; 10 16 import com.longtailvideo.jwplayer.utils.Logger; … … 30 36 protected var _listeners:Object; 31 37 protected var _queuedEvents:Array = []; 32 38 39 protected var _lockPlugin:IPlugin; 40 protected var _instream:IInstreamPlayer; 41 protected var _isItem:PlaylistItem; 42 protected var _isConfig:IInstreamOptions; 33 43 34 44 public function JavascriptAPI(player:IPlayer) { 35 45 _listeners = {}; 46 _lockPlugin = new AbstractPlugin(); 36 47 37 48 _player = player; … … 144 155 ExternalInterface.addCallback("jwDockShow", js_showDock); 145 156 157 // Instream API 158 ExternalInterface.addCallback("jwLoadInstream", js_loadInstream); 159 146 160 // UNIMPLEMENTED 147 161 //ExternalInterface.addCallback("jwGetBandwidth", js_getBandwidth); … … 453 467 } 454 468 469 protected function js_loadInstream(item:Object, config:Object):void { 470 _isItem = new PlaylistItem(item); 471 _isConfig = new InstreamOptions(config); 472 473 if (!_isConfig.autoload) { 474 _player.lock(_lockPlugin, function():void { 475 _instream = _player.loadInstream(_lockPlugin, _isItem, _isConfig); 476 beginInstream(); 477 }); 478 } else { 479 _instream = _player.loadInstream(_lockPlugin, _isItem, _isConfig); 480 beginInstream(); 481 } 482 } 483 484 protected function beginInstream():void { 485 if (_instream) { 486 _instream.addEventListener(InstreamEvent.JWPLAYER_INSTREAM_DESTROYED, function(evt:InstreamEvent):void { 487 _player.unlock(_lockPlugin); 488 }); 489 new JavascriptInstreamAPI(_instream, _isConfig, _player, _lockPlugin); 490 } 491 } 492 455 493 protected function setComponentVisibility(component:IPlayerComponent, state:Boolean):void { 456 494 state ? component.show() : component.hide(); -
branches/fl5_instream/src/com/longtailvideo/jwplayer/player/Player.as
r1228 r2040 4 4 import com.longtailvideo.jwplayer.events.IGlobalEventDispatcher; 5 5 import com.longtailvideo.jwplayer.events.PlayerEvent; 6 import com.longtailvideo.jwplayer.model.IInstreamOptions; 6 7 import com.longtailvideo.jwplayer.model.IPlaylist; 7 8 import com.longtailvideo.jwplayer.model.Model; 8 9 import com.longtailvideo.jwplayer.model.PlayerConfig; 10 import com.longtailvideo.jwplayer.model.PlaylistItem; 9 11 import com.longtailvideo.jwplayer.plugins.IPlugin; 10 12 import com.longtailvideo.jwplayer.utils.Logger; … … 279 281 return view.getPlugin(id); 280 282 } 283 284 /** 285 * @inheritDoc 286 **/ 287 public function loadInstream(target:IPlugin, item:PlaylistItem, options:IInstreamOptions=null):IInstreamPlayer { 288 var instream:IInstreamPlayer = new InstreamPlayer(target, item, options, model, view, controller); 289 return instream; 290 } 281 291 282 292 /** The player should not accept any calls referencing its display stack **/ … … 300 310 } 301 311 302 303 312 /////////////////////////////////////////// 304 313 /// IGlobalEventDispatcher implementation -
branches/fl5_instream/src/com/longtailvideo/jwplayer/player/PlayerVersion.as
r2032 r2040 3 3 4 4 public class PlayerVersion { 5 protected static var _version:String = '5.9.20 32';5 protected static var _version:String = '5.9.2040'; 6 6 7 7 public static function get version():String { -
branches/fl5_instream/src/com/longtailvideo/jwplayer/utils/Animations.as
r1965 r2040 2 2 import flash.display.MovieClip; 3 3 import flash.events.Event; 4 import flash.events.EventDispatcher; 4 5 5 6 7 /** 8 * Fired when an animation has completed 9 * 10 * @eventType flash.events.Event.COMPLETE 11 */ 12 [Event(name="complete", type="flash.events.Event")] 6 13 7 public class Animations {14 public class Animations extends EventDispatcher { 8 15 /** Target MovieClip **/ 9 16 private var _tgt:MovieClip; … … 51 58 _tgt.visible = false; 52 59 } 60 dispatchEvent(new Event(Event.COMPLETE)); 53 61 } else { 54 62 _tgt.visible = true; … … 87 95 _tgt.x = _xps; 88 96 _tgt.y = _yps; 97 dispatchEvent(new Event(Event.COMPLETE)); 89 98 } else { 90 99 _tgt.x = _xps - (_xps - _tgt.x) / _spd; … … 115 124 _tgt.tf.htmlText = _str; 116 125 _tgt.removeEventListener(Event.ENTER_FRAME, easeHandler); 126 dispatchEvent(new Event(Event.COMPLETE)); 117 127 } 118 128 } -
branches/fl5_instream/src/com/longtailvideo/jwplayer/utils/DisplayObjectUtils.as
r637 r2040 1 1 package com.longtailvideo.jwplayer.utils { 2 import flash.display.DisplayObject; 2 3 import flash.display.DisplayObjectContainer; 3 import flash. display.DisplayObject;4 import flash.geom.Rectangle; 4 5 import flash.utils.getQualifiedClassName; 5 6 … … 38 39 } 39 40 41 42 /** 43 * duplicateDisplayObject 44 * 45 * see: http://www.kirupa.com/forum/showthread.php?223798-ActionScript-3-Tip-of-the-Day/page12&p=1939827#172 46 * 47 * creates a duplicate of the DisplayObject passed. 48 * similar to duplicateMovieClip in AVM1 49 * @param target the display object to duplicate 50 * @param autoAdd if true, adds the duplicate to the display list 51 * in which target was located 52 * @return a duplicate instance of target 53 */ 54 public static function duplicateDisplayObject(target:DisplayObject, autoAdd:Boolean = false):DisplayObject { 55 // create duplicate 56 var targetClass:Class = Object(target).constructor; 57 var duplicate:DisplayObject = new targetClass(); 58 59 // duplicate properties 60 duplicate.transform = target.transform; 61 duplicate.filters = target.filters; 62 duplicate.cacheAsBitmap = target.cacheAsBitmap; 63 duplicate.opaqueBackground = target.opaqueBackground; 64 if (target.scale9Grid) { 65 var rect:Rectangle = target.scale9Grid; 66 // WAS Flash 9 bug where returned scale9Grid is 20x larger than assigned 67 // rect.x /= 20, rect.y /= 20, rect.width /= 20, rect.height /= 20; 68 duplicate.scale9Grid = rect; 69 } 70 71 // add to target parent's display list 72 // if autoAdd was provided as true 73 if (autoAdd && target.parent) { 74 target.parent.addChild(duplicate); 75 } 76 return duplicate; 77 } 78 79 40 80 } 41 81 } -
branches/fl5_instream/src/com/longtailvideo/jwplayer/utils/JavascriptSerialization.as
r1824 r2040 68 68 var newkey:String = key.replace(".", "__dot__"); 69 69 newkey = newkey.replace("-", "_"); 70 newkey = newkey.replace(/[^A-Za-z0-9\_]/g, ""); 70 71 newObj[newkey] = stripDots(obj[key]); 71 72 } -
branches/fl5_instream/src/com/longtailvideo/jwplayer/utils/Stacker.as
r1459 r2040 21 21 **/ 22 22 public function Stacker(clp:MovieClip):void { 23 clip = clp; 24 analyze(); 23 if (clp is MovieClip) { 24 clip = clp; 25 analyze(); 26 } else { 27 throw new TypeError("Expecting a MovieClip"); 28 } 25 29 } 26 30 -
branches/fl5_instream/src/com/longtailvideo/jwplayer/view/View.as
r1942 r2040 15 15 import com.longtailvideo.jwplayer.plugins.IPlugin; 16 16 import com.longtailvideo.jwplayer.plugins.PluginConfig; 17 import com.longtailvideo.jwplayer.utils.Animations; 17 18 import com.longtailvideo.jwplayer.utils.Draw; 18 19 import com.longtailvideo.jwplayer.utils.Logger; … … 66 67 protected var _pluginsLayer:MovieClip; 67 68 protected var _plugins:Object; 68 69 protected var _instreamLayer:MovieClip; 70 protected var _instreamPlugin:IPlugin; 71 protected var _instreamAnim:Animations; 72 69 73 protected var _displayMasker:MovieClip; 70 74 protected var _instreamMasker:MovieClip; 75 71 76 protected var _image:Loader; 72 77 protected var _logo:Logo; … … 271 276 _plugins = {}; 272 277 278 _instreamLayer = setupLayer("instream", currentLayer++); 279 _instreamLayer.alpha = 0; 280 _instreamLayer.visible = false; 281 _instreamAnim = new Animations(_instreamLayer); 282 _instreamAnim.addEventListener(Event.COMPLETE, instreamAnimationComplete); 273 283 } 274 284 … … 313 323 314 324 _maskedLayers.mask = _displayMasker; 325 326 _instreamMasker = new MovieClip(); 327 _instreamMasker.graphics.beginFill(0x000000, 1); 328 _instreamMasker.graphics.drawRect(0, 0, _player.config.width, _player.config.height); 329 _instreamMasker.graphics.endFill(); 330 331 _instreamLayer.mask = _instreamMasker; 315 332 } 316 333 … … 340 357 dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, _fullscreen)); 341 358 } 359 redraw(); 360 342 361 dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_RESIZE, {width: RootReference.stage.stageWidth, height: RootReference.stage.stageHeight})); 343 344 redraw();345 362 } 346 363 … … 471 488 _displayMasker.graphics.drawRect(_components.display.x, _components.display.y, _player.config.width, _player.config.height); 472 489 _displayMasker.graphics.endFill(); 490 491 _instreamMasker.graphics.clear(); 492 _instreamMasker.graphics.beginFill(0, 1); 493 _instreamMasker.graphics.drawRect(_components.display.x, _components.display.y, _player.config.width, _player.config.height); 494 _instreamMasker.graphics.endFill(); 473 495 } 474 496 … … 604 626 } 605 627 628 public function setupInstream(_instreamDisplay:DisplayObject, plugin:IPlugin):void { 629 _instreamPlugin = plugin; 630 if (_instreamDisplay) { 631 _instreamLayer.addChild(_instreamDisplay); 632 } 633 try { 634 var pluginDO:DisplayObject = plugin as DisplayObject; 635 if (pluginDO) { 636 _pluginsLayer.removeChild(pluginDO); 637 _instreamLayer.addChild(pluginDO); 638 } 639 } catch(e:Error) { 640 Logger.log("Could not add instream plugin to display stack"); 641 } 642 643 _instreamAnim.fade(1); 644 } 645 646 public function destroyInstream():void { 647 if (_instreamPlugin && _instreamPlugin is DisplayObject) { 648 _pluginsLayer.addChild(_instreamPlugin as DisplayObject); 649 } 650 _instreamAnim.fade(0); 651 } 652 653 protected function instreamAnimationComplete(evt:Event):void { 654 if (_instreamLayer.alpha == 0) { 655 while(_instreamLayer.numChildren > 0) { 656 _instreamLayer.removeChildAt(0); 657 } 658 _instreamPlugin = null; 659 } 660 } 661 606 662 } 607 663 } -
branches/fl5_instream/src/com/longtailvideo/jwplayer/view/components/ControlbarComponentV4.as
r1994 r2040 10 10 import com.longtailvideo.jwplayer.plugins.PluginConfig; 11 11 import com.longtailvideo.jwplayer.utils.Animations; 12 import com.longtailvideo.jwplayer.utils.DisplayObjectUtils; 12 13 import com.longtailvideo.jwplayer.utils.Draw; 13 14 import com.longtailvideo.jwplayer.utils.Logger; … … 30 31 import flash.ui.Mouse; 31 32 import flash.utils.clearTimeout; 33 import flash.utils.getDefinitionByName; 34 import flash.utils.getQualifiedClassName; 32 35 import flash.utils.setTimeout; 33 36 34 37 public class ControlbarComponentV4 extends CoreComponent implements IControlbarComponent { 35 38 /** Reference to the original skin **/ 36 private var skin: Sprite;39 private var skin:*; 37 40 /** A list with all controls. **/ 38 41 private var stacker:Stacker; … … 81 84 unmuteButton: ViewEvent.JWPLAYER_VIEW_MUTE}; 82 85 skin = _player.skin.getSWFSkin().getChildByName('controlbar') as Sprite; 86 if (!skin) { 87 var clip:DisplayObject = Draw.clone(_player.skin.getSWFSkin()['controlbar'], false); 88 if (clip is Sprite) { 89 skin = clip as Sprite; 90 } 91 stacker = new Stacker(skin); 92 } else { 93 stacker = new Stacker(skin as MovieClip); 94 } 83 95 skin.x = 0; 84 96 skin.y = 0; … … 97 109 RootReference.stage.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler); 98 110 RootReference.stage.addEventListener(KeyboardEvent.KEY_DOWN, moveHandler); 99 stacker = new Stacker(skin as MovieClip);100 111 try { 101 112 getSkinComponent("linkButton").visible = false; … … 182 193 getSkinComponent('fullscreenButton').visible = false; 183 194 getSkinComponent('normalscreenButton').visible = false; 184 if ( stage['displayState'] && _player.config.height > 40) {195 if (RootReference.stage['displayState'] && _player.config.height > 40) { 185 196 if (_player.config.fullscreen) { 186 197 getSkinComponent('fullscreenButton').visible = false; … … 572 583 var sliderType:String = scrubber.name; 573 584 574 stage.removeEventListener(MouseEvent.MOUSE_UP, upHandler);585 RootReference.stage.removeEventListener(MouseEvent.MOUSE_UP, upHandler); 575 586 scrubber.icon.stopDrag(); 576 587 if (sliderType == 'timeSlider' && _player.playlist && _player.playlist.currentItem) { … … 602 613 603 614 private function getSkinComponent(element:String):DisplayObject { 604 return skin.getChildByName(element) as DisplayObject; 615 var component:DisplayObject = skin.getChildByName(element) as DisplayObject; 616 if (component) { 617 return component; 618 } else if (skin[element]) { 619 return Draw.clone(skin[element], false); 620 } 621 return null; 605 622 } 606 623 607 624 608 625 private function getSkinElementChild(element:String, child:String):DisplayObject { 609 return (skin.getChildByName(element) as MovieClip).getChildByName(child); 626 var clip:DisplayObject = (skin.getChildByName(element) as MovieClip).getChildByName(child); 627 if (clip) { 628 return clip; 629 } else if (skin[element] is DisplayObject) { 630 clip = Draw.clone(skin[element], false); 631 return clip; 632 } else { 633 return null; 634 } 610 635 } 611 636 -
branches/fl5_instream/src/com/longtailvideo/jwplayer/view/components/CoreComponent.as
r1847 r2040 13 13 import flash.geom.Rectangle; 14 14 15 public class CoreComponent extends MovieClip implements IGlobalEventDispatcher, IPlayerComponent {15 public class CoreComponent extends MovieClip implements IGlobalEventDispatcher, IPlayerComponent { 16 16 17 17 private var _dispatcher:IGlobalEventDispatcher; -
branches/fl5_instream/src/com/longtailvideo/jwplayer/view/components/DisplayComponent.as
r1847 r2040 64 64 protected var _previousState:String; 65 65 66 protected var _forced:String = ""; 67 66 68 public function DisplayComponent(player:IPlayer) { 67 69 super(player, "display"); … … 348 350 } 349 351 352 protected function get currentState():String { 353 return (_forced ? _forced : (_player ? _player.state : PlayerState.IDLE)); 354 } 350 355 351 356 protected function stateHandler(event:PlayerEvent = null):void { 352 if (_previousState != player.state || !(event is PlayerStateEvent)) { 357 if (_previousState != currentState || !(event is PlayerStateEvent)) { 358 _previousState = currentState; 353 359 //TODO: Handle mute button in error state 354 360 clearRotation(); … … 357 363 _bufferStateTimer.delay = (_icon ? 10 : 200); 358 364 _playStateTimer.delay = (_icon ? 10 : 10); 359 switch ( player.state) {365 switch (currentState) { 360 366 case PlayerState.BUFFERING: 361 367 _bufferStateTimer.start(); … … 419 425 navigateToURL(new URLRequest(Strings.cleanLink(link)),_player.config.linktarget); 420 426 } 421 } else if ( player.state == PlayerState.PLAYING || player.state == PlayerState.BUFFERING) {427 } else if (currentState == PlayerState.PLAYING || currentState == PlayerState.BUFFERING) { 422 428 dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_PAUSE)); 423 429 } else { … … 463 469 } 464 470 471 public function forceState(forcedState:String):void { 472 switch(forcedState) { 473 case PlayerState.BUFFERING: 474 case PlayerState.PAUSED: 475 case PlayerState.IDLE: 476 case PlayerState.PLAYING: 477 _forced = forcedState; 478 stateHandler(); 479 break; 480 default: 481 _forced = ""; 482 } 483 484 } 485 486 public function releaseState():void { 487 _forced = ""; 488 stateHandler(); 489 } 490 465 491 protected override function get displayRect():Rectangle { 466 492 return _iconArea ? _iconArea : super.displayRect; -
branches/fl5_instream/src/com/longtailvideo/jwplayer/view/interfaces/IDisplayComponent.as
r1838 r2040 39 39 function setIcon(displayIcon:DisplayObject):void; 40 40 function setText(displayText:String):void; 41 function forceState(forcedState:String):void; 42 function releaseState():void; 41 43 } 42 44 }
Note: See TracChangeset
for help on using the changeset viewer.
