mirror of
https://github.com/langyuxiansheng/vue-aliplayer-v2.git
synced 2025-04-06 03:57:55 +08:00
2 lines
9.8 KiB
JavaScript
2 lines
9.8 KiB
JavaScript
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-aliplayer-v2"]=t():e["vue-aliplayer-v2"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="112a")}({"0cc1":function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},"112a":function(e,t,n){"use strict";var r;(n.r(t),"undefined"!==typeof window)&&(n("e67d"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=r[1]));n("7cfd");var o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:e.id}})},i=[],c={name:"VueAliplayerV2",props:{options:{required:!1,type:[Object],default:function(){return null}},id:{required:!1,type:[String],default:"player-".concat(Date.parse(new Date))}},data:function(){return{player:null,config:{id:null,width:"100%",autoplay:!0,cssLink:"https://g.alicdn.com/de/prismplayer/2.8.2/skins/default/aliplayer-min.css",scriptSrc:"https://g.alicdn.com/de/prismplayer/2.8.2/aliplayer-min.js"},events:["ready","play","pause","canplay","playing","ended","liveStreamStop","onM3u8Retry","hideBar","showBar","waiting","timeupdate","snapshoted","requestFullScreen","cancelFullScreen","error","startSeek","completeSeek"]}},mounted:function(){var e=this;this.$nextTick((function(){e.init()}))},methods:{init:function(){var e=this,t=!0,n="aliplayer-min-css",r="aliplayer-min-js",o=document.getElementsByTagName("head"),i=document.getElementsByTagName("html"),c=document.getElementById(r);if(!document.getElementById(n)){var l=document.createElement("link");l.href=this.config.cssLink,l.setAttribute("id",n),o[0].appendChild(l)}c||(c=document.createElement("script"),c.id=r,c.type="text/javascript",c.src=this.config.scriptSrc,i[0].appendChild(c)),c.addEventListener("load",(function(){e.initPlayer(),t=!1})),t||this.initPlayer()},initPlayer:function(){var e=this;if("undefined"!=typeof window.Aliplayer){var t=this.options;if(t)for(var n in t)this.config[n]=t[n];this.config.id=this.id,this.player=new Aliplayer(this.config,(function(e){console.log("播放器创建好了。",e)}));var r=function(t){e.player.on(e.events[t],(function(n){console.log("object ".concat(e.events[t]),n),e.$emit(e.events[t],n)}))};for(var o in this.events)r(o)}},getPlayer:function(){return this.player},play:function(){console.log("播放视频。"),this.player.play()},pause:function(){console.log("暂停视频"),this.player.pause()},replay:function(){console.log("重播视频"),this.player.replay()},seek:function(e){console.log("跳转到某个时刻进行播放,time为".concat(e,"秒。")),this.player.seek(e)},getCurrentTime:function(){return console.log("获取当前的播放时刻,返回的单位为".concat(this.player.getCurrentTime(),"秒。")),this.player.getCurrentTime()},getDuration:function(){return console.log("获取视频总时长,返回的单位为".concat(this.player.getDuration(),"秒。")),this.player.getDuration()},getVolume:function(){return console.log("获取当前的音量".concat(this.player.getVolume(),"。")),this.player.getVolume()},setVolume:function(e){console.log("设置音量,vol为".concat(e,"。")),this.player.setVolume(e)},loadByUrl:function(e,t){console.log("直接播放视频url".concat(e,",time为").concat(t,"。")),this.player.loadByUrl(e,t)},replayByVidAndPlayAuth:function(e,t){console.log("replayByVidAndPlayAuth vid".concat(e,",playauth为").concat(t,"。")),this.player.replayByVidAndPlayAuth(e,t)},replayByVidAndAuthInfo:function(e,t,n,r,o,i){console.log("replayByVidAndAuthInfo 参数顺序为:vid、accId、accSecret、stsToken、authInfo、domainRegion",e,t,n,r,o,i),this.player.replayByVidAndAuthInfo(e,t,n,r,o,i)},setPlayerSize:function(e,t){console.log("设置播放器大小 宽度:".concat(e,",高度:").concat(t)),this.player.setPlayerSize(e,t)},setSpeed:function(e){console.log("手动设置播放的倍速:".concat(e)),this.player.setSpeed(e)},setSanpshotProperties:function(e,t,n){console.log("设置截图参数:",e,t,n),this.player.setSanpshotProperties(e,t,n)},requestFullScreen:function(){console.log("播放器全屏,仅H5支持"),this.player.fullscreenService&&this.player.fullscreenService.requestFullScreen()},cancelFullScreen:function(){console.log("播放器全屏,仅H5支持"),this.player.fullscreenService&&this.player.fullscreenService.cancelFullScreen()},getIsFullScreen:function(){return console.log("获取播放器全屏状态,仅H5支持。",this.player.fullscreenService&&this.player.fullscreenService.getIsFullScreen()),this.player.fullscreenService&&this.player.fullscreenService.getIsFullScreen()},getStatus:function(){return console.log("获取播放器状态,包含的值",this.player.fullscreenService&&this.player.fullscreenService.getStatus()),this.player.fullscreenService&&this.player.fullscreenService.getStatus()},setLiveTimeRange:function(e,t){console.log("设置直播的开始时间:".concat(e,",结束时间:").concat(t,",开启直播时移功能时使用。")),this.player.liveShiftSerivce&&this.player.liveShiftSerivce.setLiveTimeRange(e,t)},setRotate:function(e){console.log("参数为旋转角度:".concat(e,"。")),this.player.setRotate(e)},getRotate:function(){return console.log("获取旋转角度:".concat(this.player.getRotate())),this.player.getRotate()},setImage:function(e){console.log("设置镜像:".concat(e,"。")),this.player.setImage(e)},dispose:function(){console.log("播放器销毁。"),this.player.dispose()},setCover:function(e){console.log("设置封面:".concat(e)),this.player.setCover(e)},setProgressMarkers:function(e){console.log("markers打点数据集合:".concat(e)),this.player.setProgressMarkers(e)},setPreviewTime:function(e){console.log("设置试看时间,单位为:".concat(e,"秒")),this.player.setPreviewTime(e)},getPreviewTime:function(){return console.log("获取试看时间:".concat(this.player.getPreviewTime())),this.player.getPreviewTime()},isPreview:function(){console.log("是否试看"),this.player.isPreview()}}},l=c;function a(e,t,n,r,o,i,c,l){var a,s="function"===typeof e?e.options:e;if(t&&(s.render=t,s.staticRenderFns=n,s._compiled=!0),r&&(s.functional=!0),i&&(s._scopeId="data-v-"+i),c?(a=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(c)},s._ssrRegister=a):o&&(a=l?function(){o.call(this,this.$root.$options.shadowRoot)}:o),a)if(s.functional){s._injectStyles=a;var u=s.render;s.render=function(e,t){return a.call(t),u(e,t)}}else{var f=s.beforeCreate;s.beforeCreate=f?[].concat(f,a):[a]}return{exports:e,options:s}}var s=a(l,o,i,!1,null,null,null),u=s.exports;u.install=function(e){e.component(u.name,u)};var f=u,p=[f],d=function e(t){if(e.installed)return!1;e.installed=!0,p.map((function(e){return t.component(e.name,e)}))};"undefined"!==typeof window&&window.Vue&&d(window.Vue);var y={install:d,VueAliplayerV2:f};t["default"]=y},"25ae":function(e,t,n){e.exports=!n("f9a5")&&!n("0cc1")((function(){return 7!=Object.defineProperty(n("6618")("div"),"a",{get:function(){return 7}}).a}))},"2ab1":function(e,t,n){var r=n("da0b");e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},"3f8b":function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},6618:function(e,t,n){var r=n("da0b"),o=n("3f8b").document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},"7cfd":function(e,t,n){var r=n("d3d8").f,o=Function.prototype,i=/^\s*function ([^ (]*)/,c="name";c in o||n("f9a5")&&r(o,c,{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},"8cac":function(e,t,n){var r=n("da0b");e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},d3d8:function(e,t,n){var r=n("8cac"),o=n("25ae"),i=n("2ab1"),c=Object.defineProperty;t.f=n("f9a5")?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return c(e,t,n)}catch(l){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},da0b:function(e,t){e.exports=function(e){return"object"===typeof e?null!==e:"function"===typeof e}},e67d:function(e,t){(function(e){var t="currentScript",n=e.getElementsByTagName("script");t in e||Object.defineProperty(e,t,{get:function(){try{throw new Error}catch(r){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(e in n)if(n[e].src==t||"interactive"==n[e].readyState)return n[e];return null}}})})(document)},f9a5:function(e,t,n){e.exports=!n("0cc1")((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))}})}));
|
||
//# sourceMappingURL=vue-aliplayer-v2.umd.min.js.map
|