mirror of
https://github.com/langyuxiansheng/vue-aliplayer-v2.git
synced 2025-04-05 19:41:39 +08:00
2 lines
8.6 KiB
JavaScript
2 lines
8.6 KiB
JavaScript
(function(e){function t(t){for(var r,o,a=t[0],c=t[1],s=t[2],p=0,f=[];p<a.length;p++)o=a[p],Object.prototype.hasOwnProperty.call(i,o)&&i[o]&&f.push(i[o][0]),i[o]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(e[r]=c[r]);u&&u(t);while(f.length)f.shift()();return l.push.apply(l,s||[]),n()}function n(){for(var e,t=0;t<l.length;t++){for(var n=l[t],r=!0,a=1;a<n.length;a++){var c=n[a];0!==i[c]&&(r=!1)}r&&(l.splice(t--,1),e=o(o.s=n[0]))}return e}var r={},i={index:0},l=[];function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/vue-sign-canvas/";var a=window["webpackJsonp"]=window["webpackJsonp"]||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var s=0;s<a.length;s++)t(a[s]);var u=c;l.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("c31f")},2535:function(e,t,n){"use strict";var r=n("3440"),i=n.n(r);i.a},3440:function(e,t,n){},c31f:function(e,t,n){"use strict";n.r(t);n("96dd"),n("a60a"),n("e783"),n("8b1f");var r=n("6e6d"),i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"app"}},[n("vue-aliplayer-v2",{ref:"VueAliplayerV2",attrs:{id:"player-1194076936807170050",options:{source:"rtmp://182.145.195.238:1935/hls/1194076936807170053"}}}),n("vue-aliplayer-v2",{ref:"VueAliplayerV2",attrs:{id:"player-1194076936807170051",options:{source:"rtmp://182.145.195.238:1935/hls/1194076936807170051"}}}),n("button",{on:{click:function(t){return e.play()}}},[e._v("播放")]),n("button",{on:{click:function(t){return e.pause()}}},[e._v("暂停")]),n("button",{on:{click:function(t){return e.replay()}}},[e._v("重播")]),n("button",{on:{click:function(t){return e.getCurrentTime()}}},[e._v("播放时刻")])],1)},l=[],o={data:function(){return{value:null,player:null}},methods:{play:function(){this.$refs.VueAliplayerV2.play()},pause:function(){this.$refs.VueAliplayerV2.pause()},replay:function(){this.$refs.VueAliplayerV2.replay()},getCurrentTime:function(){this.$refs.VueAliplayerV2.getCurrentTime()}}},a=o,c=(n("2535"),n("4e82")),s=Object(c["a"])(a,i,l,!1,null,"d3e19be8",null),u=s.exports,p=(n("7cfd"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:e.id}})}),f=[],y={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",i=document.getElementsByTagName("head"),l=document.getElementsByTagName("html"),o=document.getElementById(r);if(!document.getElementById(n)){var a=document.createElement("link");a.href=this.config.cssLink,a.setAttribute("id",n),i[0].appendChild(a)}o||(o=document.createElement("script"),o.id=r,o.type="text/javascript",o.src=this.config.scriptSrc,l[0].appendChild(o)),o.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 i in this.events)r(i)}},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,i,l){console.log("replayByVidAndAuthInfo 参数顺序为:vid、accId、accSecret、stsToken、authInfo、domainRegion",e,t,n,r,i,l),this.player.replayByVidAndAuthInfo(e,t,n,r,i,l)},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()}}},d=y,h=Object(c["a"])(d,p,f,!1,null,null,null),g=h.exports;g.install=function(e){e.component(g.name,g)};var v=g,m=[v],S=function e(t){if(e.installed)return!1;e.installed=!0,m.map((function(e){return t.component(e.name,e)}))};"undefined"!==typeof window&&window.Vue&&S(window.Vue);var w={install:S,VueAliplayerV2:v};r["a"].use(w),r["a"].config.productionTip=!1,new r["a"]({render:function(e){return e(u)}}).$mount("#app")}});
|
||
//# sourceMappingURL=index.406eb953.js.map
|