diff --git a/README.md b/README.md index a347a35..b3213a5 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,23 @@ var player = new Clappr.Player({ playbackType: 'live', bufferTime: 1, startLevel: 0, + switchRules: { + "SufficientBandwidthRule": { + "bandwidthSafetyMultiple": 1.15, + "minDroppedFps": 2 + }, + "InsufficientBufferRule": { + "minBufferLength": 2 + }, + "DroppedFramesRule": { + "downSwitchByOne": 10, + "downSwitchByTwo": 20, + "downSwitchToZero": 24 + }, + "InsufficientBandwidthRule": { + "bitrateMultiplier": 1.15 + } + } }, }); ``` @@ -40,6 +57,7 @@ The plugin accepts several **optional** configuration options, such as: - `autoSwitch` (default **false**) - Whether video should autoSwitch quality - `useAppInstance` (default **false**) - Set it to `true` if your source url contains the app instance (not required if the app instance is `_definst_`). - `proxyType` (default **none**) - Determines which fallback methods are tried if an initial connection attempt to Flash Media Server fails. + - `switchRules` (default **system defined**) - Rules defined to autoSwitch video quality based in some conditions. ## Building diff --git a/dist/assets/RTMP.swf b/dist/assets/RTMP.swf index 0b97031..d799bad 100644 Binary files a/dist/assets/RTMP.swf and b/dist/assets/RTMP.swf differ diff --git a/dist/rtmp.js b/dist/rtmp.js index 8f172bb..47187a9 100644 --- a/dist/rtmp.js +++ b/dist/rtmp.js @@ -64,7 +64,7 @@ return /******/ (function(modules) { // webpackBootstrap // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _createClass=(function(){function defineProperties(target,props){for(var i=0;i < props.length;i++) {var descriptor=props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if('value' in descriptor)descriptor.writable = true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();var _get=function get(_x,_x2,_x3){var _again=true;_function: while(_again) {var object=_x,property=_x2,receiver=_x3;_again = false;if(object === null)object = Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc === undefined){var parent=Object.getPrototypeOf(object);if(parent === null){return undefined;}else {_x = parent;_x2 = property;_x3 = receiver;_again = true;desc = parent = undefined;continue _function;}}else if('value' in desc){return desc.value;}else {var getter=desc.get;if(getter === undefined){return undefined;}return getter.call(receiver);}}};function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{'default':obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function');}}function _inherits(subClass,superClass){if(typeof superClass !== 'function' && superClass !== null){throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);}subClass.prototype = Object.create(superClass && superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__ = superClass;}var _clappr=__webpack_require__(2);var _publicFlashHtml=__webpack_require__(3);var _publicFlashHtml2=_interopRequireDefault(_publicFlashHtml);var _rawSassPublicFlashScss=__webpack_require__(4);var _rawSassPublicFlashScss2=_interopRequireDefault(_rawSassPublicFlashScss);var RTMP=(function(_Flash){_inherits(RTMP,_Flash);_createClass(RTMP,[{key:'name',get:function get(){return 'rtmp';}},{key:'tagName',get:function get(){return 'object';}},{key:'template',get:function get(){return (0,_clappr.template)(_publicFlashHtml2['default']);}},{key:'attributes',get:function get(){return {'data-rtmp':'','type':'application/x-shockwave-flash','width':'100%','height':'100%'};}}]);function RTMP(options){_classCallCheck(this,RTMP);_get(Object.getPrototypeOf(RTMP.prototype),'constructor',this).call(this,options);this.options.rtmpConfig = this.options.rtmpConfig || {};this.options.rtmpConfig.swfPath = this.options.rtmpConfig.swfPath || '//cdn.jsdelivr.net/clappr.rtmp/latest/assets/RTMP.swf';this.options.rtmpConfig.wmode = this.options.rtmpConfig.wmode || 'transparent'; // Default to transparent wmode - IE always uses gpu as per objectIE - this.options.rtmpConfig.bufferTime = this.options.rtmpConfig.bufferTime === undefined?0.1:this.options.rtmpConfig.bufferTime;this.options.rtmpConfig.scaling = this.options.rtmpConfig.scaling || 'letterbox';this.options.rtmpConfig.playbackType = this.options.rtmpConfig.playbackType || this.options.src.indexOf('live') > -1;this.options.rtmpConfig.useAppInstance = this.options.rtmpConfig.useAppInstance === undefined?false:this.options.rtmpConfig.useAppInstance;this.options.rtmpConfig.proxyType = this.options.rtmpConfig.proxyType || 'none';this.options.rtmpConfig.startLevel = this.options.rtmpConfig.startLevel === undefined?-1:this.options.rtmpConfig.startLevel;this.options.rtmpConfig.autoSwitch = this.options.rtmpConfig.autoSwitch === undefined?false:this.options.rtmpConfig.autoSwitch;this.addListeners();this._setupPlaybackType();}_createClass(RTMP,[{key:'getPlaybackType',value:function getPlaybackType(){return this._playbackType;}},{key:'addListeners',value:function addListeners(){_clappr.Mediator.on(this.uniqueId + ':progress',this._progress,this);_clappr.Mediator.on(this.uniqueId + ':timeupdate',this._updateTime,this);_clappr.Mediator.on(this.uniqueId + ':statechanged',this._checkState,this);_clappr.Mediator.on(this.uniqueId + ':playbackready',this._playbackReady,this);_clappr.Mediator.on(this.uniqueId + ':onloaded',this._reporLevels,this);_clappr.Mediator.on(this.uniqueId + ':levelChanging',this._levelChanging,this);_clappr.Mediator.on(this.uniqueId + ':levelChanged',this._levelChange,this);_clappr.Mediator.on(this.uniqueId + ':flashready',this._bootstrap,this);}},{key:'stopListening',value:function stopListening(){_get(Object.getPrototypeOf(RTMP.prototype),'stopListening',this).call(this);_clappr.Mediator.off(this.uniqueId + ':progress');_clappr.Mediator.off(this.uniqueId + ':timeupdate');_clappr.Mediator.off(this.uniqueId + ':statechanged');_clappr.Mediator.off(this.uniqueId + ':flashready');}},{key:'_bootstrap',value:function _bootstrap(){this.el.width = '100%';this.el.height = '100%';this.options.autoPlay && this.play();this._setupSettings();}},{key:'_updateTime',value:function _updateTime(){if(this.getPlaybackType() === 'live'){this.trigger(_clappr.Events.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name);}else {this.trigger(_clappr.Events.PLAYBACK_TIMEUPDATE,{current:this.el.getPosition(),total:this.el.getDuration()},this.name);}}},{key:'_levelChanging',value:function _levelChanging(){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_START);}},{key:'_levelChange',value:function _levelChange(){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_END);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}},{key:'findLevelBy',value:function findLevelBy(id){var foundLevel;this.levels.forEach(function(level){if(level.id === id){foundLevel = level;}});return foundLevel;}},{key:'_setupPlaybackType',value:function _setupPlaybackType(){this._playbackType = this.options.rtmpConfig.playbackType;}},{key:'_setupSettings',value:function _setupSettings(){if(this.getPlaybackType() === 'live'){this.settings.left = ["playpause"];this.settings.right = ["fullscreen","volume"];this.settings.seekEnabled = false;}else {this.settings.left = ["playpause","position","duration"];this.settings.right = ["fullscreen","volume"];}this.trigger(_clappr.Events.PLAYBACK_SETTINGSUPDATE,this.name);}},{key:'render',value:function render(){this.$el.html(this.template({cid:this.cid,swfPath:this.swfPath,playbackId:this.uniqueId,wmode:this.options.rtmpConfig.wmode,scaling:this.options.rtmpConfig.scaling,bufferTime:this.options.rtmpConfig.bufferTime,playbackType:this.options.rtmpConfig.playbackType,startLevel:this.options.rtmpConfig.startLevel,autoSwitch:this.options.rtmpConfig.autoSwitch,useAppInstance:this.options.rtmpConfig.useAppInstance,proxyType:this.options.rtmpConfig.proxyType}));if(_clappr.Browser.isIE){this.$('embed').remove();if(_clappr.Browser.isLegacyIE){this.$el.attr('classid',IE_CLASSID);}}else if(_clappr.Browser.isFirefox){this._setupFirefox();}this.el.id = this.cid;var style=_clappr.Styler.getStyleFor(_rawSassPublicFlashScss2['default']);this.$el.append(style);return this;}},{key:'_checkState',value:function _checkState(){_get(Object.getPrototypeOf(RTMP.prototype),'_checkState',this).call(this);if(this.el.getState() === "PLAYING"){this.trigger(_clappr.Events.PLAYBACK_PLAY,this.name);}else if(this.el.getState() === "ERROR"){this.trigger(_clappr.Events.PLAYBACK_ERROR,this.name);}}},{key:'_playbackReady',value:function _playbackReady(){this._isReadyState = true;this.trigger(_clappr.Events.PLAYBACK_READY,this.name);}},{key:'_reporLevels',value:function _reporLevels(){if(this.isDynamicStream){if(this.levels){if(this.options.rtmpConfig.autoSwitch === true){this.trigger(_clappr.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,-1);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}else {this.trigger(_clappr.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,this.options.rtmpConfig.startLevel);}}}}},{key:'swfPath',get:function get(){return this.options.rtmpConfig.swfPath;}},{key:'currentLevel',get:function get(){if(this._isReadyState){return this.el.getCurrentLevel();}return undefined;},set:function set(level){this.el.setLevel(level);if(level === -1 && level !== this.currentLevel){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_END);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}}},{key:'numLevels',get:function get(){if(this._isReadyState){return this.el.getNumLevels();}return undefined;}},{key:'autoSwitchLevels',get:function get(){return this.el.isAutoSwitchLevels();}},{key:'levels',get:function get(){var levels=[];for(var i=0;i < this.numLevels;i++) {var bitrate=this.el.getBitrateForLevel(i);levels.push({id:i,label:bitrate + "Kbps"});}return levels;}},{key:'isDynamicStream',get:function get(){return this.el.isDynamicStream();}}]);return RTMP;})(_clappr.Flash);exports['default'] = RTMP;RTMP.canPlay = function(source){return !!((source.indexOf('rtmp://') > -1 || source.indexOf('rtmps://') > -1 || source.indexOf('.smil') > -1) && _clappr.Browser.hasFlash);};RTMP.debug = function(s){return console.log(s);};module.exports = exports['default']; + this.options.rtmpConfig.bufferTime = this.options.rtmpConfig.bufferTime === undefined?0.1:this.options.rtmpConfig.bufferTime;this.options.rtmpConfig.scaling = this.options.rtmpConfig.scaling || 'letterbox';this.options.rtmpConfig.playbackType = this.options.rtmpConfig.playbackType || this.options.src.indexOf('live') > -1;this.options.rtmpConfig.useAppInstance = this.options.rtmpConfig.useAppInstance === undefined?false:this.options.rtmpConfig.useAppInstance;this.options.rtmpConfig.proxyType = this.options.rtmpConfig.proxyType || 'none';this.options.rtmpConfig.startLevel = this.options.rtmpConfig.startLevel === undefined?-1:this.options.rtmpConfig.startLevel;this.options.rtmpConfig.autoSwitch = this.options.rtmpConfig.autoSwitch === undefined?false:this.options.rtmpConfig.autoSwitch;this.options.rtmpConfig.switchRules = this.options.rtmpConfig.switchRules;this.addListeners();this._setupPlaybackType();}_createClass(RTMP,[{key:'getPlaybackType',value:function getPlaybackType(){return this._playbackType;}},{key:'addListeners',value:function addListeners(){_clappr.Mediator.on(this.uniqueId + ':progress',this._progress,this);_clappr.Mediator.on(this.uniqueId + ':timeupdate',this._updateTime,this);_clappr.Mediator.on(this.uniqueId + ':statechanged',this._checkState,this);_clappr.Mediator.on(this.uniqueId + ':playbackready',this._playbackReady,this);_clappr.Mediator.on(this.uniqueId + ':onloaded',this._reporLevels,this);_clappr.Mediator.on(this.uniqueId + ':levelChanging',this._levelChanging,this);_clappr.Mediator.on(this.uniqueId + ':levelChanged',this._levelChange,this);_clappr.Mediator.on(this.uniqueId + ':flashready',this._bootstrap,this);}},{key:'stopListening',value:function stopListening(){_get(Object.getPrototypeOf(RTMP.prototype),'stopListening',this).call(this);_clappr.Mediator.off(this.uniqueId + ':progress');_clappr.Mediator.off(this.uniqueId + ':timeupdate');_clappr.Mediator.off(this.uniqueId + ':statechanged');_clappr.Mediator.off(this.uniqueId + ':flashready');}},{key:'_bootstrap',value:function _bootstrap(){this.el.width = '100%';this.el.height = '100%';this.options.autoPlay && this.play();this._setupSettings();}},{key:'_updateTime',value:function _updateTime(){if(this.getPlaybackType() === 'live'){this.trigger(_clappr.Events.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name);}else {this.trigger(_clappr.Events.PLAYBACK_TIMEUPDATE,{current:this.el.getPosition(),total:this.el.getDuration()},this.name);}}},{key:'_levelChanging',value:function _levelChanging(){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_START);}},{key:'_levelChange',value:function _levelChange(){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_END);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}},{key:'findLevelBy',value:function findLevelBy(id){var foundLevel;this.levels.forEach(function(level){if(level.id === id){foundLevel = level;}});return foundLevel;}},{key:'_setupPlaybackType',value:function _setupPlaybackType(){this._playbackType = this.options.rtmpConfig.playbackType;}},{key:'_setupSettings',value:function _setupSettings(){if(this.getPlaybackType() === 'live'){this.settings.left = ["playpause"];this.settings.right = ["fullscreen","volume"];this.settings.seekEnabled = false;}else {this.settings.left = ["playpause","position","duration"];this.settings.right = ["fullscreen","volume"];}this.trigger(_clappr.Events.PLAYBACK_SETTINGSUPDATE,this.name);}},{key:'render',value:function render(){this.$el.html(this.template({cid:this.cid,swfPath:this.swfPath,playbackId:this.uniqueId,wmode:this.options.rtmpConfig.wmode,scaling:this.options.rtmpConfig.scaling,bufferTime:this.options.rtmpConfig.bufferTime,playbackType:this.options.rtmpConfig.playbackType,startLevel:this.options.rtmpConfig.startLevel,autoSwitch:this.options.rtmpConfig.autoSwitch,switchRules:this._switchRulesJSON,useAppInstance:this.options.rtmpConfig.useAppInstance,proxyType:this.options.rtmpConfig.proxyType}));if(_clappr.Browser.isIE){this.$('embed').remove();if(_clappr.Browser.isLegacyIE){this.$el.attr('classid',IE_CLASSID);}}else if(_clappr.Browser.isFirefox){this._setupFirefox();}this.el.id = this.cid;var style=_clappr.Styler.getStyleFor(_rawSassPublicFlashScss2['default']);this.$el.append(style);return this;}},{key:'_checkState',value:function _checkState(){_get(Object.getPrototypeOf(RTMP.prototype),'_checkState',this).call(this);if(this.el.getState() === "PLAYING"){this.trigger(_clappr.Events.PLAYBACK_PLAY,this.name);}else if(this.el.getState() === "ERROR"){this.trigger(_clappr.Events.PLAYBACK_ERROR,this.name);}}},{key:'_playbackReady',value:function _playbackReady(){this._isReadyState = true;this.trigger(_clappr.Events.PLAYBACK_READY,this.name);}},{key:'_reporLevels',value:function _reporLevels(){if(this.isDynamicStream){if(this.levels){if(this.options.rtmpConfig.autoSwitch === true){this.trigger(_clappr.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,-1);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}else {this.trigger(_clappr.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,this.options.rtmpConfig.startLevel);}}}}},{key:'swfPath',get:function get(){return this.options.rtmpConfig.swfPath;}},{key:'currentLevel',get:function get(){if(this._isReadyState){return this.el.getCurrentLevel();}return undefined;},set:function set(level){this.el.setLevel(level);if(level === -1 && level !== this.currentLevel){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_END);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}}},{key:'numLevels',get:function get(){if(this._isReadyState){return this.el.getNumLevels();}return undefined;}},{key:'autoSwitchLevels',get:function get(){return this.el.isAutoSwitchLevels();}},{key:'levels',get:function get(){var levels=[];for(var i=0;i < this.numLevels;i++) {var bitrate=this.el.getBitrateForLevel(i);levels.push({id:i,label:bitrate + "Kbps"});}return levels;}},{key:'isDynamicStream',get:function get(){return this.el.isDynamicStream();}},{key:'_switchRulesJSON',get:function get(){if(this.options.rtmpConfig.switchRules !== undefined){return JSON.stringify(this.options.rtmpConfig.switchRules).replace(/"/g,'"');}return "";}}]);return RTMP;})(_clappr.Flash);exports['default'] = RTMP;RTMP.canPlay = function(source){return !!((source.indexOf('rtmp://') > -1 || source.indexOf('rtmps://') > -1 || source.indexOf('.smil') > -1) && _clappr.Browser.hasFlash);};RTMP.debug = function(s){return console.log(s);};module.exports = exports['default']; /***/ }, /* 2 */ @@ -76,7 +76,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 3 */ /***/ function(module, exports) { - module.exports = "?inline=1\">\n\n\n\n\n\n\n\">\n\n&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>\"/>\n\"\n type=\"application/x-shockwave-flash\"\n disabled=\"disabled\"\n tabindex=\"-1\"\n enablecontextmenu=\"false\"\n allowScriptAccess=\"always\"\n allownetworking=\"all\"\n quality=\"autohigh\"\n pluginspage=\"http://www.macromedia.com/go/getflashplayer\"\n wmode=\"<%= wmode %>\"\n swliveconnect=\"true\"\n allowfullscreen=\"false\"\n bgcolor=\"#000000\"\n FlashVars=\"playbackId=<%= playbackId %>&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>\"\n src=\"<%= swfPath %>\"\n width=\"100%\"\n height=\"100%\">\n\n"; + module.exports = "?inline=1\">\n\n\n\n\n\n\n\">\n\n&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>&switchRules=<%= switchRules %>\"/>\n\"\n type=\"application/x-shockwave-flash\"\n disabled=\"disabled\"\n tabindex=\"-1\"\n enablecontextmenu=\"false\"\n allowScriptAccess=\"always\"\n allownetworking=\"all\"\n quality=\"autohigh\"\n pluginspage=\"http://www.macromedia.com/go/getflashplayer\"\n wmode=\"<%= wmode %>\"\n swliveconnect=\"true\"\n allowfullscreen=\"false\"\n bgcolor=\"#000000\"\n FlashVars=\"playbackId=<%= playbackId %>&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>&switchRules=<%= switchRules %>\"\n src=\"<%= swfPath %>\"\n width=\"100%\"\n height=\"100%\">\n\n"; /***/ }, /* 4 */ diff --git a/dist/rtmp.min.js b/dist/rtmp.min.js index e034a75..798885e 100644 --- a/dist/rtmp.min.js +++ b/dist/rtmp.min.js @@ -4,13 +4,13 @@ function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i(/*! ./src/main.js */1),t.exports=e["default"]},/*!*********************!*\ !*** ./src/main.js ***! \*********************/ -function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i-1,this.options.rtmpConfig.useAppInstance=void 0!==this.options.rtmpConfig.useAppInstance&&this.options.rtmpConfig.useAppInstance,this.options.rtmpConfig.proxyType=this.options.rtmpConfig.proxyType||"none",this.options.rtmpConfig.startLevel=void 0===this.options.rtmpConfig.startLevel?-1:this.options.rtmpConfig.startLevel,this.options.rtmpConfig.autoSwitch=void 0!==this.options.rtmpConfig.autoSwitch&&this.options.rtmpConfig.autoSwitch,this.addListeners(),this._setupPlaybackType()}return o(e,t),a(e,[{key:"name",get:function(){return"rtmp"}},{key:"tagName",get:function(){return"object"}},{key:"template",get:function(){return(0,l.template)(u["default"])}},{key:"attributes",get:function(){return{"data-rtmp":"",type:"application/x-shockwave-flash",width:"100%",height:"100%"}}}]),a(e,[{key:"getPlaybackType",value:function(){return this._playbackType}},{key:"addListeners",value:function(){l.Mediator.on(this.uniqueId+":progress",this._progress,this),l.Mediator.on(this.uniqueId+":timeupdate",this._updateTime,this),l.Mediator.on(this.uniqueId+":statechanged",this._checkState,this),l.Mediator.on(this.uniqueId+":playbackready",this._playbackReady,this),l.Mediator.on(this.uniqueId+":onloaded",this._reporLevels,this),l.Mediator.on(this.uniqueId+":levelChanging",this._levelChanging,this),l.Mediator.on(this.uniqueId+":levelChanged",this._levelChange,this),l.Mediator.on(this.uniqueId+":flashready",this._bootstrap,this)}},{key:"stopListening",value:function(){r(Object.getPrototypeOf(e.prototype),"stopListening",this).call(this),l.Mediator.off(this.uniqueId+":progress"),l.Mediator.off(this.uniqueId+":timeupdate"),l.Mediator.off(this.uniqueId+":statechanged"),l.Mediator.off(this.uniqueId+":flashready")}},{key:"_bootstrap",value:function(){this.el.width="100%",this.el.height="100%",this.options.autoPlay&&this.play(),this._setupSettings()}},{key:"_updateTime",value:function(){"live"===this.getPlaybackType()?this.trigger(l.Events.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name):this.trigger(l.Events.PLAYBACK_TIMEUPDATE,{current:this.el.getPosition(),total:this.el.getDuration()},this.name)}},{key:"_levelChanging",value:function(){this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_START)}},{key:"_levelChange",value:function(){this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_END),this.trigger(l.Events.PLAYBACK_BITRATE,{level:this.currentLevel})}},{key:"findLevelBy",value:function(t){var e;return this.levels.forEach(function(i){i.id===t&&(e=i)}),e}},{key:"_setupPlaybackType",value:function(){this._playbackType=this.options.rtmpConfig.playbackType}},{key:"_setupSettings",value:function(){"live"===this.getPlaybackType()?(this.settings.left=["playpause"],this.settings.right=["fullscreen","volume"],this.settings.seekEnabled=!1):(this.settings.left=["playpause","position","duration"],this.settings.right=["fullscreen","volume"]),this.trigger(l.Events.PLAYBACK_SETTINGSUPDATE,this.name)}},{key:"render",value:function(){this.$el.html(this.template({cid:this.cid,swfPath:this.swfPath,playbackId:this.uniqueId,wmode:this.options.rtmpConfig.wmode,scaling:this.options.rtmpConfig.scaling,bufferTime:this.options.rtmpConfig.bufferTime,playbackType:this.options.rtmpConfig.playbackType,startLevel:this.options.rtmpConfig.startLevel,autoSwitch:this.options.rtmpConfig.autoSwitch,useAppInstance:this.options.rtmpConfig.useAppInstance,proxyType:this.options.rtmpConfig.proxyType})),l.Browser.isIE?(this.$("embed").remove(),l.Browser.isLegacyIE&&this.$el.attr("classid",IE_CLASSID)):l.Browser.isFirefox&&this._setupFirefox(),this.el.id=this.cid;var t=l.Styler.getStyleFor(c["default"]);return this.$el.append(t),this}},{key:"_checkState",value:function(){r(Object.getPrototypeOf(e.prototype),"_checkState",this).call(this),"PLAYING"===this.el.getState()?this.trigger(l.Events.PLAYBACK_PLAY,this.name):"ERROR"===this.el.getState()&&this.trigger(l.Events.PLAYBACK_ERROR,this.name)}},{key:"_playbackReady",value:function(){this._isReadyState=!0,this.trigger(l.Events.PLAYBACK_READY,this.name)}},{key:"_reporLevels",value:function(){this.isDynamicStream&&this.levels&&(this.options.rtmpConfig.autoSwitch===!0?(this.trigger(l.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,-1),this.trigger(l.Events.PLAYBACK_BITRATE,{level:this.currentLevel})):this.trigger(l.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,this.options.rtmpConfig.startLevel))}},{key:"swfPath",get:function(){return this.options.rtmpConfig.swfPath}},{key:"currentLevel",get:function(){if(this._isReadyState)return this.el.getCurrentLevel()},set:function(t){this.el.setLevel(t),t===-1&&t!==this.currentLevel&&(this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_END),this.trigger(l.Events.PLAYBACK_BITRATE,{level:this.currentLevel}))}},{key:"numLevels",get:function(){if(this._isReadyState)return this.el.getNumLevels()}},{key:"autoSwitchLevels",get:function(){return this.el.isAutoSwitchLevels()}},{key:"levels",get:function(){for(var t=[],e=0;e-1||t.indexOf("rtmps://")>-1||t.indexOf(".smil")>-1)||!l.Browser.hasFlash)},f.debug=function(t){return console.log(t)},t.exports=e["default"]},/*!*************************!*\ +function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var i=0;i-1,this.options.rtmpConfig.useAppInstance=void 0!==this.options.rtmpConfig.useAppInstance&&this.options.rtmpConfig.useAppInstance,this.options.rtmpConfig.proxyType=this.options.rtmpConfig.proxyType||"none",this.options.rtmpConfig.startLevel=void 0===this.options.rtmpConfig.startLevel?-1:this.options.rtmpConfig.startLevel,this.options.rtmpConfig.autoSwitch=void 0!==this.options.rtmpConfig.autoSwitch&&this.options.rtmpConfig.autoSwitch,this.options.rtmpConfig.switchRules=this.options.rtmpConfig.switchRules,this.addListeners(),this._setupPlaybackType()}return o(e,t),a(e,[{key:"name",get:function(){return"rtmp"}},{key:"tagName",get:function(){return"object"}},{key:"template",get:function(){return(0,l.template)(u["default"])}},{key:"attributes",get:function(){return{"data-rtmp":"",type:"application/x-shockwave-flash",width:"100%",height:"100%"}}}]),a(e,[{key:"getPlaybackType",value:function(){return this._playbackType}},{key:"addListeners",value:function(){l.Mediator.on(this.uniqueId+":progress",this._progress,this),l.Mediator.on(this.uniqueId+":timeupdate",this._updateTime,this),l.Mediator.on(this.uniqueId+":statechanged",this._checkState,this),l.Mediator.on(this.uniqueId+":playbackready",this._playbackReady,this),l.Mediator.on(this.uniqueId+":onloaded",this._reporLevels,this),l.Mediator.on(this.uniqueId+":levelChanging",this._levelChanging,this),l.Mediator.on(this.uniqueId+":levelChanged",this._levelChange,this),l.Mediator.on(this.uniqueId+":flashready",this._bootstrap,this)}},{key:"stopListening",value:function(){r(Object.getPrototypeOf(e.prototype),"stopListening",this).call(this),l.Mediator.off(this.uniqueId+":progress"),l.Mediator.off(this.uniqueId+":timeupdate"),l.Mediator.off(this.uniqueId+":statechanged"),l.Mediator.off(this.uniqueId+":flashready")}},{key:"_bootstrap",value:function(){this.el.width="100%",this.el.height="100%",this.options.autoPlay&&this.play(),this._setupSettings()}},{key:"_updateTime",value:function(){"live"===this.getPlaybackType()?this.trigger(l.Events.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name):this.trigger(l.Events.PLAYBACK_TIMEUPDATE,{current:this.el.getPosition(),total:this.el.getDuration()},this.name)}},{key:"_levelChanging",value:function(){this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_START)}},{key:"_levelChange",value:function(){this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_END),this.trigger(l.Events.PLAYBACK_BITRATE,{level:this.currentLevel})}},{key:"findLevelBy",value:function(t){var e;return this.levels.forEach(function(i){i.id===t&&(e=i)}),e}},{key:"_setupPlaybackType",value:function(){this._playbackType=this.options.rtmpConfig.playbackType}},{key:"_setupSettings",value:function(){"live"===this.getPlaybackType()?(this.settings.left=["playpause"],this.settings.right=["fullscreen","volume"],this.settings.seekEnabled=!1):(this.settings.left=["playpause","position","duration"],this.settings.right=["fullscreen","volume"]),this.trigger(l.Events.PLAYBACK_SETTINGSUPDATE,this.name)}},{key:"render",value:function(){this.$el.html(this.template({cid:this.cid,swfPath:this.swfPath,playbackId:this.uniqueId,wmode:this.options.rtmpConfig.wmode,scaling:this.options.rtmpConfig.scaling,bufferTime:this.options.rtmpConfig.bufferTime,playbackType:this.options.rtmpConfig.playbackType,startLevel:this.options.rtmpConfig.startLevel,autoSwitch:this.options.rtmpConfig.autoSwitch,switchRules:this._switchRulesJSON,useAppInstance:this.options.rtmpConfig.useAppInstance,proxyType:this.options.rtmpConfig.proxyType})),l.Browser.isIE?(this.$("embed").remove(),l.Browser.isLegacyIE&&this.$el.attr("classid",IE_CLASSID)):l.Browser.isFirefox&&this._setupFirefox(),this.el.id=this.cid;var t=l.Styler.getStyleFor(c["default"]);return this.$el.append(t),this}},{key:"_checkState",value:function(){r(Object.getPrototypeOf(e.prototype),"_checkState",this).call(this),"PLAYING"===this.el.getState()?this.trigger(l.Events.PLAYBACK_PLAY,this.name):"ERROR"===this.el.getState()&&this.trigger(l.Events.PLAYBACK_ERROR,this.name)}},{key:"_playbackReady",value:function(){this._isReadyState=!0,this.trigger(l.Events.PLAYBACK_READY,this.name)}},{key:"_reporLevels",value:function(){this.isDynamicStream&&this.levels&&(this.options.rtmpConfig.autoSwitch===!0?(this.trigger(l.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,-1),this.trigger(l.Events.PLAYBACK_BITRATE,{level:this.currentLevel})):this.trigger(l.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,this.options.rtmpConfig.startLevel))}},{key:"swfPath",get:function(){return this.options.rtmpConfig.swfPath}},{key:"currentLevel",get:function(){if(this._isReadyState)return this.el.getCurrentLevel()},set:function(t){this.el.setLevel(t),t===-1&&t!==this.currentLevel&&(this.trigger(l.Events.PLAYBACK_LEVEL_SWITCH_END),this.trigger(l.Events.PLAYBACK_BITRATE,{level:this.currentLevel}))}},{key:"numLevels",get:function(){if(this._isReadyState)return this.el.getNumLevels()}},{key:"autoSwitchLevels",get:function(){return this.el.isAutoSwitchLevels()}},{key:"levels",get:function(){for(var t=[],e=0;e-1||t.indexOf("rtmps://")>-1||t.indexOf(".smil")>-1)||!l.Browser.hasFlash)},f.debug=function(t){return console.log(t)},t.exports=e["default"]},/*!*************************!*\ !*** external "Clappr" ***! \*************************/ function(e,i){e.exports=t},/*!***************************!*\ !*** ./public/flash.html ***! \***************************/ -function(t,e){t.exports='\n\n\n\n\n\n\n\n\n\n\n\n'},/*!**********************************************************!*\ +function(t,e){t.exports='\n\n\n\n\n\n\n\n\n\n\n\n'},/*!**********************************************************!*\ !*** ./~/raw-loader!./~/sass-loader!./public/flash.scss ***! \**********************************************************/ function(t,e){t.exports=".clappr-flash-playback[data-flash-playback]{display:block;position:absolute;top:0;left:0;height:100%;width:100%;pointer-events:none}\n"}])}); diff --git a/dist/rtmp.min.js.map b/dist/rtmp.min.js.map index c5e4149..c358091 100644 --- a/dist/rtmp.min.js.map +++ b/dist/rtmp.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///rtmp.min.js","webpack:///webpack/bootstrap b58dea2d7a60d81d2b8b","webpack:///./index.js","webpack:///./src/main.js","webpack:///external \"Clappr\"","webpack:///./public/flash.html","webpack:///./public/flash.scss"],"names":["root","factory","exports","module","require","define","amd","RTMP","Clappr","this","__WEBPACK_EXTERNAL_MODULE_2__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","Object","defineProperty","value","_interopRequireDefault","obj","__esModule","default","_classCallCheck","instance","Constructor","TypeError","_inherits","subClass","superClass","prototype","create","constructor","enumerable","writable","configurable","setPrototypeOf","__proto__","_createClass","defineProperties","target","props","i","length","descriptor","key","protoProps","staticProps","_get","_x","_x2","_x3","_again","object","property","receiver","Function","desc","getOwnPropertyDescriptor","undefined","getter","get","parent","getPrototypeOf","_clappr","_publicFlashHtml","_publicFlashHtml2","_rawSassPublicFlashScss","_rawSassPublicFlashScss2","_Flash","options","rtmpConfig","swfPath","wmode","bufferTime","scaling","playbackType","src","indexOf","useAppInstance","proxyType","startLevel","autoSwitch","addListeners","_setupPlaybackType","template","data-rtmp","type","width","height","_playbackType","Mediator","on","uniqueId","_progress","_updateTime","_checkState","_playbackReady","_reporLevels","_levelChanging","_levelChange","_bootstrap","off","el","autoPlay","play","_setupSettings","getPlaybackType","trigger","Events","PLAYBACK_TIMEUPDATE","current","total","name","getPosition","getDuration","PLAYBACK_LEVEL_SWITCH_START","PLAYBACK_LEVEL_SWITCH_END","PLAYBACK_BITRATE","level","currentLevel","foundLevel","levels","forEach","settings","left","right","seekEnabled","PLAYBACK_SETTINGSUPDATE","$el","html","cid","playbackId","Browser","isIE","$","remove","isLegacyIE","attr","IE_CLASSID","isFirefox","_setupFirefox","style","Styler","getStyleFor","append","getState","PLAYBACK_PLAY","PLAYBACK_ERROR","_isReadyState","PLAYBACK_READY","isDynamicStream","PLAYBACK_LEVELS_AVAILABLE","getCurrentLevel","set","setLevel","getNumLevels","isAutoSwitchLevels","numLevels","bitrate","getBitrateForLevel","push","label","Flash","canPlay","source","hasFlash","debug","s","console","log"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,WACA,kBAAAC,gBAAAC,IACAD,QAAA,UAAAJ,GACA,gBAAAC,SACAA,QAAAK,KAAAN,EAAAG,QAAA,WAEAJ,EAAAO,KAAAN,EAAAD,EAAAQ,SACCC,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAX,OAGA,IAAAC,GAAAW,EAAAD,IACAX,WACAa,GAAAF,EACAG,UAUA,OANAL,GAAAE,GAAAI,KAAAd,EAAAD,QAAAC,IAAAD,QAAAU,GAGAT,EAAAa,UAGAb,EAAAD,QAvBA,GAAAY,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA;;;ADmBM,SAAST,EAAQD,EAASU,GAE/B,YAAaS,QAAOC,eAAepB,EAAQ,cAAcqB,WAAarB,EAAQ,WE3DhEU,sBAAQ,GAAgBT,EAAAD,UAAA;;;AFkEjC,SAASC,EAAQD,EAASU,GAK/B,YAAmqC,SAASY,GAAuBC,GAAK,MAAOA,IAAOA,EAAIC,WAAWD,GAAKE,UAAUF,GAAM,QAASG,GAAgBC,EAASC,GAAa,KAAKD,YAAoBC,IAAc,KAAM,IAAIC,WAAU,qCAAuC,QAASC,GAAUC,EAASC,GAAY,GAAyB,kBAAfA,IAA4C,OAAfA,EAAqB,KAAM,IAAIH,WAAU,iEAAoEG,GAAaD,GAASE,UAAYd,OAAOe,OAAOF,GAAcA,EAAWC,WAAWE,aAAad,MAAMU,EAASK,cAAiBC,YAAcC,mBAAwBN,IAAWb,OAAOoB,eAAepB,OAAOoB,eAA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AGoD,SAASpC,GAEbA,QAAgBA,IAAUnH,KAAKoH,eAC/BpH,KAAKwG,QAAQ5C,EAAA6C,OAAOQ,2BACpBjH,KAAKwG,QAAQ5C,EAAA6C,OAAOS,kBAAmBC,MAAOnH,KAAKoH,mBAE1D3E,IAAA,YAAAgB,IAhBY,WACT,GAAIzD,KAAKiJ,cACL,MAAOjJ,MAAKmG,GAAGqD,kBAItB/G,IAAA,mBAAAgB,IAYmB,WAChB,MAAOzD,MAAKmG,GAAGsD,wBAClBhH,IAAA,SAAAgB,IAES,WAGN,IAAK,GAFD6D,MAEKhF,EAAI,EAAGA,EAAItC,KAAK0J,UAAWpH,IAAK,CACrC,GAAIqH,GAAU3J,KAAKmG,GAAGyD,mBAAmBtH,EAEzCgF,GAAOuC,MACHvJ,GAAIgC,EACJwH,MAAOH,EAAU,SAIzB,MAAOrC,MACV7E,IAAA,kBAAAgB,IAEkB,WACf,MAAOzD,MAAKmG,GAAGgD,sBAnFFrJ,GAAI8D,EAAAmG,MAAAtK,GAAA,WAAJK,EAmNrBA,EAAKkK,QAAU,SAAUC,GACrB,UAAWA,EAAOvF,QAAQ,eAAmBuF,EAAOvF,QAAQ,gBAAoBuF,EAAOvF,QAAQ,eAAkBd,EAAAqE,QAAQiC,WAG7HpK,EAAKqK,MAAQ,SAAAC,GAAC,MAAIC,SAAQC,IAAIF,IAAE1K,EAAAD,UAAA;;;AHjJ1B,SAASC,EAAQD,GI/EvBC,EAAAD,QAAAQ;;;AJwFM,SAASP,EAAQD,GKxFvBC,EAAAD,QAAA;;;ALiGM,SAASC,EAAQD,GMjGvBC,EAAAD,QAAA","file":"rtmp.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Clappr\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Clappr\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"RTMP\"] = factory(require(\"Clappr\"));\n\telse\n\t\troot[\"RTMP\"] = factory(root[\"Clappr\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Clappr\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Clappr\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"RTMP\"] = factory(require(\"Clappr\"));\n\telse\n\t\troot[\"RTMP\"] = factory(root[\"Clappr\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!******************!*\\\n !*** ./index.js ***!\n \\******************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';Object.defineProperty(exports,'__esModule',{value:true});exports['default'] = __webpack_require__(/*! ./src/main.js */ 1);module.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/*!*********************!*\\\n !*** ./src/main.js ***!\n \\*********************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t// Copyright 2014 Globo.com Player authors. All rights reserved.\n\t// Use of this source code is governed by a BSD-style\n\t// license that can be found in the LICENSE file.\n\t'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _createClass=(function(){function defineProperties(target,props){for(var i=0;i < props.length;i++) {var descriptor=props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if('value' in descriptor)descriptor.writable = true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();var _get=function get(_x,_x2,_x3){var _again=true;_function: while(_again) {var object=_x,property=_x2,receiver=_x3;_again = false;if(object === null)object = Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc === undefined){var parent=Object.getPrototypeOf(object);if(parent === null){return undefined;}else {_x = parent;_x2 = property;_x3 = receiver;_again = true;desc = parent = undefined;continue _function;}}else if('value' in desc){return desc.value;}else {var getter=desc.get;if(getter === undefined){return undefined;}return getter.call(receiver);}}};function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{'default':obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function');}}function _inherits(subClass,superClass){if(typeof superClass !== 'function' && superClass !== null){throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);}subClass.prototype = Object.create(superClass && superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__ = superClass;}var _clappr=__webpack_require__(/*! clappr */ 2);var _publicFlashHtml=__webpack_require__(/*! ../public/flash.html */ 3);var _publicFlashHtml2=_interopRequireDefault(_publicFlashHtml);var _rawSassPublicFlashScss=__webpack_require__(/*! raw!sass!../public/flash.scss */ 4);var _rawSassPublicFlashScss2=_interopRequireDefault(_rawSassPublicFlashScss);var RTMP=(function(_Flash){_inherits(RTMP,_Flash);_createClass(RTMP,[{key:'name',get:function get(){return 'rtmp';}},{key:'tagName',get:function get(){return 'object';}},{key:'template',get:function get(){return (0,_clappr.template)(_publicFlashHtml2['default']);}},{key:'attributes',get:function get(){return {'data-rtmp':'','type':'application/x-shockwave-flash','width':'100%','height':'100%'};}}]);function RTMP(options){_classCallCheck(this,RTMP);_get(Object.getPrototypeOf(RTMP.prototype),'constructor',this).call(this,options);this.options.rtmpConfig = this.options.rtmpConfig || {};this.options.rtmpConfig.swfPath = this.options.rtmpConfig.swfPath || '//cdn.jsdelivr.net/clappr.rtmp/latest/assets/RTMP.swf';this.options.rtmpConfig.wmode = this.options.rtmpConfig.wmode || 'transparent'; // Default to transparent wmode - IE always uses gpu as per objectIE\n\tthis.options.rtmpConfig.bufferTime = this.options.rtmpConfig.bufferTime === undefined?0.1:this.options.rtmpConfig.bufferTime;this.options.rtmpConfig.scaling = this.options.rtmpConfig.scaling || 'letterbox';this.options.rtmpConfig.playbackType = this.options.rtmpConfig.playbackType || this.options.src.indexOf('live') > -1;this.options.rtmpConfig.useAppInstance = this.options.rtmpConfig.useAppInstance === undefined?false:this.options.rtmpConfig.useAppInstance;this.options.rtmpConfig.proxyType = this.options.rtmpConfig.proxyType || 'none';this.options.rtmpConfig.startLevel = this.options.rtmpConfig.startLevel === undefined?-1:this.options.rtmpConfig.startLevel;this.options.rtmpConfig.autoSwitch = this.options.rtmpConfig.autoSwitch === undefined?false:this.options.rtmpConfig.autoSwitch;this.addListeners();this._setupPlaybackType();}_createClass(RTMP,[{key:'getPlaybackType',value:function getPlaybackType(){return this._playbackType;}},{key:'addListeners',value:function addListeners(){_clappr.Mediator.on(this.uniqueId + ':progress',this._progress,this);_clappr.Mediator.on(this.uniqueId + ':timeupdate',this._updateTime,this);_clappr.Mediator.on(this.uniqueId + ':statechanged',this._checkState,this);_clappr.Mediator.on(this.uniqueId + ':playbackready',this._playbackReady,this);_clappr.Mediator.on(this.uniqueId + ':onloaded',this._reporLevels,this);_clappr.Mediator.on(this.uniqueId + ':levelChanging',this._levelChanging,this);_clappr.Mediator.on(this.uniqueId + ':levelChanged',this._levelChange,this);_clappr.Mediator.on(this.uniqueId + ':flashready',this._bootstrap,this);}},{key:'stopListening',value:function stopListening(){_get(Object.getPrototypeOf(RTMP.prototype),'stopListening',this).call(this);_clappr.Mediator.off(this.uniqueId + ':progress');_clappr.Mediator.off(this.uniqueId + ':timeupdate');_clappr.Mediator.off(this.uniqueId + ':statechanged');_clappr.Mediator.off(this.uniqueId + ':flashready');}},{key:'_bootstrap',value:function _bootstrap(){this.el.width = '100%';this.el.height = '100%';this.options.autoPlay && this.play();this._setupSettings();}},{key:'_updateTime',value:function _updateTime(){if(this.getPlaybackType() === 'live'){this.trigger(_clappr.Events.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name);}else {this.trigger(_clappr.Events.PLAYBACK_TIMEUPDATE,{current:this.el.getPosition(),total:this.el.getDuration()},this.name);}}},{key:'_levelChanging',value:function _levelChanging(){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_START);}},{key:'_levelChange',value:function _levelChange(){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_END);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}},{key:'findLevelBy',value:function findLevelBy(id){var foundLevel;this.levels.forEach(function(level){if(level.id === id){foundLevel = level;}});return foundLevel;}},{key:'_setupPlaybackType',value:function _setupPlaybackType(){this._playbackType = this.options.rtmpConfig.playbackType;}},{key:'_setupSettings',value:function _setupSettings(){if(this.getPlaybackType() === 'live'){this.settings.left = [\"playpause\"];this.settings.right = [\"fullscreen\",\"volume\"];this.settings.seekEnabled = false;}else {this.settings.left = [\"playpause\",\"position\",\"duration\"];this.settings.right = [\"fullscreen\",\"volume\"];}this.trigger(_clappr.Events.PLAYBACK_SETTINGSUPDATE,this.name);}},{key:'render',value:function render(){this.$el.html(this.template({cid:this.cid,swfPath:this.swfPath,playbackId:this.uniqueId,wmode:this.options.rtmpConfig.wmode,scaling:this.options.rtmpConfig.scaling,bufferTime:this.options.rtmpConfig.bufferTime,playbackType:this.options.rtmpConfig.playbackType,startLevel:this.options.rtmpConfig.startLevel,autoSwitch:this.options.rtmpConfig.autoSwitch,useAppInstance:this.options.rtmpConfig.useAppInstance,proxyType:this.options.rtmpConfig.proxyType}));if(_clappr.Browser.isIE){this.$('embed').remove();if(_clappr.Browser.isLegacyIE){this.$el.attr('classid',IE_CLASSID);}}else if(_clappr.Browser.isFirefox){this._setupFirefox();}this.el.id = this.cid;var style=_clappr.Styler.getStyleFor(_rawSassPublicFlashScss2['default']);this.$el.append(style);return this;}},{key:'_checkState',value:function _checkState(){_get(Object.getPrototypeOf(RTMP.prototype),'_checkState',this).call(this);if(this.el.getState() === \"PLAYING\"){this.trigger(_clappr.Events.PLAYBACK_PLAY,this.name);}else if(this.el.getState() === \"ERROR\"){this.trigger(_clappr.Events.PLAYBACK_ERROR,this.name);}}},{key:'_playbackReady',value:function _playbackReady(){this._isReadyState = true;this.trigger(_clappr.Events.PLAYBACK_READY,this.name);}},{key:'_reporLevels',value:function _reporLevels(){if(this.isDynamicStream){if(this.levels){if(this.options.rtmpConfig.autoSwitch === true){this.trigger(_clappr.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,-1);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}else {this.trigger(_clappr.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,this.options.rtmpConfig.startLevel);}}}}},{key:'swfPath',get:function get(){return this.options.rtmpConfig.swfPath;}},{key:'currentLevel',get:function get(){if(this._isReadyState){return this.el.getCurrentLevel();}return undefined;},set:function set(level){this.el.setLevel(level);if(level === -1 && level !== this.currentLevel){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_END);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}}},{key:'numLevels',get:function get(){if(this._isReadyState){return this.el.getNumLevels();}return undefined;}},{key:'autoSwitchLevels',get:function get(){return this.el.isAutoSwitchLevels();}},{key:'levels',get:function get(){var levels=[];for(var i=0;i < this.numLevels;i++) {var bitrate=this.el.getBitrateForLevel(i);levels.push({id:i,label:bitrate + \"Kbps\"});}return levels;}},{key:'isDynamicStream',get:function get(){return this.el.isDynamicStream();}}]);return RTMP;})(_clappr.Flash);exports['default'] = RTMP;RTMP.canPlay = function(source){return !!((source.indexOf('rtmp://') > -1 || source.indexOf('rtmps://') > -1 || source.indexOf('.smil') > -1) && _clappr.Browser.hasFlash);};RTMP.debug = function(s){return console.log(s);};module.exports = exports['default'];\n\n/***/ },\n/* 2 */\n/*!*************************!*\\\n !*** external \"Clappr\" ***!\n \\*************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n/***/ },\n/* 3 */\n/*!***************************!*\\\n !*** ./public/flash.html ***!\n \\***************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = \"?inline=1\\\">\\n\\n\\n\\n\\n\\n\\n\\\">\\n\\n&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>\\\"/>\\n\\\"\\n type=\\\"application/x-shockwave-flash\\\"\\n disabled=\\\"disabled\\\"\\n tabindex=\\\"-1\\\"\\n enablecontextmenu=\\\"false\\\"\\n allowScriptAccess=\\\"always\\\"\\n allownetworking=\\\"all\\\"\\n quality=\\\"autohigh\\\"\\n pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\"\\n wmode=\\\"<%= wmode %>\\\"\\n swliveconnect=\\\"true\\\"\\n allowfullscreen=\\\"false\\\"\\n bgcolor=\\\"#000000\\\"\\n FlashVars=\\\"playbackId=<%= playbackId %>&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>\\\"\\n src=\\\"<%= swfPath %>\\\"\\n width=\\\"100%\\\"\\n height=\\\"100%\\\">\\n\\n\";\n\n/***/ },\n/* 4 */\n/*!**********************************************************!*\\\n !*** ./~/raw-loader!./~/sass-loader!./public/flash.scss ***!\n \\**********************************************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = \".clappr-flash-playback[data-flash-playback]{display:block;position:absolute;top:0;left:0;height:100%;width:100%;pointer-events:none}\\n\"\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** rtmp.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap b58dea2d7a60d81d2b8b\n **/","export default require('./src/main.js')\n\n\n\n/** WEBPACK FOOTER **\n ** ./index.js\n **/","// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nimport {Browser, Events, Flash, Mediator, Styler, UICorePlugin, template} from 'clappr'\n\nimport flashHTML from '../public/flash.html'\nimport flashStyle from '!raw!sass!../public/flash.scss'\n\nexport default class RTMP extends Flash {\n get name() { return 'rtmp' }\n get tagName() { return 'object' }\n get template() { return template(flashHTML) }\n get attributes() {\n return {\n 'data-rtmp': '',\n 'type': 'application/x-shockwave-flash',\n 'width': '100%',\n 'height': '100%'\n }\n }\n\n constructor(options) {\n super(options)\n this.options.rtmpConfig = this.options.rtmpConfig || {}\n this.options.rtmpConfig.swfPath = this.options.rtmpConfig.swfPath || '//cdn.jsdelivr.net/clappr.rtmp/latest/assets/RTMP.swf'\n this.options.rtmpConfig.wmode = this.options.rtmpConfig.wmode || 'transparent' // Default to transparent wmode - IE always uses gpu as per objectIE\n this.options.rtmpConfig.bufferTime = this.options.rtmpConfig.bufferTime === undefined ? 0.1 : this.options.rtmpConfig.bufferTime\n this.options.rtmpConfig.scaling = this.options.rtmpConfig.scaling || 'letterbox'\n this.options.rtmpConfig.playbackType = this.options.rtmpConfig.playbackType || this.options.src.indexOf('live') > -1\n this.options.rtmpConfig.useAppInstance = this.options.rtmpConfig.useAppInstance === undefined ? false : this.options.rtmpConfig.useAppInstance\n this.options.rtmpConfig.proxyType = this.options.rtmpConfig.proxyType || 'none'\n this.options.rtmpConfig.startLevel = this.options.rtmpConfig.startLevel === undefined ? -1 : this.options.rtmpConfig.startLevel\n this.options.rtmpConfig.autoSwitch = this.options.rtmpConfig.autoSwitch === undefined ? false : this.options.rtmpConfig.autoSwitch\n this.addListeners()\n this._setupPlaybackType()\n }\n\n getPlaybackType() {\n return this._playbackType\n }\n\n get swfPath() {\n return this.options.rtmpConfig.swfPath\n }\n\n get currentLevel() {\n if (this._isReadyState) {\n return this.el.getCurrentLevel();\n }\n\n return undefined;\n }\n\n get numLevels() {\n if (this._isReadyState) {\n return this.el.getNumLevels();\n }\n\n return undefined;\n }\n\n\n set currentLevel(level) {\n this.el.setLevel(level);\n\n if (level === -1 && level !== this.currentLevel) {\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_END)\n this.trigger(Events.PLAYBACK_BITRATE, {level: this.currentLevel})\n }\n }\n\n get autoSwitchLevels() {\n return this.el.isAutoSwitchLevels();\n }\n\n get levels() {\n var levels = [];\n\n for (var i = 0; i < this.numLevels; i++) {\n var bitrate = this.el.getBitrateForLevel(i);\n\n levels.push({\n id: i,\n label: bitrate + \"Kbps\"\n });\n }\n\n return levels;\n }\n\n get isDynamicStream() {\n return this.el.isDynamicStream();\n }\n\n addListeners() {\n Mediator.on(this.uniqueId + ':progress', this._progress, this)\n Mediator.on(this.uniqueId + ':timeupdate', this._updateTime, this)\n Mediator.on(this.uniqueId + ':statechanged', this._checkState, this)\n Mediator.on(this.uniqueId + ':playbackready', this._playbackReady, this)\n Mediator.on(this.uniqueId + ':onloaded', this._reporLevels, this)\n Mediator.on(this.uniqueId + ':levelChanging', this._levelChanging, this)\n Mediator.on(this.uniqueId + ':levelChanged', this._levelChange, this)\n Mediator.on(this.uniqueId + ':flashready', this._bootstrap, this)\n }\n\n stopListening() {\n super.stopListening()\n Mediator.off(this.uniqueId + ':progress')\n Mediator.off(this.uniqueId + ':timeupdate')\n Mediator.off(this.uniqueId + ':statechanged')\n Mediator.off(this.uniqueId + ':flashready')\n }\n\n _bootstrap() {\n this.el.width = '100%'\n this.el.height = '100%'\n this.options.autoPlay && this.play()\n this._setupSettings()\n }\n\n _updateTime() {\n if (this.getPlaybackType() === 'live') {\n this.trigger(Events.PLAYBACK_TIMEUPDATE, {current: 1, total: 1}, this.name)\n } else {\n this.trigger(Events.PLAYBACK_TIMEUPDATE, {current: this.el.getPosition(), total: this.el.getDuration()}, this.name)\n }\n }\n\n _levelChanging() {\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_START)\n }\n\n _levelChange() {\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_END)\n this.trigger(Events.PLAYBACK_BITRATE, {level: this.currentLevel})\n }\n\n findLevelBy(id) {\n var foundLevel\n this.levels.forEach((level) => { if (level.id === id) {foundLevel = level} })\n return foundLevel\n }\n\n _setupPlaybackType() {\n this._playbackType = this.options.rtmpConfig.playbackType\n }\n\n _setupSettings() {\n if (this.getPlaybackType() === 'live') {\n this.settings.left = [\"playpause\"]\n this.settings.right = [\"fullscreen\", \"volume\"]\n this.settings.seekEnabled = false\n }\n else {\n this.settings.left = [\"playpause\", \"position\", \"duration\"]\n this.settings.right = [\"fullscreen\", \"volume\"]\n }\n\n this.trigger(Events.PLAYBACK_SETTINGSUPDATE, this.name)\n }\n\n render() {\n this.$el.html(this.template({\n cid: this.cid,\n swfPath: this.swfPath,\n playbackId: this.uniqueId,\n wmode: this.options.rtmpConfig.wmode,\n scaling: this.options.rtmpConfig.scaling,\n bufferTime: this.options.rtmpConfig.bufferTime,\n playbackType: this.options.rtmpConfig.playbackType,\n startLevel: this.options.rtmpConfig.startLevel,\n autoSwitch: this.options.rtmpConfig.autoSwitch,\n useAppInstance: this.options.rtmpConfig.useAppInstance,\n proxyType: this.options.rtmpConfig.proxyType\n }))\n\n if (Browser.isIE) {\n this.$('embed').remove()\n if (Browser.isLegacyIE) {\n this.$el.attr('classid', IE_CLASSID)\n }\n } else if (Browser.isFirefox) {\n this._setupFirefox()\n }\n this.el.id = this.cid\n var style = Styler.getStyleFor(flashStyle)\n this.$el.append(style)\n return this\n }\n\n _checkState() {\n super._checkState()\n\n if (this.el.getState() === \"PLAYING\") {\n this.trigger(Events.PLAYBACK_PLAY, this.name)\n } else if (this.el.getState() === \"ERROR\") {\n this.trigger(Events.PLAYBACK_ERROR, this.name)\n }\n }\n\n _playbackReady() {\n this._isReadyState = true\n this.trigger(Events.PLAYBACK_READY, this.name)\n }\n\n _reporLevels() {\n if (this.isDynamicStream) {\n if (this.levels) {\n if (this.options.rtmpConfig.autoSwitch === true) {\n this.trigger(Events.PLAYBACK_LEVELS_AVAILABLE, this.levels, -1)\n this.trigger(Events.PLAYBACK_BITRATE, {level: this.currentLevel})\n } else {\n this.trigger(Events.PLAYBACK_LEVELS_AVAILABLE, this.levels, this.options.rtmpConfig.startLevel)\n }\n }\n }\n }\n}\n\nRTMP.canPlay = function (source) {\n return !!((source.indexOf('rtmp://') > -1 || source.indexOf('rtmps://') > -1 || source.indexOf('.smil') > -1) && Browser.hasFlash)\n};\n\nRTMP.debug = s => console.log(s)\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/main.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"Clappr\"\n ** module id = 2\n ** module chunks = 0\n **/","module.exports = \"?inline=1\\\">\\n\\n\\n\\n\\n\\n\\n\\\">\\n\\n&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>\\\"/>\\n\\\"\\n type=\\\"application/x-shockwave-flash\\\"\\n disabled=\\\"disabled\\\"\\n tabindex=\\\"-1\\\"\\n enablecontextmenu=\\\"false\\\"\\n allowScriptAccess=\\\"always\\\"\\n allownetworking=\\\"all\\\"\\n quality=\\\"autohigh\\\"\\n pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\"\\n wmode=\\\"<%= wmode %>\\\"\\n swliveconnect=\\\"true\\\"\\n allowfullscreen=\\\"false\\\"\\n bgcolor=\\\"#000000\\\"\\n FlashVars=\\\"playbackId=<%= playbackId %>&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>\\\"\\n src=\\\"<%= swfPath %>\\\"\\n width=\\\"100%\\\"\\n height=\\\"100%\\\">\\n\\n\";\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./public/flash.html\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = \".clappr-flash-playback[data-flash-playback]{display:block;position:absolute;top:0;left:0;height:100%;width:100%;pointer-events:none}\\n\"\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./~/sass-loader!./public/flash.scss\n ** module id = 4\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///rtmp.min.js","webpack:///webpack/bootstrap 9dd426dd1dd6acb98627","webpack:///./index.js","webpack:///./src/main.js","webpack:///external \"Clappr\"","webpack:///./public/flash.html","webpack:///./public/flash.scss"],"names":["root","factory","exports","module","require","define","amd","RTMP","Clappr","this","__WEBPACK_EXTERNAL_MODULE_2__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","Object","defineProperty","value","_interopRequireDefault","obj","__esModule","default","_classCallCheck","instance","Constructor","TypeError","_inherits","subClass","superClass","prototype","create","constructor","enumerable","writable","configurable","setPrototypeOf","__proto__","_createClass","defineProperties","target","props","i","length","descriptor","key","protoProps","staticProps","_get","_x","_x2","_x3","_again","object","property","receiver","Function","desc","getOwnPropertyDescriptor","undefined","getter","get","parent","getPrototypeOf","_clappr","_publicFlashHtml","_publicFlashHtml2","_rawSassPublicFlashScss","_rawSassPublicFlashScss2","_Flash","options","rtmpConfig","swfPath","wmode","bufferTime","scaling","playbackType","src","indexOf","useAppInstance","proxyType","startLevel","autoSwitch","switchRules","addListeners","_setupPlaybackType","template","data-rtmp","type","width","height","_playbackType","Mediator","on","uniqueId","_progress","_updateTime","_checkState","_playbackReady","_reporLevels","_levelChanging","_levelChange","_bootstrap","off","el","autoPlay","play","_setupSettings","getPlaybackType","trigger","Events","PLAYBACK_TIMEUPDATE","current","total","name","getPosition","getDuration","PLAYBACK_LEVEL_SWITCH_START","PLAYBACK_LEVEL_SWITCH_END","PLAYBACK_BITRATE","level","currentLevel","foundLevel","levels","forEach","settings","left","right","seekEnabled","PLAYBACK_SETTINGSUPDATE","$el","html","cid","playbackId","_switchRulesJSON","Browser","isIE","$","remove","isLegacyIE","attr","IE_CLASSID","isFirefox","_setupFirefox","style","Styler","getStyleFor","append","getState","PLAYBACK_PLAY","PLAYBACK_ERROR","_isReadyState","PLAYBACK_READY","isDynamicStream","PLAYBACK_LEVELS_AVAILABLE","getCurrentLevel","set","setLevel","getNumLevels","isAutoSwitchLevels","numLevels","bitrate","getBitrateForLevel","push","label","JSON","stringify","replace","Flash","canPlay","source","hasFlash","debug","s","console","log"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,WACA,kBAAAC,gBAAAC,IACAD,QAAA,UAAAJ,GACA,gBAAAC,SACAA,QAAAK,KAAAN,EAAAG,QAAA,WAEAJ,EAAAO,KAAAN,EAAAD,EAAAQ,SACCC,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAX,OAGA,IAAAC,GAAAW,EAAAD,IACAX,WACAa,GAAAF,EACAG,UAUA,OANAL,GAAAE,GAAAI,KAAAd,EAAAD,QAAAC,IAAAD,QAAAU,GAGAT,EAAAa,UAGAb,EAAAD,QAvBA,GAAAY,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA;;;ADmBM,SAAST,EAAQD,EAASU,GAE/B,YAAaS,QAAOC,eAAepB,EAAQ,cAAcqB,WAAarB,EAAQ,WE3DhEU,sBAAQ,GAAgBT,EAAAD,UAAA;;;AFkEjC,SAASC,EAAQD,EAASU,GAK/B,YAAmqC,SAASY,GAAuBC,GAAK,MAAOA,IAAOA,EAAIC,WAAWD,GAAKE,UAAUF,GAAM,QAASG,G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A,EAAO5F,QAAQ,eAAmB4F,EAAO5F,QAAQ,gBAAoB4F,EAAO5F,QAAQ,eAAkBd,EAAAuE,QAAQoC,WAG7HzK,EAAK0K,MAAQ,SAAAC,GAAC,MAAIC,SAAQC,IAAIF,IAAE/K,EAAAD,UAAA;;;AH5J1B,SAASC,EAAQD,GI/EvBC,EAAAD,QAAAQ;;;AJwFM,SAASP,EAAQD,GKxFvBC,EAAAD,QAAA;;;ALiGM,SAASC,EAAQD,GMjGvBC,EAAAD,QAAA","file":"rtmp.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Clappr\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Clappr\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"RTMP\"] = factory(require(\"Clappr\"));\n\telse\n\t\troot[\"RTMP\"] = factory(root[\"Clappr\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"Clappr\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"Clappr\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"RTMP\"] = factory(require(\"Clappr\"));\n\telse\n\t\troot[\"RTMP\"] = factory(root[\"Clappr\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!******************!*\\\n !*** ./index.js ***!\n \\******************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';Object.defineProperty(exports,'__esModule',{value:true});exports['default'] = __webpack_require__(/*! ./src/main.js */ 1);module.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/*!*********************!*\\\n !*** ./src/main.js ***!\n \\*********************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t// Copyright 2014 Globo.com Player authors. All rights reserved.\n\t// Use of this source code is governed by a BSD-style\n\t// license that can be found in the LICENSE file.\n\t'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _createClass=(function(){function defineProperties(target,props){for(var i=0;i < props.length;i++) {var descriptor=props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if('value' in descriptor)descriptor.writable = true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();var _get=function get(_x,_x2,_x3){var _again=true;_function: while(_again) {var object=_x,property=_x2,receiver=_x3;_again = false;if(object === null)object = Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc === undefined){var parent=Object.getPrototypeOf(object);if(parent === null){return undefined;}else {_x = parent;_x2 = property;_x3 = receiver;_again = true;desc = parent = undefined;continue _function;}}else if('value' in desc){return desc.value;}else {var getter=desc.get;if(getter === undefined){return undefined;}return getter.call(receiver);}}};function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{'default':obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function');}}function _inherits(subClass,superClass){if(typeof superClass !== 'function' && superClass !== null){throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);}subClass.prototype = Object.create(superClass && superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__ = superClass;}var _clappr=__webpack_require__(/*! clappr */ 2);var _publicFlashHtml=__webpack_require__(/*! ../public/flash.html */ 3);var _publicFlashHtml2=_interopRequireDefault(_publicFlashHtml);var _rawSassPublicFlashScss=__webpack_require__(/*! raw!sass!../public/flash.scss */ 4);var _rawSassPublicFlashScss2=_interopRequireDefault(_rawSassPublicFlashScss);var RTMP=(function(_Flash){_inherits(RTMP,_Flash);_createClass(RTMP,[{key:'name',get:function get(){return 'rtmp';}},{key:'tagName',get:function get(){return 'object';}},{key:'template',get:function get(){return (0,_clappr.template)(_publicFlashHtml2['default']);}},{key:'attributes',get:function get(){return {'data-rtmp':'','type':'application/x-shockwave-flash','width':'100%','height':'100%'};}}]);function RTMP(options){_classCallCheck(this,RTMP);_get(Object.getPrototypeOf(RTMP.prototype),'constructor',this).call(this,options);this.options.rtmpConfig = this.options.rtmpConfig || {};this.options.rtmpConfig.swfPath = this.options.rtmpConfig.swfPath || '//cdn.jsdelivr.net/clappr.rtmp/latest/assets/RTMP.swf';this.options.rtmpConfig.wmode = this.options.rtmpConfig.wmode || 'transparent'; // Default to transparent wmode - IE always uses gpu as per objectIE\n\tthis.options.rtmpConfig.bufferTime = this.options.rtmpConfig.bufferTime === undefined?0.1:this.options.rtmpConfig.bufferTime;this.options.rtmpConfig.scaling = this.options.rtmpConfig.scaling || 'letterbox';this.options.rtmpConfig.playbackType = this.options.rtmpConfig.playbackType || this.options.src.indexOf('live') > -1;this.options.rtmpConfig.useAppInstance = this.options.rtmpConfig.useAppInstance === undefined?false:this.options.rtmpConfig.useAppInstance;this.options.rtmpConfig.proxyType = this.options.rtmpConfig.proxyType || 'none';this.options.rtmpConfig.startLevel = this.options.rtmpConfig.startLevel === undefined?-1:this.options.rtmpConfig.startLevel;this.options.rtmpConfig.autoSwitch = this.options.rtmpConfig.autoSwitch === undefined?false:this.options.rtmpConfig.autoSwitch;this.options.rtmpConfig.switchRules = this.options.rtmpConfig.switchRules;this.addListeners();this._setupPlaybackType();}_createClass(RTMP,[{key:'getPlaybackType',value:function getPlaybackType(){return this._playbackType;}},{key:'addListeners',value:function addListeners(){_clappr.Mediator.on(this.uniqueId + ':progress',this._progress,this);_clappr.Mediator.on(this.uniqueId + ':timeupdate',this._updateTime,this);_clappr.Mediator.on(this.uniqueId + ':statechanged',this._checkState,this);_clappr.Mediator.on(this.uniqueId + ':playbackready',this._playbackReady,this);_clappr.Mediator.on(this.uniqueId + ':onloaded',this._reporLevels,this);_clappr.Mediator.on(this.uniqueId + ':levelChanging',this._levelChanging,this);_clappr.Mediator.on(this.uniqueId + ':levelChanged',this._levelChange,this);_clappr.Mediator.on(this.uniqueId + ':flashready',this._bootstrap,this);}},{key:'stopListening',value:function stopListening(){_get(Object.getPrototypeOf(RTMP.prototype),'stopListening',this).call(this);_clappr.Mediator.off(this.uniqueId + ':progress');_clappr.Mediator.off(this.uniqueId + ':timeupdate');_clappr.Mediator.off(this.uniqueId + ':statechanged');_clappr.Mediator.off(this.uniqueId + ':flashready');}},{key:'_bootstrap',value:function _bootstrap(){this.el.width = '100%';this.el.height = '100%';this.options.autoPlay && this.play();this._setupSettings();}},{key:'_updateTime',value:function _updateTime(){if(this.getPlaybackType() === 'live'){this.trigger(_clappr.Events.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name);}else {this.trigger(_clappr.Events.PLAYBACK_TIMEUPDATE,{current:this.el.getPosition(),total:this.el.getDuration()},this.name);}}},{key:'_levelChanging',value:function _levelChanging(){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_START);}},{key:'_levelChange',value:function _levelChange(){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_END);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}},{key:'findLevelBy',value:function findLevelBy(id){var foundLevel;this.levels.forEach(function(level){if(level.id === id){foundLevel = level;}});return foundLevel;}},{key:'_setupPlaybackType',value:function _setupPlaybackType(){this._playbackType = this.options.rtmpConfig.playbackType;}},{key:'_setupSettings',value:function _setupSettings(){if(this.getPlaybackType() === 'live'){this.settings.left = [\"playpause\"];this.settings.right = [\"fullscreen\",\"volume\"];this.settings.seekEnabled = false;}else {this.settings.left = [\"playpause\",\"position\",\"duration\"];this.settings.right = [\"fullscreen\",\"volume\"];}this.trigger(_clappr.Events.PLAYBACK_SETTINGSUPDATE,this.name);}},{key:'render',value:function render(){this.$el.html(this.template({cid:this.cid,swfPath:this.swfPath,playbackId:this.uniqueId,wmode:this.options.rtmpConfig.wmode,scaling:this.options.rtmpConfig.scaling,bufferTime:this.options.rtmpConfig.bufferTime,playbackType:this.options.rtmpConfig.playbackType,startLevel:this.options.rtmpConfig.startLevel,autoSwitch:this.options.rtmpConfig.autoSwitch,switchRules:this._switchRulesJSON,useAppInstance:this.options.rtmpConfig.useAppInstance,proxyType:this.options.rtmpConfig.proxyType}));if(_clappr.Browser.isIE){this.$('embed').remove();if(_clappr.Browser.isLegacyIE){this.$el.attr('classid',IE_CLASSID);}}else if(_clappr.Browser.isFirefox){this._setupFirefox();}this.el.id = this.cid;var style=_clappr.Styler.getStyleFor(_rawSassPublicFlashScss2['default']);this.$el.append(style);return this;}},{key:'_checkState',value:function _checkState(){_get(Object.getPrototypeOf(RTMP.prototype),'_checkState',this).call(this);if(this.el.getState() === \"PLAYING\"){this.trigger(_clappr.Events.PLAYBACK_PLAY,this.name);}else if(this.el.getState() === \"ERROR\"){this.trigger(_clappr.Events.PLAYBACK_ERROR,this.name);}}},{key:'_playbackReady',value:function _playbackReady(){this._isReadyState = true;this.trigger(_clappr.Events.PLAYBACK_READY,this.name);}},{key:'_reporLevels',value:function _reporLevels(){if(this.isDynamicStream){if(this.levels){if(this.options.rtmpConfig.autoSwitch === true){this.trigger(_clappr.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,-1);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}else {this.trigger(_clappr.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels,this.options.rtmpConfig.startLevel);}}}}},{key:'swfPath',get:function get(){return this.options.rtmpConfig.swfPath;}},{key:'currentLevel',get:function get(){if(this._isReadyState){return this.el.getCurrentLevel();}return undefined;},set:function set(level){this.el.setLevel(level);if(level === -1 && level !== this.currentLevel){this.trigger(_clappr.Events.PLAYBACK_LEVEL_SWITCH_END);this.trigger(_clappr.Events.PLAYBACK_BITRATE,{level:this.currentLevel});}}},{key:'numLevels',get:function get(){if(this._isReadyState){return this.el.getNumLevels();}return undefined;}},{key:'autoSwitchLevels',get:function get(){return this.el.isAutoSwitchLevels();}},{key:'levels',get:function get(){var levels=[];for(var i=0;i < this.numLevels;i++) {var bitrate=this.el.getBitrateForLevel(i);levels.push({id:i,label:bitrate + \"Kbps\"});}return levels;}},{key:'isDynamicStream',get:function get(){return this.el.isDynamicStream();}},{key:'_switchRulesJSON',get:function get(){if(this.options.rtmpConfig.switchRules !== undefined){return JSON.stringify(this.options.rtmpConfig.switchRules).replace(/\"/g,'"');}return \"\";}}]);return RTMP;})(_clappr.Flash);exports['default'] = RTMP;RTMP.canPlay = function(source){return !!((source.indexOf('rtmp://') > -1 || source.indexOf('rtmps://') > -1 || source.indexOf('.smil') > -1) && _clappr.Browser.hasFlash);};RTMP.debug = function(s){return console.log(s);};module.exports = exports['default'];\n\n/***/ },\n/* 2 */\n/*!*************************!*\\\n !*** external \"Clappr\" ***!\n \\*************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n/***/ },\n/* 3 */\n/*!***************************!*\\\n !*** ./public/flash.html ***!\n \\***************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = \"?inline=1\\\">\\n\\n\\n\\n\\n\\n\\n\\\">\\n\\n&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>&switchRules=<%= switchRules %>\\\"/>\\n\\\"\\n type=\\\"application/x-shockwave-flash\\\"\\n disabled=\\\"disabled\\\"\\n tabindex=\\\"-1\\\"\\n enablecontextmenu=\\\"false\\\"\\n allowScriptAccess=\\\"always\\\"\\n allownetworking=\\\"all\\\"\\n quality=\\\"autohigh\\\"\\n pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\"\\n wmode=\\\"<%= wmode %>\\\"\\n swliveconnect=\\\"true\\\"\\n allowfullscreen=\\\"false\\\"\\n bgcolor=\\\"#000000\\\"\\n FlashVars=\\\"playbackId=<%= playbackId %>&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>&switchRules=<%= switchRules %>\\\"\\n src=\\\"<%= swfPath %>\\\"\\n width=\\\"100%\\\"\\n height=\\\"100%\\\">\\n\\n\";\n\n/***/ },\n/* 4 */\n/*!**********************************************************!*\\\n !*** ./~/raw-loader!./~/sass-loader!./public/flash.scss ***!\n \\**********************************************************/\n/***/ function(module, exports) {\n\n\tmodule.exports = \".clappr-flash-playback[data-flash-playback]{display:block;position:absolute;top:0;left:0;height:100%;width:100%;pointer-events:none}\\n\"\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** rtmp.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 9dd426dd1dd6acb98627\n **/","export default require('./src/main.js')\n\n\n\n/** WEBPACK FOOTER **\n ** ./index.js\n **/","// Copyright 2014 Globo.com Player authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\nimport {Browser, Events, Flash, Mediator, Styler, UICorePlugin, template} from 'clappr'\n\nimport flashHTML from '../public/flash.html'\nimport flashStyle from '!raw!sass!../public/flash.scss'\n\nexport default class RTMP extends Flash {\n get name() { return 'rtmp' }\n get tagName() { return 'object' }\n get template() { return template(flashHTML) }\n get attributes() {\n return {\n 'data-rtmp': '',\n 'type': 'application/x-shockwave-flash',\n 'width': '100%',\n 'height': '100%'\n }\n }\n\n constructor(options) {\n super(options)\n this.options.rtmpConfig = this.options.rtmpConfig || {}\n this.options.rtmpConfig.swfPath = this.options.rtmpConfig.swfPath || '//cdn.jsdelivr.net/clappr.rtmp/latest/assets/RTMP.swf'\n this.options.rtmpConfig.wmode = this.options.rtmpConfig.wmode || 'transparent' // Default to transparent wmode - IE always uses gpu as per objectIE\n this.options.rtmpConfig.bufferTime = this.options.rtmpConfig.bufferTime === undefined ? 0.1 : this.options.rtmpConfig.bufferTime\n this.options.rtmpConfig.scaling = this.options.rtmpConfig.scaling || 'letterbox'\n this.options.rtmpConfig.playbackType = this.options.rtmpConfig.playbackType || this.options.src.indexOf('live') > -1\n this.options.rtmpConfig.useAppInstance = this.options.rtmpConfig.useAppInstance === undefined ? false : this.options.rtmpConfig.useAppInstance\n this.options.rtmpConfig.proxyType = this.options.rtmpConfig.proxyType || 'none'\n this.options.rtmpConfig.startLevel = this.options.rtmpConfig.startLevel === undefined ? -1 : this.options.rtmpConfig.startLevel\n this.options.rtmpConfig.autoSwitch = this.options.rtmpConfig.autoSwitch === undefined ? false : this.options.rtmpConfig.autoSwitch\n this.options.rtmpConfig.switchRules = this.options.rtmpConfig.switchRules;\n\n this.addListeners()\n this._setupPlaybackType()\n }\n\n getPlaybackType() {\n return this._playbackType\n }\n\n get swfPath() {\n return this.options.rtmpConfig.swfPath\n }\n\n get currentLevel() {\n if (this._isReadyState) {\n return this.el.getCurrentLevel();\n }\n\n return undefined;\n }\n\n get numLevels() {\n if (this._isReadyState) {\n return this.el.getNumLevels();\n }\n\n return undefined;\n }\n\n\n set currentLevel(level) {\n this.el.setLevel(level);\n\n if (level === -1 && level !== this.currentLevel) {\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_END)\n this.trigger(Events.PLAYBACK_BITRATE, {level: this.currentLevel})\n }\n }\n\n get autoSwitchLevels() {\n return this.el.isAutoSwitchLevels();\n }\n\n get levels() {\n var levels = [];\n\n for (var i = 0; i < this.numLevels; i++) {\n var bitrate = this.el.getBitrateForLevel(i);\n\n levels.push({\n id: i,\n label: bitrate + \"Kbps\"\n });\n }\n\n return levels;\n }\n\n get isDynamicStream() {\n return this.el.isDynamicStream();\n }\n\n addListeners() {\n Mediator.on(this.uniqueId + ':progress', this._progress, this)\n Mediator.on(this.uniqueId + ':timeupdate', this._updateTime, this)\n Mediator.on(this.uniqueId + ':statechanged', this._checkState, this)\n Mediator.on(this.uniqueId + ':playbackready', this._playbackReady, this)\n Mediator.on(this.uniqueId + ':onloaded', this._reporLevels, this)\n Mediator.on(this.uniqueId + ':levelChanging', this._levelChanging, this)\n Mediator.on(this.uniqueId + ':levelChanged', this._levelChange, this)\n Mediator.on(this.uniqueId + ':flashready', this._bootstrap, this)\n }\n\n stopListening() {\n super.stopListening()\n Mediator.off(this.uniqueId + ':progress')\n Mediator.off(this.uniqueId + ':timeupdate')\n Mediator.off(this.uniqueId + ':statechanged')\n Mediator.off(this.uniqueId + ':flashready')\n }\n\n _bootstrap() {\n this.el.width = '100%'\n this.el.height = '100%'\n this.options.autoPlay && this.play()\n this._setupSettings()\n }\n\n _updateTime() {\n if (this.getPlaybackType() === 'live') {\n this.trigger(Events.PLAYBACK_TIMEUPDATE, {current: 1, total: 1}, this.name)\n } else {\n this.trigger(Events.PLAYBACK_TIMEUPDATE, {current: this.el.getPosition(), total: this.el.getDuration()}, this.name)\n }\n }\n\n _levelChanging() {\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_START)\n }\n\n _levelChange() {\n this.trigger(Events.PLAYBACK_LEVEL_SWITCH_END)\n this.trigger(Events.PLAYBACK_BITRATE, {level: this.currentLevel})\n }\n\n findLevelBy(id) {\n var foundLevel\n this.levels.forEach((level) => { if (level.id === id) {foundLevel = level} })\n return foundLevel\n }\n\n _setupPlaybackType() {\n this._playbackType = this.options.rtmpConfig.playbackType\n }\n\n _setupSettings() {\n if (this.getPlaybackType() === 'live') {\n this.settings.left = [\"playpause\"]\n this.settings.right = [\"fullscreen\", \"volume\"]\n this.settings.seekEnabled = false\n }\n else {\n this.settings.left = [\"playpause\", \"position\", \"duration\"]\n this.settings.right = [\"fullscreen\", \"volume\"]\n }\n\n this.trigger(Events.PLAYBACK_SETTINGSUPDATE, this.name)\n }\n\n get _switchRulesJSON() {\n if (this.options.rtmpConfig.switchRules !== undefined) {\n return JSON.stringify(this.options.rtmpConfig.switchRules).replace(/\"/g, '"')\n }\n\n return \"\";\n }\n\n render() {\n this.$el.html(this.template({\n cid: this.cid,\n swfPath: this.swfPath,\n playbackId: this.uniqueId,\n wmode: this.options.rtmpConfig.wmode,\n scaling: this.options.rtmpConfig.scaling,\n bufferTime: this.options.rtmpConfig.bufferTime,\n playbackType: this.options.rtmpConfig.playbackType,\n startLevel: this.options.rtmpConfig.startLevel,\n autoSwitch: this.options.rtmpConfig.autoSwitch,\n switchRules: this._switchRulesJSON,\n useAppInstance: this.options.rtmpConfig.useAppInstance,\n proxyType: this.options.rtmpConfig.proxyType\n }))\n\n if (Browser.isIE) {\n this.$('embed').remove()\n if (Browser.isLegacyIE) {\n this.$el.attr('classid', IE_CLASSID)\n }\n } else if (Browser.isFirefox) {\n this._setupFirefox()\n }\n this.el.id = this.cid\n var style = Styler.getStyleFor(flashStyle)\n this.$el.append(style)\n return this\n }\n\n _checkState() {\n super._checkState()\n\n if (this.el.getState() === \"PLAYING\") {\n this.trigger(Events.PLAYBACK_PLAY, this.name)\n } else if (this.el.getState() === \"ERROR\") {\n this.trigger(Events.PLAYBACK_ERROR, this.name)\n }\n }\n\n _playbackReady() {\n this._isReadyState = true\n this.trigger(Events.PLAYBACK_READY, this.name)\n }\n\n _reporLevels() {\n if (this.isDynamicStream) {\n if (this.levels) {\n if (this.options.rtmpConfig.autoSwitch === true) {\n this.trigger(Events.PLAYBACK_LEVELS_AVAILABLE, this.levels, -1)\n this.trigger(Events.PLAYBACK_BITRATE, {level: this.currentLevel})\n } else {\n this.trigger(Events.PLAYBACK_LEVELS_AVAILABLE, this.levels, this.options.rtmpConfig.startLevel)\n }\n }\n }\n }\n}\n\nRTMP.canPlay = function (source) {\n return !!((source.indexOf('rtmp://') > -1 || source.indexOf('rtmps://') > -1 || source.indexOf('.smil') > -1) && Browser.hasFlash)\n};\n\nRTMP.debug = s => console.log(s)\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/main.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"Clappr\"\n ** module id = 2\n ** module chunks = 0\n **/","module.exports = \"?inline=1\\\">\\n\\n\\n\\n\\n\\n\\n\\\">\\n\\n&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>&switchRules=<%= switchRules %>\\\"/>\\n\\\"\\n type=\\\"application/x-shockwave-flash\\\"\\n disabled=\\\"disabled\\\"\\n tabindex=\\\"-1\\\"\\n enablecontextmenu=\\\"false\\\"\\n allowScriptAccess=\\\"always\\\"\\n allownetworking=\\\"all\\\"\\n quality=\\\"autohigh\\\"\\n pluginspage=\\\"http://www.macromedia.com/go/getflashplayer\\\"\\n wmode=\\\"<%= wmode %>\\\"\\n swliveconnect=\\\"true\\\"\\n allowfullscreen=\\\"false\\\"\\n bgcolor=\\\"#000000\\\"\\n FlashVars=\\\"playbackId=<%= playbackId %>&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>&switchRules=<%= switchRules %>\\\"\\n src=\\\"<%= swfPath %>\\\"\\n width=\\\"100%\\\"\\n height=\\\"100%\\\">\\n\\n\";\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./public/flash.html\n ** module id = 3\n ** module chunks = 0\n **/","module.exports = \".clappr-flash-playback[data-flash-playback]{display:block;position:absolute;top:0;left:0;height:100%;width:100%;pointer-events:none}\\n\"\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./~/sass-loader!./public/flash.scss\n ** module id = 4\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/package.json b/package.json index b14c81c..42edb0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clappr-rtmp", - "version": "0.0.18", + "version": "0.0.19", "description": "RTMP Support for Clappr Player", "main": "dist/rtmp.js", "author": "Flávio Ribeiro", diff --git a/public/RTMP.swf b/public/RTMP.swf index 0b97031..d799bad 100644 Binary files a/public/RTMP.swf and b/public/RTMP.swf differ diff --git a/public/flash.html b/public/flash.html index 7a31486..fc0370e 100644 --- a/public/flash.html +++ b/public/flash.html @@ -7,7 +7,7 @@ - + diff --git a/src/OSMF.swc b/src/OSMF.swc index e19c1ce..87e55eb 100644 Binary files a/src/OSMF.swc and b/src/OSMF.swc differ diff --git a/src/RTMP.as b/src/RTMP.as index fec5a36..e74bb14 100644 --- a/src/RTMP.as +++ b/src/RTMP.as @@ -196,14 +196,17 @@ package { private function playerPlay(url:String=null):void { try { if (!mediaElement) { - if (isLive) { - urlResource = new StreamingURLResource(url, StreamType.LIVE, NaN, NaN, null, useAppInstance, null, proxyType); - } else { - urlResource = new StreamingURLResource(url, StreamType.RECORDED, NaN, NaN, null, useAppInstance, null, proxyType); - } + var streamType:String = (isLive ? StreamType.LIVE : StreamType.RECORDED); + + urlResource = new StreamingURLResource(url, streamType, NaN, NaN, null, useAppInstance, null, proxyType); var startLevel:int = int(this.root.loaderInfo.parameters.startLevel); + if (this.root.loaderInfo.parameters.switchRules != "") { + var switchRules:Object = JSON.parse(this.root.loaderInfo.parameters.switchRules.replace(/"e;/g, '"')); + urlResource.addMetadataValue(MetadataNamespaces.RESOURCE_INITIAL_SWITCH_RULES, switchRules); + } + if (startLevel > -1) { urlResource.addMetadataValue(MetadataNamespaces.RESOURCE_INITIAL_INDEX, startLevel); } @@ -245,6 +248,8 @@ package { mediaPlayer.play(); } } catch (err:Error) { + debugLog('Catch error: ' + err.messsage); + playbackState = "ERROR"; _triggerEvent('statechanged'); } diff --git a/src/SMILPlugin.swc b/src/SMILPlugin.swc index 9abd22d..3960bf9 100644 Binary files a/src/SMILPlugin.swc and b/src/SMILPlugin.swc differ diff --git a/src/main.js b/src/main.js index 396ae26..8ed8acf 100644 --- a/src/main.js +++ b/src/main.js @@ -32,6 +32,8 @@ export default class RTMP extends Flash { this.options.rtmpConfig.proxyType = this.options.rtmpConfig.proxyType || 'none' this.options.rtmpConfig.startLevel = this.options.rtmpConfig.startLevel === undefined ? -1 : this.options.rtmpConfig.startLevel this.options.rtmpConfig.autoSwitch = this.options.rtmpConfig.autoSwitch === undefined ? false : this.options.rtmpConfig.autoSwitch + this.options.rtmpConfig.switchRules = this.options.rtmpConfig.switchRules; + this.addListeners() this._setupPlaybackType() } @@ -160,6 +162,14 @@ export default class RTMP extends Flash { this.trigger(Events.PLAYBACK_SETTINGSUPDATE, this.name) } + get _switchRulesJSON() { + if (this.options.rtmpConfig.switchRules !== undefined) { + return JSON.stringify(this.options.rtmpConfig.switchRules).replace(/"/g, '"') + } + + return ""; + } + render() { this.$el.html(this.template({ cid: this.cid, @@ -171,6 +181,7 @@ export default class RTMP extends Flash { playbackType: this.options.rtmpConfig.playbackType, startLevel: this.options.rtmpConfig.startLevel, autoSwitch: this.options.rtmpConfig.autoSwitch, + switchRules: this._switchRulesJSON, useAppInstance: this.options.rtmpConfig.useAppInstance, proxyType: this.options.rtmpConfig.proxyType }))