This commit is contained in:
zhouliujun 2019-12-13 09:49:25 +08:00
parent a0da3f5577
commit 5606241831
3 changed files with 75 additions and 37 deletions

View File

@ -127,12 +127,12 @@ if (typeof window !== 'undefined') {
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.function.name.js // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.function.name.js
var es6_function_name = __webpack_require__("7cfd"); var es6_function_name = __webpack_require__("7cfd");
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"05d0d90a-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=template&id=c72078bc& // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"05d0d90a-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=template&id=2be8a9a5&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":_vm.id}})} var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":_vm.id}})}
var staticRenderFns = [] var staticRenderFns = []
// CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue?vue&type=template&id=c72078bc& // CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue?vue&type=template&id=2be8a9a5&
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=script&lang=js& // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=script&lang=js&
// //
@ -153,6 +153,18 @@ var staticRenderFns = []
required: false, required: false,
type: [String], type: [String],
default: "player-".concat(Date.parse(new Date())) default: "player-".concat(Date.parse(new Date()))
},
cssLink: {
//css版本源
required: false,
type: [String],
default: "https://g.alicdn.com/de/prismplayer/2.8.2/skins/default/aliplayer-min.css"
},
scriptSrc: {
//js版本源
required: false,
type: [String],
default: "https://g.alicdn.com/de/prismplayer/2.8.2/aliplayer-min.js"
} }
}, },
data: function data() { data: function data() {
@ -163,12 +175,10 @@ var staticRenderFns = []
id: null, id: null,
//播放器的ID //播放器的ID
width: '100%', width: '100%',
autoplay: true, autoplay: true // isLive: true,
// isLive: true,
//支持播放地址播放,此播放优先级最高 //支持播放地址播放,此播放优先级最高
// source: 'rtmp://182.145.195.238:1935/hls/1194076936807170050', // source: 'rtmp://182.145.195.238:1935/hls/1194076936807170050',
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: [ events: [
/** /**
@ -282,19 +292,21 @@ var staticRenderFns = []
var linkIDTag = document.getElementById(linkID); var linkIDTag = document.getElementById(linkID);
if (!linkIDTag) { if (!linkIDTag) {
// console.log('linkIDTag');
var link = document.createElement('link'); var link = document.createElement('link');
link.type = 'text/css'; link.type = 'text/css';
link.rel = 'stylesheet'; link.rel = 'stylesheet';
link.href = this.config.cssLink; link.href = this.cssLink;
link.setAttribute('id', linkID); link.id = linkID;
head[0].appendChild(link); head[0].appendChild(link);
} }
if (!scriptTag) { if (!scriptTag) {
// console.log('scriptTag');
scriptTag = document.createElement('script'); scriptTag = document.createElement('script');
scriptTag.type = "text/javascript"; scriptTag.type = "text/javascript";
scriptTag.id = scriptID; scriptTag.id = scriptID;
scriptTag.src = this.config.scriptSrc; scriptTag.src = this.scriptSrc;
html[0].appendChild(scriptTag); html[0].appendChild(scriptTag);
} }
@ -314,6 +326,7 @@ var staticRenderFns = []
initPlayer: function initPlayer() { initPlayer: function initPlayer() {
var _this4 = this; var _this4 = this;
// console.log(`this.player`,this.player);
if (typeof window.Aliplayer != 'undefined') { if (typeof window.Aliplayer != 'undefined') {
var options = this.options; var options = this.options;
@ -327,17 +340,23 @@ var staticRenderFns = []
// // console.log('播放器创建好了',player); // // console.log('播放器创建好了',player);
// }); // });
this.player = new Aliplayer(this.config); if (!this.player) {
// console.log(this.config);
this.player = new Aliplayer(this.config);
var _loop = function _loop(ev) { var _loop = function _loop(ev) {
_this4.player.on(_this4.events[ev], function (e) { _this4.player.on(_this4.events[ev], function (e) {
// console.log(`object ${this.events[ev]}`,e); // console.log(`object ${this.events[ev]}`,e);
_this4.$emit(_this4.events[ev], e); _this4.$emit(_this4.events[ev], e);
}); });
}; };
for (var ev in this.events) { for (var ev in this.events) {
_loop(ev); _loop(ev);
}
} else {
this.player.replay(); //销毁后重播
// console.log(`this.player.replay()`,'销毁后重播');
} //通过播放器实例的off方法取消订阅 } //通过播放器实例的off方法取消订阅
//player.off('ready',handleReady); //player.off('ready',handleReady);

View File

@ -136,12 +136,12 @@ if (typeof window !== 'undefined') {
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.function.name.js // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.function.name.js
var es6_function_name = __webpack_require__("7cfd"); var es6_function_name = __webpack_require__("7cfd");
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"05d0d90a-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=template&id=c72078bc& // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"05d0d90a-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=template&id=2be8a9a5&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":_vm.id}})} var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":_vm.id}})}
var staticRenderFns = [] var staticRenderFns = []
// CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue?vue&type=template&id=c72078bc& // CONCATENATED MODULE: ./packages/AliplayerV2/src/main.vue?vue&type=template&id=2be8a9a5&
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=script&lang=js& // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/AliplayerV2/src/main.vue?vue&type=script&lang=js&
// //
@ -162,6 +162,18 @@ var staticRenderFns = []
required: false, required: false,
type: [String], type: [String],
default: "player-".concat(Date.parse(new Date())) default: "player-".concat(Date.parse(new Date()))
},
cssLink: {
//css版本源
required: false,
type: [String],
default: "https://g.alicdn.com/de/prismplayer/2.8.2/skins/default/aliplayer-min.css"
},
scriptSrc: {
//js版本源
required: false,
type: [String],
default: "https://g.alicdn.com/de/prismplayer/2.8.2/aliplayer-min.js"
} }
}, },
data: function data() { data: function data() {
@ -172,12 +184,10 @@ var staticRenderFns = []
id: null, id: null,
//播放器的ID //播放器的ID
width: '100%', width: '100%',
autoplay: true, autoplay: true // isLive: true,
// isLive: true,
//支持播放地址播放,此播放优先级最高 //支持播放地址播放,此播放优先级最高
// source: 'rtmp://182.145.195.238:1935/hls/1194076936807170050', // source: 'rtmp://182.145.195.238:1935/hls/1194076936807170050',
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: [ events: [
/** /**
@ -291,19 +301,21 @@ var staticRenderFns = []
var linkIDTag = document.getElementById(linkID); var linkIDTag = document.getElementById(linkID);
if (!linkIDTag) { if (!linkIDTag) {
// console.log('linkIDTag');
var link = document.createElement('link'); var link = document.createElement('link');
link.type = 'text/css'; link.type = 'text/css';
link.rel = 'stylesheet'; link.rel = 'stylesheet';
link.href = this.config.cssLink; link.href = this.cssLink;
link.setAttribute('id', linkID); link.id = linkID;
head[0].appendChild(link); head[0].appendChild(link);
} }
if (!scriptTag) { if (!scriptTag) {
// console.log('scriptTag');
scriptTag = document.createElement('script'); scriptTag = document.createElement('script');
scriptTag.type = "text/javascript"; scriptTag.type = "text/javascript";
scriptTag.id = scriptID; scriptTag.id = scriptID;
scriptTag.src = this.config.scriptSrc; scriptTag.src = this.scriptSrc;
html[0].appendChild(scriptTag); html[0].appendChild(scriptTag);
} }
@ -323,6 +335,7 @@ var staticRenderFns = []
initPlayer: function initPlayer() { initPlayer: function initPlayer() {
var _this4 = this; var _this4 = this;
// console.log(`this.player`,this.player);
if (typeof window.Aliplayer != 'undefined') { if (typeof window.Aliplayer != 'undefined') {
var options = this.options; var options = this.options;
@ -336,17 +349,23 @@ var staticRenderFns = []
// // console.log('播放器创建好了',player); // // console.log('播放器创建好了',player);
// }); // });
this.player = new Aliplayer(this.config); if (!this.player) {
// console.log(this.config);
this.player = new Aliplayer(this.config);
var _loop = function _loop(ev) { var _loop = function _loop(ev) {
_this4.player.on(_this4.events[ev], function (e) { _this4.player.on(_this4.events[ev], function (e) {
// console.log(`object ${this.events[ev]}`,e); // console.log(`object ${this.events[ev]}`,e);
_this4.$emit(_this4.events[ev], e); _this4.$emit(_this4.events[ev], e);
}); });
}; };
for (var ev in this.events) { for (var ev in this.events) {
_loop(ev); _loop(ev);
}
} else {
this.player.replay(); //销毁后重播
// console.log(`this.player.replay()`,'销毁后重播');
} //通过播放器实例的off方法取消订阅 } //通过播放器实例的off方法取消订阅
//player.off('ready',handleReady); //player.off('ready',handleReady);

File diff suppressed because one or more lines are too long