You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
9.1 KiB
2 lines
9.1 KiB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("Clappr")):"function"==typeof define&&define.amd?define(["Clappr"],e):"object"==typeof exports?exports.RTMP=e(require("Clappr")):t.RTMP=e(t.Clappr)}(this,function(t){return function(t){function e(s){if(i[s])return i[s].exports;var n=i[s]={exports:{},id:s,loaded:!1};return t[s].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(1),t.exports=e.default},function(t,e,i){"use strict";function s(t){return t&&t.__esModule?t:{default:t}}function n(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<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(e,i,s){return i&&t(e.prototype,i),s&&t(e,s),e}}(),r=function(t,e,i){for(var s=!0;s;){var n=t,o=e,a=i;s=!1,null===n&&(n=Function.prototype);var r=Object.getOwnPropertyDescriptor(n,o);if(void 0!==r){if("value"in r)return r.value;var l=r.get;if(void 0===l)return;return l.call(a)}var p=Object.getPrototypeOf(n);if(null===p)return;t=p,e=o,i=a,s=!0,r=p=void 0}},l=i(2),p=i(3),u=s(p),h=i(4),c=s(h),f=function(t){function e(t){n(this,e),r(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,t),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",this.options.rtmpConfig.bufferTime=void 0===this.options.rtmpConfig.bufferTime?.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=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),"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<this.numLevels;e++){var i=this.el.getBitrateForLevel(e);t.push({id:e,label:i+"Kbps"})}return t}},{key:"isDynamicStream",get:function(){return this.el.isDynamicStream()}},{key:"_switchRulesJSON",get:function(){return void 0!==this.options.rtmpConfig.switchRules?JSON.stringify(this.options.rtmpConfig.switchRules).replace(/"/g,"""):""}}]),e}(l.Flash);e.default=f,f.canPlay=function(t){return!(!(t.indexOf("rtmp://")>-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(e,i){e.exports=t},function(t,e){t.exports='<param name=movie value="<%= swfPath %>?inline=1"><param name=quality value=autohigh><param name=swliveconnect value=true><param name=allowScriptAccess value=always><param name=allownetworking value=all><param name=bgcolor value=#000000><param name=allowFullScreen value=false><param name=wmode value="<%= wmode %>"><param name=tabindex value=1><param name=FlashVars value="playbackId=<%= playbackId %>&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>&switchRules=<%= switchRules %>"><embed name="<%= cid %>" type=application/x-shockwave-flash disabled tabindex=-1 enablecontextmenu=false allowscriptaccess=always allownetworking=all quality=autohigh pluginspage=http://www.macromedia.com/go/getflashplayer wmode="<%= wmode %>" swliveconnect=true allowfullscreen bgcolor=#000000 flashvars="playbackId=<%= playbackId %>&scaling=<%= scaling %>&bufferTime=<%= bufferTime %>&playbackType=<%= playbackType %>&startLevel=<%= startLevel %>&useAppInstance=<%= useAppInstance %>&proxyType=<%= proxyType %>&autoSwitch=<%= autoSwitch %>&switchRules=<%= switchRules %>" src="<%= swfPath %>" width=100% height=100%>'},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"}])});
|
|
//# sourceMappingURL=rtmp.min.js.map
|