zwplayer-vue2x 1.0.15 → 1.0.17
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/demo.html +1 -0
- package/lib/zwplayervue2.common.js +763 -0
- package/lib/zwplayervue2.umd.js +774 -0
- package/lib/zwplayervue2.umd.min.js +2 -0
- package/package.json +1 -1
- package/sources/index.js +167 -24
|
@@ -0,0 +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={234: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 v},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(234);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",thumbnails:"object",sendDanmu:"function",danmuBarId:"string",fluid:"boolean"};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"],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="";e||console.log("zwplayer_loadjs failed!"),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},onneterror:function(){t.$emit("onneterror",this)},onmediaevent:function(e){t.$emit("onmediaevent",e,this)}},n=a;for(let a in t.$attrs)a in n&&typeof t.$attrs[a]===n[a]&&("object"===typeof t.$attrs[a]?o[a]=JSON.parse(JSON.stringify(t.$attrs[a])):o[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 y(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 y=p.beforeCreate;p.beforeCreate=y?[].concat(y,s):[s]}return{exports:e,options:p}}var d=y(u,i,s,!1,null,null,null),w=d.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,(0,o.l)("zwplayer-core",z,(function(t){t?this.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)},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,v=b}(),l}()}));
|
|
2
|
+
//# sourceMappingURL=zwplayervue2.umd.min.js.map
|
package/package.json
CHANGED
package/sources/index.js
CHANGED
|
@@ -20,40 +20,183 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
20
20
|
const zwplayer_js_def = 'zwplayer/zwplayer.js?v=3.6';
|
|
21
21
|
|
|
22
22
|
const Player = function(param) {
|
|
23
|
+
this.zwplayer = null;
|
|
24
|
+
|
|
23
25
|
zwplayer_loadjs('zwplayer-core', zwplayer_js_def, function(jsid) {
|
|
24
26
|
if (jsid) {
|
|
25
|
-
|
|
26
|
-
console.log('Player param zwplayer_loadjs:', jsid);;
|
|
27
|
+
this.zwplayer = new window.ZWPlayer(param);
|
|
27
28
|
}
|
|
28
29
|
else {
|
|
29
30
|
console.log('Load zwplayer library failed.');
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
34
|
+
|
|
35
|
+
Player.prototype = {
|
|
36
|
+
play(url, isLive, useOldFlv) {
|
|
37
|
+
let vm = this;
|
|
38
|
+
|
|
39
|
+
if (!url)
|
|
40
|
+
url = this.murl;
|
|
41
|
+
if (!vm.zwplayer)
|
|
42
|
+
return;
|
|
43
|
+
|
|
44
|
+
vm.zwplayer.play(url, isLive, useOldFlv);
|
|
45
|
+
},
|
|
46
|
+
stop() {
|
|
47
|
+
let vm = this;
|
|
48
|
+
|
|
49
|
+
if (vm.zwplayer) {
|
|
50
|
+
vm.zwplayer.stop();
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
pause() {
|
|
54
|
+
let vm = this;
|
|
55
|
+
|
|
56
|
+
if (vm.zwplayer) {
|
|
57
|
+
vm.zwplayer.pause();
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
resume() {
|
|
61
|
+
let vm = this;
|
|
62
|
+
if (vm.zwplayer) {
|
|
63
|
+
vm.zwplayer.resume();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
getDuration() {
|
|
67
|
+
let vm = this;
|
|
68
|
+
if (vm.zwplayer) {
|
|
69
|
+
return vm.zwplayer.getDuration();
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
},
|
|
45
73
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
74
|
+
getCurrentTime() {
|
|
75
|
+
let vm = this;
|
|
76
|
+
if (vm.zwplayer) {
|
|
77
|
+
return vm.zwplayer.CurrentTime;
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
seekTime(time) {
|
|
83
|
+
let vm = this;
|
|
84
|
+
|
|
85
|
+
if (vm.zwplayer) {
|
|
86
|
+
vm.zwplayer.seekTime(time);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
destroy() {
|
|
90
|
+
let vm = this;
|
|
91
|
+
|
|
92
|
+
if (vm.zwplayer) {
|
|
93
|
+
vm.zwplayer.destroy();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
setplaystate(bPlaying) {
|
|
97
|
+
let vm = this;
|
|
98
|
+
|
|
99
|
+
if (vm.zwplayer) {
|
|
100
|
+
vm.zwplayer.setplaystate(bPlaying);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
setEnableDanmu(bEnable) {
|
|
105
|
+
let vm = this;
|
|
106
|
+
|
|
107
|
+
if (vm.zwplayer) {
|
|
108
|
+
vm.zwplayer.setEnableDanmu(bEnable);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
appendDanmu(msgObj, setting) {
|
|
113
|
+
let vm = this;
|
|
114
|
+
|
|
115
|
+
if (vm.zwplayer) {
|
|
116
|
+
vm.zwplayer.appendDanmu(msgObj, setting);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
setChapters(chapters) {
|
|
121
|
+
let vm = this;
|
|
122
|
+
|
|
123
|
+
if (vm.zwplayer) {
|
|
124
|
+
vm.zwplayer.setChapters(chapters);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
addSubtitle(subtitleUrl, pos, title) {
|
|
129
|
+
let vm = this;
|
|
130
|
+
|
|
131
|
+
if (vm.zwplayer) {
|
|
132
|
+
vm.zwplayer.addSubtitle(subtitleUrl, pos, title);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
removeSubtitle() {
|
|
137
|
+
let vm = this;
|
|
138
|
+
|
|
139
|
+
if (vm.zwplayer) {
|
|
140
|
+
vm.zwplayer.removeSubtitle();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
buildDanmuControlbar(parentId, className) {
|
|
145
|
+
let vm = this;
|
|
146
|
+
|
|
147
|
+
if (vm.zwplayer) {
|
|
148
|
+
vm.zwplayer.buildDanmuControlbar(parentId, className);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
notifyResize(width, height) {
|
|
153
|
+
let vm = this;
|
|
154
|
+
|
|
155
|
+
if (vm.zwplayer) {
|
|
156
|
+
vm.zwplayer.notifyResize(width, height);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
setMute(bMute) {
|
|
161
|
+
let vm = this;
|
|
162
|
+
|
|
163
|
+
if (vm.zwplayer) {
|
|
164
|
+
vm.zwplayer.setMuted(bMute);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
setullscr(bFullScr) {
|
|
169
|
+
let vm = this;
|
|
170
|
+
|
|
171
|
+
if (vm.zwplayer) {
|
|
172
|
+
vm.is_fullscr = bFullScr;
|
|
173
|
+
vm.zwplayer.setFullscreen(bFullScr);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
lightOff() {
|
|
178
|
+
let vm = this;
|
|
179
|
+
if (vm.zwplayer) {
|
|
180
|
+
vm.zwplayer.lightOff();
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
lightOn() {
|
|
185
|
+
let vm = this;
|
|
186
|
+
if (vm.zwplayer) {
|
|
187
|
+
vm.zwplayer.lightOn();
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
get CurrentTime () {
|
|
192
|
+
let vm = this;
|
|
193
|
+
if (vm.zwplayer) {
|
|
194
|
+
return vm.zwplayer.CurrentTime;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return -1;
|
|
51
198
|
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
Player = window.ZWPlayer;
|
|
55
|
-
}
|
|
56
|
-
*/
|
|
199
|
+
};
|
|
57
200
|
|
|
58
201
|
export {
|
|
59
202
|
zwplayer,
|