wg-video-player 1.0.0-beta.0 → 1.0.0-beta.2
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/dist/style.css +1 -1
- package/dist/wg-video-player.js +71028 -81827
- package/dist/wg-video-player.umd.cjs +470 -483
- package/examples/App.vue +101 -126
- package/examples/fakeData.js +0 -7
- package/examples/main.js +3 -16
- package/package.json +2 -1
- package/wg-video-player.d.ts +20 -28
package/examples/App.vue
CHANGED
|
@@ -1,55 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="demo grid">
|
|
3
3
|
<div class="mvp-multi-player-container">
|
|
4
|
-
<div class="mvp-multi-player">
|
|
5
|
-
<multi-player
|
|
6
|
-
:enable-new="true"
|
|
7
|
-
:mode="targetMode"
|
|
8
|
-
:videos="videos"
|
|
9
|
-
:seekable="seekable"
|
|
10
|
-
:seek-warning="seekWarning"
|
|
11
|
-
:autoPlay="autoPlay"
|
|
12
|
-
:last-played="lastPlayed"
|
|
13
|
-
:plugins="plugins"
|
|
14
|
-
:custom-event-timestamps="timestamps"
|
|
15
|
-
:is-simple-controls="isSimpleControls"
|
|
16
|
-
:enable-play-rate="enablePlayRate"
|
|
17
|
-
@playerReady="playerReady"
|
|
18
|
-
/>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="mvp-multi-player-log" v-if="false">
|
|
21
|
-
<div class="video-log">
|
|
22
|
-
<div class="video-title">{{ '多路视频log' }}</div>
|
|
23
|
-
<div class="log-content">
|
|
24
|
-
<div v-if="targetMode === 'replay'" class="log">
|
|
25
|
-
<div>{{ '播放器基本属性:' }}</div>
|
|
26
|
-
<div class="log-view">
|
|
27
|
-
<p>{{ '当前时间:' + currentTime }}</p>
|
|
28
|
-
<p>{{ '视频时长:' + duration }}</p>
|
|
29
|
-
<p>{{ '音量:' + volumeView }}</p>
|
|
30
|
-
<p>
|
|
31
|
-
{{ '倍速:' + playerRate.rate + ' 时间点:' + playerRate.position }}
|
|
32
|
-
</p>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
<div class="log">
|
|
36
|
-
<div>{{ '播放器状态追踪' }}</div>
|
|
37
|
-
<div class="log-view" ref="stateLog">
|
|
38
|
-
<div class="single-log-view" v-for="(log, index) in playerStatusLogs" :key="index">
|
|
39
|
-
<span>{{ '时间戳:' + log.timestamp }}</span>
|
|
40
|
-
<br />
|
|
41
|
-
<span>{{ '视频时间点:' + log.position }}</span>
|
|
42
|
-
<br />
|
|
43
|
-
<span>{{ '状态变更:' + log.msg }}</span>
|
|
44
|
-
<br />
|
|
45
|
-
<span v-if="targetMode === 'live'">{{ '视频Index:' + log.videoIndex }}</span>
|
|
46
|
-
<br />
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
4
|
+
<div class="mvp-multi-player" id="wg-player-demo"></div>
|
|
53
5
|
</div>
|
|
54
6
|
<div class="mvp-i18n-test">
|
|
55
7
|
<div class="button" @click="paused = true" v-if="targetMode === 'replay'">暂停视频</div>
|
|
@@ -74,13 +26,15 @@
|
|
|
74
26
|
<script>
|
|
75
27
|
import { secondsToHms } from '@/utils/time-format';
|
|
76
28
|
import fakeData from './fakeData';
|
|
29
|
+
import { WgVideoPlayer } from '@/index';
|
|
30
|
+
import '@/styles/index.scss';
|
|
77
31
|
|
|
78
32
|
export default {
|
|
79
33
|
data() {
|
|
80
34
|
const autoPlay = false;
|
|
81
35
|
const lastPlayed = 0;
|
|
82
36
|
return {
|
|
83
|
-
|
|
37
|
+
wgVideoPlayer: null,
|
|
84
38
|
plugins: fakeData.plugins,
|
|
85
39
|
isSimpleControls: false,
|
|
86
40
|
targetMode: 'replay',
|
|
@@ -113,10 +67,6 @@ export default {
|
|
|
113
67
|
videos() {
|
|
114
68
|
return this.targetMode === 'replay' ? fakeData.replayVideos : fakeData.liveVideos;
|
|
115
69
|
},
|
|
116
|
-
multiPlayerListeners() {
|
|
117
|
-
const commonListeners = { ...this.$listeners, ...this.trackListeners };
|
|
118
|
-
return this.targetMode === 'replay' ? { ...this.pluginListeners, ...commonListeners } : commonListeners;
|
|
119
|
-
},
|
|
120
70
|
currentTime() {
|
|
121
71
|
return secondsToHms(this.playerAttrLog.currentTime);
|
|
122
72
|
},
|
|
@@ -127,61 +77,108 @@ export default {
|
|
|
127
77
|
return Math.floor(this.playerAttrLog.volume * 100) / 100;
|
|
128
78
|
},
|
|
129
79
|
},
|
|
80
|
+
mounted() {
|
|
81
|
+
this.wgVideoPlayer = new WgVideoPlayer('wg-player-demo', {
|
|
82
|
+
videos: this.videos,
|
|
83
|
+
mode: this.targetMode,
|
|
84
|
+
seekable: this.seekable,
|
|
85
|
+
seekWarning: this.seekWarning,
|
|
86
|
+
autoPlay: this.autoPlay,
|
|
87
|
+
lastPlayed: this.lastPlayed,
|
|
88
|
+
isSimpleControls: this.isSimpleControls,
|
|
89
|
+
enablePlayRate: this.enablePlayRate,
|
|
90
|
+
plugins: this.getPlugins(),
|
|
91
|
+
});
|
|
92
|
+
this.wgVideoPlayer.on('playerReady', this.playerReady);
|
|
93
|
+
this.wgVideoPlayer.on('playerError', () => {
|
|
94
|
+
window.alert('播放失败!!');
|
|
95
|
+
});
|
|
96
|
+
this.wgVideoPlayer.on('timeupdate', ({ player }) => {
|
|
97
|
+
console.log(player.currentTime, this.wgVideoPlayer.currentTime);
|
|
98
|
+
});
|
|
99
|
+
},
|
|
130
100
|
methods: {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
multiPlayer.configPlugin('caption', {
|
|
139
|
-
toggle: true,
|
|
140
|
-
mediaId: '852e07a579984725aabd78a0a52b2ec8',
|
|
141
|
-
server: 'https://incast-uat.tronclass.com.cn',
|
|
142
|
-
source:
|
|
143
|
-
'ilesson://ilesson?download_url=aHR0cDovL2xvY2FsaG9zdDo4MDAyL3ZpZGVvcy9ST09NXzNfVklERU8vMjAxOTEwMDEvMDgwMDAwLTA4NDUwMC9jYW1fZW5jb2Rlcg==',
|
|
144
|
-
organization: 'wisdomgarden-uat',
|
|
145
|
-
callback: '',
|
|
146
|
-
downloadUrl: '',
|
|
147
|
-
permissions: {
|
|
148
|
-
create: true,
|
|
149
|
-
upload: true,
|
|
101
|
+
getPlugins() {
|
|
102
|
+
return {
|
|
103
|
+
liveCaption: {
|
|
104
|
+
toggle: false,
|
|
105
|
+
server: 'http://localhost:21082',
|
|
106
|
+
deviceCode: 'livestream',
|
|
150
107
|
},
|
|
151
|
-
|
|
152
|
-
multiPlayer.configPlugin('liveCaption', {
|
|
153
|
-
toggle: false,
|
|
154
|
-
server: 'http://localhost:21082',
|
|
155
|
-
deviceCode: 'livestream',
|
|
156
|
-
});
|
|
157
|
-
multiPlayer.configPlugin('topic', {
|
|
158
|
-
toggle: true,
|
|
159
|
-
mediaId: '852e07a579984725aabd78a0a52b2ec8',
|
|
160
|
-
server: 'https://incast-uat.tronclass.com.cn',
|
|
161
|
-
callback: 'http://localhost:8088/api/media-topic/callback',
|
|
162
|
-
organization: 'wisdomgarden-uat',
|
|
163
|
-
lang: 'zh-CN',
|
|
164
|
-
aiTopic: {
|
|
108
|
+
caption: {
|
|
165
109
|
toggle: true,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
110
|
+
mediaId: '852e07a579984725aabd78a0a52b2ec8',
|
|
111
|
+
server: 'https://incast-uat.tronclass.com.cn',
|
|
112
|
+
source:
|
|
113
|
+
'ilesson://ilesson?download_url=aHR0cDovL2xvY2FsaG9zdDo4MDAyL3ZpZGVvcy9ST09NXzNfVklERU8vMjAxOTEwMDEvMDgwMDAwLTA4NDUwMC9jYW1fZW5jb2Rlcg==',
|
|
114
|
+
organization: 'wisdomgarden-uat',
|
|
115
|
+
callback: '',
|
|
116
|
+
downloadUrl: '',
|
|
171
117
|
permissions: {
|
|
172
|
-
|
|
173
|
-
|
|
118
|
+
create: true,
|
|
119
|
+
upload: true,
|
|
174
120
|
},
|
|
175
121
|
},
|
|
176
|
-
|
|
122
|
+
topic: {
|
|
123
|
+
toggle: false,
|
|
124
|
+
mediaId: '852e07a579984725aabd78a0a52b2ec8',
|
|
125
|
+
server: 'https://incast-uat.tronclass.com.cn',
|
|
126
|
+
callback: 'http://localhost:8088/api/media-topic/callback',
|
|
127
|
+
organization: 'wisdomgarden-uat',
|
|
128
|
+
lang: 'zh-CN',
|
|
129
|
+
aiTopic: {
|
|
130
|
+
toggle: true,
|
|
131
|
+
category: '生物', // 知识点大类,一般是课程名称
|
|
132
|
+
asrInput:
|
|
133
|
+
'ilesson://ilesson?download_url=aHR0cDovL2xvY2FsaG9zdDo4MDAyL3ZpZGVvcy9ST09NXzNfVklERU8vMjAxOTEwMDEvMDgwMDAwLTA4NDUwMC9jYW1fZW5jb2Rlcg==', // 用来做asr分析的视频下载地址
|
|
134
|
+
ocrInput:
|
|
135
|
+
'ilesson://ilesson?download_url=aHR0cDovL2xvY2FsaG9zdDo4MDAyL3ZpZGVvcy9ST09NXzNfVklERU8vMjAxOTEwMDEvMDgwMDAwLTA4NDUwMC9jYW1fZW5jb2Rlcg==', // 用来做ocr分析的视频下载地址
|
|
136
|
+
permissions: {
|
|
137
|
+
manage: ['generate', 'delete', 'transfer', 'publish', 'recover'],
|
|
138
|
+
view: ['all'],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
manualTopic: {
|
|
142
|
+
permissions: {
|
|
143
|
+
manage: ['create', 'delete', 'update'],
|
|
144
|
+
view: ['all'],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
note: {
|
|
149
|
+
toggle: false,
|
|
150
|
+
// server: 'http://notabene.uat.tronclass.com.cn:18888',
|
|
151
|
+
token:
|
|
152
|
+
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiJVMDAwMyIsImRpc3BsYXlfbmFtZSI6IlNoYXduIiwidXJpIjoidXJuOnRyb25jYXN0OnJlcGxheTo3MDcyOGI0ZDkxYjE0ZGJjYTY4OGY0ZTcyYjI3NzlmNyIsInNlcnZlciI6Imh0dHA6Ly9ub3RhYmVuZS51YXQudHJvbmNsYXNzLmNvbS5jbjoxODg4OCIsInN0b3JhZ2UiOnsidHlwZSI6Ik1FRElBIiwic2VydmVyIjoiaHR0cDovL2xvY2FsaG9zdDo4MDAxIiwic2VjcmV0IjoiaW5zZWN1cmUgc2VjcmV0IGtleSJ9fQ.1zJnhWPcBqKfW7W6GbYYTPKfSDJX5Eb7zf-iLOENTus',
|
|
177
153
|
permissions: {
|
|
178
154
|
manage: ['create', 'delete', 'update'],
|
|
155
|
+
view: ['public', 'myself'],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
ppt: {
|
|
159
|
+
toggle: true,
|
|
160
|
+
mediaId: 'media-1',
|
|
161
|
+
server: 'http://localhost:8088',
|
|
162
|
+
source:
|
|
163
|
+
'https://minio.tronclass.com.cn/outbound/wisdomgarden/ARTS403/20230908/150000-150500-1694160880354/INSTRUCTOR-d2lzZG9tZ2FyZGVuLUFSVFM0MDMtRGV2aWNlTGFiZWwuSU5TVFJVQ1RPUi0xLTE2OTQxNTkzMTAxODM-.mp4?response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27INSTRUCTOR-d2lzZG9tZ2FyZGVuLUFSVFM0MDMtRGV2aWNlTGFiZWwuSU5TVFJVQ1RPUi0xLTE2OTQxNTkzMTAxODM-.mp4&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=YBQUE8NVWSQGSEZRNDUK%2F20231016%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231016T081119Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=cbe69b3ce042afada1b6a931ff725de0a43d322240aec075c084a1b4c52e4d1a',
|
|
164
|
+
organization: 'wisdomgarden',
|
|
165
|
+
callback: '',
|
|
166
|
+
permissions: {
|
|
167
|
+
manage: ['create', 'delete', 'update', 'ai-generate'],
|
|
179
168
|
view: ['all'],
|
|
180
169
|
},
|
|
181
170
|
},
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
171
|
+
};
|
|
172
|
+
},
|
|
173
|
+
playerReady({ player }) {
|
|
174
|
+
// this.multiPlayer.toggleVolume();
|
|
175
|
+
if (this.targetMode === 'live') {
|
|
176
|
+
player.startSyncPlayers();
|
|
177
|
+
console.log('player ready ............');
|
|
178
|
+
}
|
|
179
|
+
// TODO 需要重新初始化下面的 plugins
|
|
180
|
+
player.configPlugin('switcher', { toggle: true });
|
|
181
|
+
player.configPlugin('controller', {
|
|
185
182
|
toggle: false,
|
|
186
183
|
server: 'http://localhost:8088',
|
|
187
184
|
mediaId: '94',
|
|
@@ -190,45 +187,22 @@ export default {
|
|
|
190
187
|
manage: ['live', 'record', 'stop'],
|
|
191
188
|
},
|
|
192
189
|
});
|
|
193
|
-
|
|
190
|
+
player.configPlugin('waterMark', {
|
|
194
191
|
toggle: true,
|
|
195
192
|
text: 'U00001',
|
|
196
193
|
});
|
|
197
|
-
|
|
194
|
+
player.configPlugin('chat', {
|
|
198
195
|
toggle: false,
|
|
199
196
|
server: 'http://localhost:5030',
|
|
200
197
|
token:
|
|
201
198
|
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX25vIjoiMiIsInVzZXJfbmFtZSI6Ilx1NzUyOFx1NjIzNzIiLCJyb29tX2lkIjoxLCJyb29tX25hbWUiOiJCaWdfUm9vbSIsInJvbGUiOiJzdHVkZW50IiwiZXhwIjoxNjMyOTg4MDQ0fQ.wZXwoyXYbNwdUczPU_9ufhhbtMLtozCxEYk6evRd5xs',
|
|
202
199
|
});
|
|
203
|
-
multiPlayer.configPlugin('note', {
|
|
204
|
-
toggle: true,
|
|
205
|
-
// server: 'http://notabene.uat.tronclass.com.cn:18888',
|
|
206
|
-
token:
|
|
207
|
-
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiJVMDAwMyIsImRpc3BsYXlfbmFtZSI6IlNoYXduIiwidXJpIjoidXJuOnRyb25jYXN0OnJlcGxheTo3MDcyOGI0ZDkxYjE0ZGJjYTY4OGY0ZTcyYjI3NzlmNyIsInNlcnZlciI6Imh0dHA6Ly9ub3RhYmVuZS51YXQudHJvbmNsYXNzLmNvbS5jbjoxODg4OCIsInN0b3JhZ2UiOnsidHlwZSI6Ik1FRElBIiwic2VydmVyIjoiaHR0cDovL2xvY2FsaG9zdDo4MDAxIiwic2VjcmV0IjoiaW5zZWN1cmUgc2VjcmV0IGtleSJ9fQ.1zJnhWPcBqKfW7W6GbYYTPKfSDJX5Eb7zf-iLOENTus',
|
|
208
|
-
permissions: {
|
|
209
|
-
manage: ['create', 'delete', 'update'],
|
|
210
|
-
view: ['public', 'myself'],
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
|
-
multiPlayer.configPlugin('ppt', {
|
|
214
|
-
toggle: true,
|
|
215
|
-
mediaId: 'media-1',
|
|
216
|
-
server: 'http://localhost:8088',
|
|
217
|
-
source:
|
|
218
|
-
'https://minio.tronclass.com.cn/outbound/wisdomgarden/ARTS403/20230908/150000-150500-1694160880354/INSTRUCTOR-d2lzZG9tZ2FyZGVuLUFSVFM0MDMtRGV2aWNlTGFiZWwuSU5TVFJVQ1RPUi0xLTE2OTQxNTkzMTAxODM-.mp4?response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27INSTRUCTOR-d2lzZG9tZ2FyZGVuLUFSVFM0MDMtRGV2aWNlTGFiZWwuSU5TVFJVQ1RPUi0xLTE2OTQxNTkzMTAxODM-.mp4&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=YBQUE8NVWSQGSEZRNDUK%2F20231016%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231016T081119Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=cbe69b3ce042afada1b6a931ff725de0a43d322240aec075c084a1b4c52e4d1a',
|
|
219
|
-
organization: 'wisdomgarden',
|
|
220
|
-
callback: '',
|
|
221
|
-
permissions: {
|
|
222
|
-
manage: ['create', 'delete', 'update', 'ai-generate'],
|
|
223
|
-
view: ['all'],
|
|
224
|
-
},
|
|
225
|
-
});
|
|
226
200
|
},
|
|
227
201
|
closePlayer() {
|
|
228
|
-
this.
|
|
202
|
+
this.wgVideoPlayer.close();
|
|
229
203
|
},
|
|
230
204
|
openPlayer() {
|
|
231
|
-
this.
|
|
205
|
+
this.wgVideoPlayer.open();
|
|
232
206
|
},
|
|
233
207
|
changeMode(mode) {
|
|
234
208
|
this.targetMode = mode;
|
|
@@ -252,9 +226,10 @@ export default {
|
|
|
252
226
|
.mvp-multi-player-container {
|
|
253
227
|
display: flex;
|
|
254
228
|
height: 600px;
|
|
229
|
+
width: 100%;
|
|
255
230
|
|
|
256
231
|
.mvp-multi-player {
|
|
257
|
-
width:
|
|
232
|
+
width: 70%;
|
|
258
233
|
}
|
|
259
234
|
|
|
260
235
|
.mvp-multi-player-log {
|
package/examples/fakeData.js
CHANGED
package/examples/main.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
// import Vue from 'vue';
|
|
2
1
|
import { createApp } from 'vue';
|
|
3
|
-
// import VueI18n from 'vue-i18n';
|
|
4
2
|
import { createI18n } from 'vue-i18n';
|
|
5
3
|
import App from './App.vue';
|
|
6
|
-
import multiPlayer from '../src/index';
|
|
7
|
-
|
|
8
|
-
// Vue.use(VueI18n);
|
|
9
4
|
|
|
10
5
|
const messages = {
|
|
11
|
-
tw: { message: '視頻'
|
|
12
|
-
cn: { message: '视频'
|
|
13
|
-
us: { message: 'video'
|
|
6
|
+
tw: { message: '視頻' },
|
|
7
|
+
cn: { message: '视频' },
|
|
8
|
+
us: { message: 'video' },
|
|
14
9
|
};
|
|
15
10
|
const i18n = createI18n({
|
|
16
11
|
locale: 'cn',
|
|
@@ -19,14 +14,6 @@ const i18n = createI18n({
|
|
|
19
14
|
|
|
20
15
|
const app = createApp(App);
|
|
21
16
|
|
|
22
|
-
app.use(multiPlayer);
|
|
23
17
|
app.use(i18n);
|
|
24
18
|
|
|
25
19
|
app.mount('#app');
|
|
26
|
-
// eslint-disable-next-line no-new
|
|
27
|
-
// new Vue({
|
|
28
|
-
// el: '#app',
|
|
29
|
-
// render: (h) => h(App),
|
|
30
|
-
// i18n,
|
|
31
|
-
// });
|
|
32
|
-
// import '../src/test';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wg-video-player",
|
|
3
3
|
"description": "A video player for private",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.2",
|
|
5
5
|
"author": "wg <wg@wisdomgarden.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@ant-design/icons-vue": "^7.0.1",
|
|
35
35
|
"@popperjs/core": "^2.11.8",
|
|
36
36
|
"@silvermine/videojs-quality-selector": "^1.3.0",
|
|
37
|
+
"@vueuse/core": "^10.5.0",
|
|
37
38
|
"ant-design-vue": "^4.0.6",
|
|
38
39
|
"axios": "^1.5.1",
|
|
39
40
|
"chance": "^1.1.11",
|
package/wg-video-player.d.ts
CHANGED
|
@@ -1,52 +1,44 @@
|
|
|
1
|
-
import { PluginFunction } from 'vue';
|
|
2
|
-
|
|
3
1
|
declare module 'wg-video-player';
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
declare interface WgVideoPlayerProps {
|
|
6
4
|
videos: Record<string, any>[]
|
|
7
5
|
mode?: string
|
|
8
6
|
volume?: number
|
|
9
|
-
plugins?: Record<string, any>
|
|
10
7
|
autoPlay?: boolean
|
|
11
8
|
seekable?: boolean
|
|
12
9
|
seekWarning?: string
|
|
13
10
|
lastPlayed?: number
|
|
14
11
|
isSimpleControls?: boolean
|
|
15
12
|
enablePlayRate?: boolean
|
|
16
|
-
|
|
17
|
-
onPlayerReady: Function,
|
|
18
|
-
onError: Function
|
|
13
|
+
plugins: Record<string, any>
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
export type ListenerName = 'playerReady' | 'error'
|
|
22
17
|
|
|
23
18
|
export type VideoLanguage = 'cn' | 'tw' | 'us'
|
|
24
19
|
|
|
25
|
-
export class
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
export class WgVideoPlayer {
|
|
21
|
+
|
|
22
|
+
duration: number
|
|
23
|
+
|
|
24
|
+
constructor(id: string, props: WgVideoPlayerProps, options?: Record<string, any>)
|
|
25
|
+
|
|
26
|
+
get currentTime(): number
|
|
27
|
+
set currentTime(currentTime: number)
|
|
28
|
+
|
|
29
|
+
on(eventName: string, eventHandler: Function): void
|
|
30
|
+
|
|
31
|
+
off(eventName: string): void
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
// fnName: ListenerName,
|
|
31
|
-
// fn: Function,
|
|
32
|
-
// ): void
|
|
33
|
+
play(): void
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
pause(): void
|
|
36
|
+
|
|
37
|
+
open(): void
|
|
38
|
+
|
|
39
|
+
close(): void
|
|
38
40
|
|
|
39
41
|
locale(language: VideoLanguage): void
|
|
40
42
|
|
|
41
43
|
destroy(): void
|
|
42
44
|
}
|
|
43
|
-
|
|
44
|
-
const API: {
|
|
45
|
-
locale: Function,
|
|
46
|
-
i18n: Function,
|
|
47
|
-
langs: Record<string, any>,
|
|
48
|
-
install: PluginFunction<any>,
|
|
49
|
-
MultiPlayer: MultiPlayer,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default API;
|