zwplayer-vue2x 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/zwplayervue2.common.js +23 -3
- package/lib/zwplayervue2.umd.js +23 -3
- package/lib/zwplayervue2.umd.min.js +1 -1
- package/package.json +1 -1
- package/sources/index.js +77 -70
- package/sources/vueplayer/src/loadjs.js +75 -0
- package/sources/vueplayer/src/main.vue +393 -0
- package/zwplayerlib/zwplayer/css/zwplayer.css +784 -94
- package/zwplayerlib/zwplayer/css/zwplayer.ttf +0 -0
- package/zwplayerlib/zwplayer/zwplayer.js +555 -436
- package/zwplayerlib/zwplayer/css/zwplayer.woff +0 -0
- package/zwplayerlib/zwplayer/css/zwplayer.woff2 +0 -0
|
@@ -193,6 +193,12 @@ const availabe_props = {
|
|
|
193
193
|
disableVolumeControl: 'boolean',
|
|
194
194
|
lostFocusPause: 'boolean',
|
|
195
195
|
autoSmallWindow: 'boolean',
|
|
196
|
+
localPlayback: 'boolean',
|
|
197
|
+
recordButton: 'boolean',
|
|
198
|
+
segmentButton: 'boolean',
|
|
199
|
+
disableMutedConfirm: 'boolean',
|
|
200
|
+
keepAudioWindow: 'boolean',
|
|
201
|
+
lang: 'string',
|
|
196
202
|
thumbnails: 'object',
|
|
197
203
|
sendDanmu: 'function',
|
|
198
204
|
danmuBarId: 'string',
|
|
@@ -235,7 +241,7 @@ const availabe_props = {
|
|
|
235
241
|
default: true
|
|
236
242
|
}
|
|
237
243
|
},
|
|
238
|
-
emits: ['oneterror', 'onmediaevent', 'onready'],
|
|
244
|
+
emits: ['oneterror', 'onmediaevent', 'onready', 'onFileSelected', 'onFileLoaded'],
|
|
239
245
|
methods: {
|
|
240
246
|
play(url, isLive, useOldFlv) {
|
|
241
247
|
let vm = this;
|
|
@@ -393,7 +399,7 @@ const availabe_props = {
|
|
|
393
399
|
},
|
|
394
400
|
mounted() {
|
|
395
401
|
let vm = this;
|
|
396
|
-
//
|
|
402
|
+
//console.log('mounted main');
|
|
397
403
|
let zwplayer_js;
|
|
398
404
|
if (vm.zwplayerlib) zwplayer_js = vm.zwplayerlib;else zwplayer_js = zwplayer_js_def;
|
|
399
405
|
vm.rootElm = document.getElementById(vm.playerid);
|
|
@@ -406,7 +412,7 @@ const availabe_props = {
|
|
|
406
412
|
(0,loadjs/* zwplayer_loadjs */.l)('zwplayer-core', zwplayer_js, function (jsid) {
|
|
407
413
|
let url = '';
|
|
408
414
|
if (!jsid) {
|
|
409
|
-
console.log('zwplayer_loadjs failed!');
|
|
415
|
+
//console.log('zwplayer_loadjs failed!');
|
|
410
416
|
}
|
|
411
417
|
if (vm.murl) url = vm.murl;else if (vm.videoprop && typeof vm.videoprop.url !== 'undefined') url = vm.videoprop.url;
|
|
412
418
|
let videostyle = "width:100%;height:100%;";
|
|
@@ -427,6 +433,12 @@ const availabe_props = {
|
|
|
427
433
|
vm.$emit('onnetclose', this);
|
|
428
434
|
return true;
|
|
429
435
|
},
|
|
436
|
+
onFileSelected: function (event) {
|
|
437
|
+
vm.$emit('onFileSelected', event, this);
|
|
438
|
+
},
|
|
439
|
+
onFileLoaded: function (event) {
|
|
440
|
+
vm.$emit('onFileLoaded', event, this);
|
|
441
|
+
},
|
|
430
442
|
onneterror: function () {
|
|
431
443
|
vm.$emit('onneterror', this);
|
|
432
444
|
},
|
|
@@ -452,6 +464,7 @@ const availabe_props = {
|
|
|
452
464
|
else params[prop] = vm.$attrs[prop];
|
|
453
465
|
}
|
|
454
466
|
}
|
|
467
|
+
//console.log(params)
|
|
455
468
|
vm.zwplayer = new window.ZWPlayer(params);
|
|
456
469
|
if (params.danmuBarId) {
|
|
457
470
|
vm.zwplayer.buildDanmuControlbar(params.danmuBarId, 'vue-zwp-danmubar');
|
|
@@ -716,6 +729,13 @@ Player.prototype = {
|
|
|
716
729
|
vm.zwplayer.addSubtitle(subtitleUrl, pos, title);
|
|
717
730
|
}
|
|
718
731
|
},
|
|
732
|
+
loadSubtitle(subtitleUrl, pos, title) {
|
|
733
|
+
//console.log('loadSubtitle')
|
|
734
|
+
let vm = this;
|
|
735
|
+
if (vm.zwplayer) {
|
|
736
|
+
vm.zwplayer.loadSubtitle(subtitleUrl, pos, title);
|
|
737
|
+
}
|
|
738
|
+
},
|
|
719
739
|
removeSubtitle() {
|
|
720
740
|
let vm = this;
|
|
721
741
|
if (vm.zwplayer) {
|
package/lib/zwplayervue2.umd.js
CHANGED
|
@@ -203,6 +203,12 @@ const availabe_props = {
|
|
|
203
203
|
disableVolumeControl: 'boolean',
|
|
204
204
|
lostFocusPause: 'boolean',
|
|
205
205
|
autoSmallWindow: 'boolean',
|
|
206
|
+
localPlayback: 'boolean',
|
|
207
|
+
recordButton: 'boolean',
|
|
208
|
+
segmentButton: 'boolean',
|
|
209
|
+
disableMutedConfirm: 'boolean',
|
|
210
|
+
keepAudioWindow: 'boolean',
|
|
211
|
+
lang: 'string',
|
|
206
212
|
thumbnails: 'object',
|
|
207
213
|
sendDanmu: 'function',
|
|
208
214
|
danmuBarId: 'string',
|
|
@@ -245,7 +251,7 @@ const availabe_props = {
|
|
|
245
251
|
default: true
|
|
246
252
|
}
|
|
247
253
|
},
|
|
248
|
-
emits: ['oneterror', 'onmediaevent', 'onready'],
|
|
254
|
+
emits: ['oneterror', 'onmediaevent', 'onready', 'onFileSelected', 'onFileLoaded'],
|
|
249
255
|
methods: {
|
|
250
256
|
play(url, isLive, useOldFlv) {
|
|
251
257
|
let vm = this;
|
|
@@ -403,7 +409,7 @@ const availabe_props = {
|
|
|
403
409
|
},
|
|
404
410
|
mounted() {
|
|
405
411
|
let vm = this;
|
|
406
|
-
//
|
|
412
|
+
//console.log('mounted main');
|
|
407
413
|
let zwplayer_js;
|
|
408
414
|
if (vm.zwplayerlib) zwplayer_js = vm.zwplayerlib;else zwplayer_js = zwplayer_js_def;
|
|
409
415
|
vm.rootElm = document.getElementById(vm.playerid);
|
|
@@ -416,7 +422,7 @@ const availabe_props = {
|
|
|
416
422
|
(0,loadjs/* zwplayer_loadjs */.l)('zwplayer-core', zwplayer_js, function (jsid) {
|
|
417
423
|
let url = '';
|
|
418
424
|
if (!jsid) {
|
|
419
|
-
console.log('zwplayer_loadjs failed!');
|
|
425
|
+
//console.log('zwplayer_loadjs failed!');
|
|
420
426
|
}
|
|
421
427
|
if (vm.murl) url = vm.murl;else if (vm.videoprop && typeof vm.videoprop.url !== 'undefined') url = vm.videoprop.url;
|
|
422
428
|
let videostyle = "width:100%;height:100%;";
|
|
@@ -437,6 +443,12 @@ const availabe_props = {
|
|
|
437
443
|
vm.$emit('onnetclose', this);
|
|
438
444
|
return true;
|
|
439
445
|
},
|
|
446
|
+
onFileSelected: function (event) {
|
|
447
|
+
vm.$emit('onFileSelected', event, this);
|
|
448
|
+
},
|
|
449
|
+
onFileLoaded: function (event) {
|
|
450
|
+
vm.$emit('onFileLoaded', event, this);
|
|
451
|
+
},
|
|
440
452
|
onneterror: function () {
|
|
441
453
|
vm.$emit('onneterror', this);
|
|
442
454
|
},
|
|
@@ -462,6 +474,7 @@ const availabe_props = {
|
|
|
462
474
|
else params[prop] = vm.$attrs[prop];
|
|
463
475
|
}
|
|
464
476
|
}
|
|
477
|
+
//console.log(params)
|
|
465
478
|
vm.zwplayer = new window.ZWPlayer(params);
|
|
466
479
|
if (params.danmuBarId) {
|
|
467
480
|
vm.zwplayer.buildDanmuControlbar(params.danmuBarId, 'vue-zwp-danmubar');
|
|
@@ -726,6 +739,13 @@ Player.prototype = {
|
|
|
726
739
|
vm.zwplayer.addSubtitle(subtitleUrl, pos, title);
|
|
727
740
|
}
|
|
728
741
|
},
|
|
742
|
+
loadSubtitle(subtitleUrl, pos, title) {
|
|
743
|
+
//console.log('loadSubtitle')
|
|
744
|
+
let vm = this;
|
|
745
|
+
if (vm.zwplayer) {
|
|
746
|
+
vm.zwplayer.loadSubtitle(subtitleUrl, pos, title);
|
|
747
|
+
}
|
|
748
|
+
},
|
|
729
749
|
removeSubtitle() {
|
|
730
750
|
let vm = this;
|
|
731
751
|
if (vm.zwplayer) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["zwplayervue2"]=t():e["zwplayervue2"]=t()})("undefined"!==typeof self?self:this,function(){return function(){var e={421:function(e){const t=function(e,t,r){let l=document.getElementsByTagName("head");if(0==l.length){l=document.createElement("head");let e=document.getElementsByTagName("body");if(!(e.length>0))return alert("Invalid html document: no HEAD tag"),!1;e=e[0],document.insertBefore(l,e)}else{l=l[0];const t=l.childNodes;for(let l=0;l<t.length;l++){const
|
|
1
|
+
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["zwplayervue2"]=t():e["zwplayervue2"]=t()})("undefined"!==typeof self?self:this,function(){return function(){var e={421:function(e){const t=function(e,t,r){let l=document.getElementsByTagName("head");if(0==l.length){l=document.createElement("head");let e=document.getElementsByTagName("body");if(!(e.length>0))return alert("Invalid html document: no HEAD tag"),!1;e=e[0],document.insertBefore(l,e)}else{l=l[0];const t=l.childNodes;for(let l=0;l<t.length;l++){const o=t[l];if("SCRIPT"===o.nodeName.toUpperCase()&&o.id&&o.id==e){if("true"!=o.getAttribute("loadstate")){const t=function(){"true"!=o.getAttribute("loadstate")?setTimeout(t,50):"function"==typeof r&&r(e)};return setTimeout(t,50),!1}return"function"==typeof r&&r(e),!0}}}const o=document.createElement("script");return o.type="text/javascript",o.readyState?o.onreadystatechange=function(){"loaded"!=o.readyState&&"complete"!=o.readyState||(o.onreadystatechange=null,o.setAttribute("loadstate","true"),"function"==typeof r&&r(e))}:o.onload=function(){o.setAttribute("loadstate","true"),o.setAttribute("charset","utf-8"),"function"==typeof r&&r(e)},o.id=e,o.src=t,l.appendChild(o),!1};e.exports.l=t}},t={};function r(l){var o=t[l];if(void 0!==o)return o.exports;var n=t[l]={exports:{}};return e[l](n,n.exports,r),n.exports}!function(){r.d=function(e,t){for(var l in t)r.o(t,l)&&!r.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})}}(),function(){r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){r.p=""}();var l={};return function(){"use strict";if(r.r(l),r.d(l,{Player:function(){return h},default:function(){return g},zwplayer:function(){return c}}),"undefined"!==typeof window){var e=window.document.currentScript,t=e&&e.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);t&&(r.p=t[1])}var o=r(421);const n="zwplayer/zwplayer.js?v=3.6",a={isLive:"boolean",useOldFlv:"boolean",useFlv:"boolean",streamtype:"string",hasAudio:"boolean",hasVideo:"boolean",xmc_url:"string",fixedControlbar:"boolean",nativecontrols:"boolean",infoButton:"boolean",speedButton:"boolean",optionButton:"boolean",snapshotButton:"boolean",chapterButton:"boolean",enableDanmu:"boolean",useProgressTooltip:"boolean",hidePlayBtn:"boolean",disablePlayBtn:"boolean",disableSeek:"boolean",disableFullscreenWin:"boolean",disablePicInPic:"boolean",disableVolumeControl:"boolean",lostFocusPause:"boolean",autoSmallWindow:"boolean",localPlayback:"boolean",recordButton:"boolean",segmentButton:"boolean",disableMutedConfirm:"boolean",keepAudioWindow:"boolean",lang:"string",thumbnails:"object",sendDanmu:"function",danmuBarId:"string",fluid:"boolean",poster:"string",logo:"object|string",ratio:"string|number",width:"string|number",height:"string|number"};var i,s,p={name:"ZwPlayer",data(){return{zwplayer:null,nodename:"ZwPlayer"}},props:{zwplayerlib:String,murl:String,nodeid:String,muted:Boolean,autoplay:{type:Boolean,default:!0},videoprop:Object,videostyle:String,reconnect:{type:Boolean,default:!0},controlbar:{type:Boolean,default:!0},useProgressTooltip:{type:Boolean,default:!0}},emits:["oneterror","onmediaevent","onready","onFileSelected","onFileLoaded"],methods:{play(e,t,r){let l=this;e||(e=this.murl),l.zwplayer&&l.zwplayer.play(e,t,r)},stop(){let e=this;e.zwplayer&&e.zwplayer.stop()},pause(){let e=this;e.zwplayer&&e.zwplayer.pause()},resume(){let e=this;e.zwplayer&&e.zwplayer.resume()},getDuration(){let e=this;if(e.zwplayer)return e.zwplayer.getDuration()},getCurrentTime(){let e=this;if(e.zwplayer)return e.zwplayer.CurrentTime},seekTime(e){let t=this;t.zwplayer&&t.zwplayer.seekTime(e)},destroy(){let e=this;e.zwplayer&&e.zwplayer.destroy()},setplaystate(e){let t=this;t.zwplayer&&t.zwplayer.setplaystate(e)},setEnableDanmu(e){let t=this;t.zwplayer&&t.zwplayer.setEnableDanmu(e)},appendDanmu(e,t){let r=this;r.zwplayer&&r.zwplayer.appendDanmu(e,t)},setChapters(e){let t=this;t.zwplayer&&t.zwplayer.setChapters(e)},addSubtitle(e,t,r){let l=this;l.zwplayer&&l.zwplayer.addSubtitle(e,t,r)},removeSubtitle(){let e=this;e.zwplayer&&e.zwplayer.removeSubtitle()},buildDanmuControlbar(e,t){let r=this;r.zwplayer&&r.zwplayer.buildDanmuControlbar(e,t)},notifyResize(e,t){let r=this;r.zwplayer&&r.zwplayer.notifyResize(e,t)},setMute(e){let t=this;t.zwplayer&&t.zwplayer.setMuted(e)},setullscr(e){let t=this;t.zwplayer&&(t.is_fullscr=e,t.zwplayer.setFullscreen(e))}},computed:{CurrentTime:function(){let e=this;return e.zwplayer?e.zwplayer.CurrentTime:-1}},render(e){let t;if(this.nodeid)t=this.nodeid;else{let e=(new Date).getTime();window.nextZWPlayerId?window.nextZWPlayerId++:window.nextZWPlayerId=1e3,t="zwplayer-"+window.nextZWPlayerId+"-"+e}let r=e("div",{class:{"zwplayer-vue":!0},attrs:{id:t}},[]);if(r){let e=this;e.playerid=t}return this.zwplayer&&this.murl!==this.old_murl&&(this.zwplayer.play(this.murl),this.old_murl=this.murl),r},mounted(){let e,t=this;e=t.zwplayerlib?t.zwplayerlib:n,t.rootElm=document.getElementById(t.playerid),t.rootElm&&(t.rootElm.style.width="100%",t.rootElm.style.height="100%",t.rootElm.style.margin="0",t.rootElm.style.padding="0"),(0,o.l)("zwplayer-core",e,function(e){let r="";t.murl?r=t.murl:t.videoprop&&"undefined"!==typeof t.videoprop.url&&(r=t.videoprop.url);let l="width:100%;height:100%;";t.videoprop&&"undefined"!==typeof t.videoprop.videostyle&&(l=t.videoprop.videostyle);let o={url:r,playerElm:t.rootElm,videostyle:l,reconnect:t.reconnect,autoplay:t.autoplay,muted:t.muted,controlbar:t.controlbar,useProgressTooltip:t.useProgressTooltip,onready:function(){t.$emit("onready",this)},onnetclose:function(){return t.$emit("onnetclose",this),!0},onFileSelected:function(e){t.$emit("onFileSelected",e,this)},onFileLoaded:function(e){t.$emit("onFileLoaded",e,this)},onneterror:function(){t.$emit("onneterror",this)},onmediaevent:function(e){t.$emit("onmediaevent",e,this)}},n=a;const i=function(e,t){if(t.indexOf("|")>0){var r=t.split("|");for(let t=0;t<r.length;t++)if(e===r[t])return!0;return!1}return e===t};for(let a in t.$attrs){var s=typeof t.$attrs[a];a in n&&i(s,n[a])&&(o[a]="object"===s?JSON.parse(JSON.stringify(t.$attrs[a])):t.$attrs[a])}t.zwplayer=new window.ZWPlayer(o),o.danmuBarId&&t.zwplayer.buildDanmuControlbar(o.danmuBarId,"vue-zwp-danmubar"),t.old_murl=r})},beforeDestroy(){let e=this;e.zwplayer&&e.zwplayer.stop()},destroyed(){let e=this;e.zwplayer&&(e.zwplayer.destroy(),delete e.zwplayer)}},u=p;function d(e,t,r,l,o,n,a,i){var s,p="function"===typeof e?e.options:e;if(t&&(p.render=t,p.staticRenderFns=r,p._compiled=!0),l&&(p.functional=!0),n&&(p._scopeId="data-v-"+n),a?(s=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(a)},p._ssrRegister=s):o&&(s=i?function(){o.call(this,(p.functional?this.parent:this).$root.$options.shadowRoot)}:o),s)if(p.functional){p._injectStyles=s;var u=p.render;p.render=function(e,t){return s.call(t),u(e,t)}}else{var d=p.beforeCreate;p.beforeCreate=d?[].concat(d,s):[s]}return{exports:e,options:p}}var y=d(u,i,s,!1,null,null,null),w=y.exports;w.install=function(e){e.component(w.name,w),e.component("zero-web-player",w),e.component("zero-player",w),e.component("ZPlayer",w)};var c=w;const f=[c],m={install:e=>{f.forEach(t=>{t.install(e)})}};"undefined"!==typeof window&&window.Vue&&m.install(window.Vue);const z="zwplayer/zwplayer.js?v=3.6",h=function(e){this.zwplayer=null;const t=this;(0,o.l)("zwplayer-core",z,function(r){r?t.zwplayer=new window.ZWPlayer(e):console.log("Load zwplayer library failed.")})};h.prototype={play(e,t,r){let l=this;e||(e=this.murl),l.zwplayer&&l.zwplayer.play(e,t,r)},stop(){let e=this;e.zwplayer&&e.zwplayer.stop()},pause(){let e=this;e.zwplayer&&e.zwplayer.pause()},resume(){let e=this;e.zwplayer&&e.zwplayer.resume()},getDuration(){let e=this;if(e.zwplayer)return e.zwplayer.getDuration()},getCurrentTime(){let e=this;if(e.zwplayer)return e.zwplayer.CurrentTime},seekTime(e){let t=this;t.zwplayer&&t.zwplayer.seekTime(e)},destroy(){let e=this;e.zwplayer&&e.zwplayer.destroy()},setplaystate(e){let t=this;t.zwplayer&&t.zwplayer.setplaystate(e)},setEnableDanmu(e){let t=this;t.zwplayer&&t.zwplayer.setEnableDanmu(e)},appendDanmu(e,t){let r=this;r.zwplayer&&r.zwplayer.appendDanmu(e,t)},setChapters(e){let t=this;t.zwplayer&&t.zwplayer.setChapters(e)},addSubtitle(e,t,r){let l=this;l.zwplayer&&l.zwplayer.addSubtitle(e,t,r)},loadSubtitle(e,t,r){let l=this;l.zwplayer&&l.zwplayer.loadSubtitle(e,t,r)},removeSubtitle(){let e=this;e.zwplayer&&e.zwplayer.removeSubtitle()},buildDanmuControlbar(e,t){let r=this;r.zwplayer&&r.zwplayer.buildDanmuControlbar(e,t)},notifyResize(e,t){let r=this;r.zwplayer&&r.zwplayer.notifyResize(e,t)},setMute(e){let t=this;t.zwplayer&&t.zwplayer.setMuted(e)},setullscr(e){let t=this;t.zwplayer&&(t.is_fullscr=e,t.zwplayer.setFullscreen(e))},lightOff(){let e=this;e.zwplayer&&e.zwplayer.lightOff()},lightOn(){let e=this;e.zwplayer&&e.zwplayer.lightOn()},get CurrentTime(){let e=this;return e.zwplayer?e.zwplayer.CurrentTime:-1}};var b=m,g=b}(),l}()});
|
|
2
2
|
//# sourceMappingURL=zwplayervue2.umd.min.js.map
|
package/package.json
CHANGED
package/sources/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
// 引入该目录下所有的组件
|
|
1
|
+
// 引入该目录下所有的组件
|
|
2
2
|
import zwplayer from "./vueplayer/index.js";
|
|
3
|
-
import { zwplayer_loadjs } from "./vueplayer/src/loadjs.js"
|
|
4
|
-
|
|
5
|
-
const components = [
|
|
6
|
-
zwplayer
|
|
7
|
-
]
|
|
8
|
-
|
|
9
|
-
const ZwModule = {}
|
|
3
|
+
import { zwplayer_loadjs } from "./vueplayer/src/loadjs.js"
|
|
4
|
+
|
|
5
|
+
const components = [
|
|
6
|
+
zwplayer
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
const ZwModule = {}
|
|
10
10
|
ZwModule.install = Vue => {
|
|
11
|
-
components.forEach(component => {
|
|
12
|
-
component.install(Vue);
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
components.forEach(component => {
|
|
12
|
+
component.install(Vue);
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
16
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
17
|
-
ZwModule.install(window.Vue)
|
|
18
|
-
}
|
|
17
|
+
ZwModule.install(window.Vue)
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
const zwplayer_js_def = 'zwplayer/zwplayer.js?v=3.6';
|
|
21
21
|
|
|
22
22
|
const Player = function(param) {
|
|
23
23
|
this.zwplayer = null;
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
const that = this;
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
zwplayer_loadjs('zwplayer-core', zwplayer_js_def, function(jsid) {
|
|
28
28
|
if (jsid) {
|
|
29
29
|
that.zwplayer = new window.ZWPlayer(param);
|
|
@@ -34,22 +34,22 @@ const Player = function(param) {
|
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
Player.prototype = {
|
|
38
|
-
play(url, isLive, useOldFlv) {
|
|
39
|
-
let vm = this;
|
|
40
|
-
|
|
41
|
-
if (!url)
|
|
42
|
-
url = this.murl;
|
|
43
|
-
if (!vm.zwplayer)
|
|
44
|
-
return;
|
|
45
|
-
|
|
37
|
+
Player.prototype = {
|
|
38
|
+
play(url, isLive, useOldFlv) {
|
|
39
|
+
let vm = this;
|
|
40
|
+
|
|
41
|
+
if (!url)
|
|
42
|
+
url = this.murl;
|
|
43
|
+
if (!vm.zwplayer)
|
|
44
|
+
return;
|
|
45
|
+
|
|
46
46
|
vm.zwplayer.play(url, isLive, useOldFlv);
|
|
47
|
-
},
|
|
48
|
-
stop() {
|
|
49
|
-
let vm = this;
|
|
50
|
-
|
|
51
|
-
if (vm.zwplayer) {
|
|
52
|
-
vm.zwplayer.stop();
|
|
47
|
+
},
|
|
48
|
+
stop() {
|
|
49
|
+
let vm = this;
|
|
50
|
+
|
|
51
|
+
if (vm.zwplayer) {
|
|
52
|
+
vm.zwplayer.stop();
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
pause() {
|
|
@@ -72,7 +72,7 @@ Player.prototype = {
|
|
|
72
72
|
}
|
|
73
73
|
return undefined;
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
getCurrentTime() {
|
|
77
77
|
let vm = this;
|
|
78
78
|
if (vm.zwplayer) {
|
|
@@ -80,122 +80,129 @@ Player.prototype = {
|
|
|
80
80
|
}
|
|
81
81
|
return undefined;
|
|
82
82
|
},
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
seekTime(time) {
|
|
85
85
|
let vm = this;
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
if (vm.zwplayer) {
|
|
88
88
|
vm.zwplayer.seekTime(time);
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
destroy() {
|
|
92
92
|
let vm = this;
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
if (vm.zwplayer) {
|
|
95
95
|
vm.zwplayer.destroy();
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
setplaystate(bPlaying) {
|
|
99
99
|
let vm = this;
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
if (vm.zwplayer) {
|
|
102
102
|
vm.zwplayer.setplaystate(bPlaying);
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
setEnableDanmu(bEnable) {
|
|
107
107
|
let vm = this;
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
if (vm.zwplayer) {
|
|
110
110
|
vm.zwplayer.setEnableDanmu(bEnable);
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
appendDanmu(msgObj, setting) {
|
|
115
115
|
let vm = this;
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
if (vm.zwplayer) {
|
|
118
118
|
vm.zwplayer.appendDanmu(msgObj, setting);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
setChapters(chapters) {
|
|
123
123
|
let vm = this;
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
if (vm.zwplayer) {
|
|
126
126
|
vm.zwplayer.setChapters(chapters);
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
addSubtitle(subtitleUrl, pos, title) {
|
|
131
131
|
let vm = this;
|
|
132
|
-
|
|
132
|
+
|
|
133
133
|
if (vm.zwplayer) {
|
|
134
134
|
vm.zwplayer.addSubtitle(subtitleUrl, pos, title);
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
|
-
|
|
137
|
+
loadSubtitle(subtitleUrl, pos, title) {
|
|
138
|
+
//console.log('loadSubtitle')
|
|
139
|
+
let vm = this;
|
|
140
|
+
|
|
141
|
+
if (vm.zwplayer) {
|
|
142
|
+
vm.zwplayer.loadSubtitle(subtitleUrl, pos, title);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
138
145
|
removeSubtitle() {
|
|
139
146
|
let vm = this;
|
|
140
|
-
|
|
147
|
+
|
|
141
148
|
if (vm.zwplayer) {
|
|
142
149
|
vm.zwplayer.removeSubtitle();
|
|
143
150
|
}
|
|
144
151
|
},
|
|
145
|
-
|
|
152
|
+
|
|
146
153
|
buildDanmuControlbar(parentId, className) {
|
|
147
154
|
let vm = this;
|
|
148
|
-
|
|
155
|
+
|
|
149
156
|
if (vm.zwplayer) {
|
|
150
157
|
vm.zwplayer.buildDanmuControlbar(parentId, className);
|
|
151
158
|
}
|
|
152
159
|
},
|
|
153
|
-
|
|
160
|
+
|
|
154
161
|
notifyResize(width, height) {
|
|
155
162
|
let vm = this;
|
|
156
|
-
|
|
163
|
+
|
|
157
164
|
if (vm.zwplayer) {
|
|
158
165
|
vm.zwplayer.notifyResize(width, height);
|
|
159
166
|
}
|
|
160
167
|
},
|
|
161
|
-
|
|
162
|
-
setMute(bMute) {
|
|
163
|
-
let vm = this;
|
|
164
|
-
|
|
165
|
-
if (vm.zwplayer) {
|
|
166
|
-
vm.zwplayer.setMuted(bMute);
|
|
168
|
+
|
|
169
|
+
setMute(bMute) {
|
|
170
|
+
let vm = this;
|
|
171
|
+
|
|
172
|
+
if (vm.zwplayer) {
|
|
173
|
+
vm.zwplayer.setMuted(bMute);
|
|
167
174
|
}
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
setullscr(bFullScr) {
|
|
171
|
-
let vm = this;
|
|
172
|
-
|
|
173
|
-
if (vm.zwplayer) {
|
|
174
|
-
vm.is_fullscr = bFullScr;
|
|
175
|
-
vm.zwplayer.setFullscreen(bFullScr);
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
setullscr(bFullScr) {
|
|
178
|
+
let vm = this;
|
|
179
|
+
|
|
180
|
+
if (vm.zwplayer) {
|
|
181
|
+
vm.is_fullscr = bFullScr;
|
|
182
|
+
vm.zwplayer.setFullscreen(bFullScr);
|
|
176
183
|
}
|
|
177
184
|
},
|
|
178
|
-
|
|
185
|
+
|
|
179
186
|
lightOff() {
|
|
180
187
|
let vm = this;
|
|
181
188
|
if (vm.zwplayer) {
|
|
182
189
|
vm.zwplayer.lightOff();
|
|
183
190
|
}
|
|
184
191
|
},
|
|
185
|
-
|
|
192
|
+
|
|
186
193
|
lightOn() {
|
|
187
194
|
let vm = this;
|
|
188
195
|
if (vm.zwplayer) {
|
|
189
196
|
vm.zwplayer.lightOn();
|
|
190
197
|
}
|
|
191
198
|
},
|
|
192
|
-
|
|
199
|
+
|
|
193
200
|
get CurrentTime () {
|
|
194
201
|
let vm = this;
|
|
195
202
|
if (vm.zwplayer) {
|
|
196
203
|
return vm.zwplayer.CurrentTime;
|
|
197
204
|
}
|
|
198
|
-
|
|
205
|
+
|
|
199
206
|
return -1;
|
|
200
207
|
}
|
|
201
208
|
};
|
|
@@ -204,5 +211,5 @@ export {
|
|
|
204
211
|
zwplayer,
|
|
205
212
|
Player
|
|
206
213
|
};
|
|
207
|
-
|
|
214
|
+
|
|
208
215
|
export default ZwModule;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// zwplayer tools
|
|
2
|
+
|
|
3
|
+
const zwplayer_loadjs = function(id,url,cb) {
|
|
4
|
+
let headNode = document.getElementsByTagName("head");
|
|
5
|
+
|
|
6
|
+
if (headNode.length == 0) {
|
|
7
|
+
headNode = document.createElement("head");
|
|
8
|
+
let body = document.getElementsByTagName("body");
|
|
9
|
+
if (body.length > 0) {
|
|
10
|
+
body = body[0];
|
|
11
|
+
document.insertBefore(headNode,body);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
alert('Invalid html document: no HEAD tag');
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
headNode = headNode[0];
|
|
20
|
+
const nodes = headNode.childNodes;
|
|
21
|
+
|
|
22
|
+
for (let i = 0; i < nodes.length; i ++) {
|
|
23
|
+
const node = nodes[i];
|
|
24
|
+
if (node.nodeName.toUpperCase() === 'SCRIPT') {
|
|
25
|
+
if (node.id && node.id == id) {
|
|
26
|
+
if (node.getAttribute('loadstate') != 'true') {
|
|
27
|
+
const checkLoad = function () {
|
|
28
|
+
if (node.getAttribute('loadstate') != 'true') {
|
|
29
|
+
setTimeout(checkLoad,50);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (typeof cb == 'function') cb(id);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
setTimeout(checkLoad,50);
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (typeof cb == 'function') cb(id);
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const script = document.createElement("script");
|
|
48
|
+
|
|
49
|
+
script.type = "text/javascript";
|
|
50
|
+
|
|
51
|
+
if(script.readyState){ // IE
|
|
52
|
+
script.onreadystatechange = function(){
|
|
53
|
+
if(script.readyState == "loaded" || script.readyState == "complete"){
|
|
54
|
+
script.onreadystatechange = null;
|
|
55
|
+
script.setAttribute('loadstate','true');
|
|
56
|
+
if (typeof cb == 'function') cb(id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
script.onload = function(){
|
|
62
|
+
script.setAttribute('loadstate','true');
|
|
63
|
+
script.setAttribute('charset','utf-8');
|
|
64
|
+
if (typeof cb == 'function') cb(id);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
script.id = id;
|
|
68
|
+
script.src = url;
|
|
69
|
+
|
|
70
|
+
headNode.appendChild(script);
|
|
71
|
+
|
|
72
|
+
return false;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
module.exports.zwplayer_loadjs = zwplayer_loadjs;
|