@mpxjs/webpack-plugin 2.8.56 → 2.8.57
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.
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<video
|
|
3
3
|
ref="_mpx_video_ref"
|
|
4
|
-
|
|
5
|
-
:src="src"
|
|
6
|
-
:controls="showControlsTool"
|
|
7
|
-
:autoplay="autoplay"
|
|
8
|
-
:loop="loop"
|
|
9
|
-
:muted="mutedCopy"
|
|
10
|
-
:poster="poster"
|
|
4
|
+
class="video-js"
|
|
11
5
|
v-bind="playsinlineAttr"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<script>
|
|
6
|
+
></video>
|
|
7
|
+
</template>
|
|
8
|
+
<script>
|
|
17
9
|
import { inheritEvent } from './getInnerListeners'
|
|
10
|
+
import videojs from 'video.js'
|
|
11
|
+
import 'video.js/dist/video-js.min.css'
|
|
18
12
|
|
|
19
13
|
export default {
|
|
20
14
|
name: 'mpx-video',
|
|
@@ -54,7 +48,7 @@
|
|
|
54
48
|
type: Boolean,
|
|
55
49
|
default: false
|
|
56
50
|
},
|
|
57
|
-
initialTime: {
|
|
51
|
+
initialTime: {
|
|
58
52
|
type: Number,
|
|
59
53
|
default: 0
|
|
60
54
|
},
|
|
@@ -63,6 +57,10 @@
|
|
|
63
57
|
type: Boolean,
|
|
64
58
|
default: true
|
|
65
59
|
},
|
|
60
|
+
showBottomProgress: { // done
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true
|
|
63
|
+
},
|
|
66
64
|
showFullscreenBtn: { // done
|
|
67
65
|
type: Boolean,
|
|
68
66
|
default: true
|
|
@@ -125,135 +123,166 @@
|
|
|
125
123
|
default: false
|
|
126
124
|
},
|
|
127
125
|
playsinline: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
computed: {
|
|
133
|
-
playsinlineAttr () {
|
|
134
|
-
if (!this.playsinline) return {}
|
|
135
|
-
return {
|
|
136
|
-
'webkit-playsinline': true,
|
|
137
|
-
'playsinline': true,
|
|
138
|
-
'x5-playsinline': true
|
|
139
|
-
}
|
|
140
|
-
}
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: true
|
|
128
|
+
}
|
|
141
129
|
},
|
|
142
130
|
data () {
|
|
143
131
|
return {
|
|
144
|
-
showControlsTool: this.controls,
|
|
145
|
-
mutedCopy: this.muted,
|
|
146
|
-
classList: ''
|
|
147
132
|
}
|
|
148
133
|
},
|
|
134
|
+
computed: {
|
|
135
|
+
playsinlineAttr () {
|
|
136
|
+
if (!this.playsinline) return {}
|
|
137
|
+
return {
|
|
138
|
+
'webkit-playsinline': true,
|
|
139
|
+
'playsinline': true,
|
|
140
|
+
'x5-playsinline': true,
|
|
141
|
+
'x5-video-orientation': 'landscape|portrait'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
149
145
|
watch: {
|
|
150
|
-
muted (val) {
|
|
151
|
-
this.
|
|
146
|
+
muted: function (val) {
|
|
147
|
+
this._player?.muted(val)
|
|
148
|
+
},
|
|
149
|
+
controls: function (show) {
|
|
150
|
+
this.$emit('controlstoggle', inheritEvent('controlstoggle', {}, { show }))
|
|
152
151
|
}
|
|
153
152
|
},
|
|
154
153
|
mounted () {
|
|
154
|
+
const videoNode = this.$refs['_mpx_video_ref']
|
|
155
|
+
this._player = videojs(videoNode, {
|
|
156
|
+
controls: true,
|
|
157
|
+
sources:[
|
|
158
|
+
{
|
|
159
|
+
src: this.src
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
autoplay: this.autoplay,
|
|
163
|
+
loop: this.loop,
|
|
164
|
+
/**
|
|
165
|
+
log 若 controls 属性值为 false 则设置 poster 无效
|
|
166
|
+
*/
|
|
167
|
+
poster: this.controls ? this.poster : ''
|
|
168
|
+
}, function () {
|
|
169
|
+
})
|
|
170
|
+
this.initPlayer()
|
|
155
171
|
this.initStyle()
|
|
156
172
|
this.initEvent()
|
|
157
173
|
},
|
|
158
174
|
methods: {
|
|
159
|
-
|
|
160
|
-
|
|
175
|
+
initPlayer () {
|
|
176
|
+
this._player.muted(this.muted)
|
|
161
177
|
if (this.initialTime) {
|
|
162
|
-
|
|
178
|
+
this._player.currentTime(this.initialTime)
|
|
163
179
|
}
|
|
164
|
-
if (this.autoplay) { // log 解决autoplay无法自动播放问题
|
|
165
|
-
this.mutedCopy = true
|
|
166
|
-
}
|
|
167
|
-
if (!this.showProgress) this.classList += ' mpx-no-show_progress'
|
|
168
|
-
if (!this.showFullscreenBtn) this.classList += ' mpx-no-show_fullscreen_btn'
|
|
169
|
-
if (!this.showPlayBtn) this.classList += ' mpx-no-show_play_btn'
|
|
170
|
-
if (!this.showCenterPlayBtn) this.classList += ' mpx-no-show_center_play_btn'
|
|
171
|
-
if (!this.showMuteBtn) this.classList += ' mpx-no-show_mute_btn'
|
|
172
180
|
},
|
|
173
|
-
|
|
174
|
-
|
|
181
|
+
initStyle () {
|
|
182
|
+
if (!this.controls) this._player.el_.classList.add('mpx-no-show_controls')
|
|
183
|
+
|
|
184
|
+
if (!this.showBottomProgress) this._player.el_.classList.add('mpx-no-show_progress')
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
showProgress若不设置,宽度大于240时才会显示
|
|
188
|
+
*/
|
|
189
|
+
if (!this.showProgress || (this._player.el_.offsetWidth < 240 && this.showProgress)) this._player.el_.classList.add('mpx-no-show_progress')
|
|
175
190
|
|
|
176
|
-
|
|
191
|
+
if (!this.showFullscreenBtn) this._player.el_.classList.add('mpx-no-show_fullscreen_btn')
|
|
192
|
+
|
|
193
|
+
if (!this.showPlayBtn) this._player.el_.classList.add('mpx-no-show_play_btn')
|
|
194
|
+
|
|
195
|
+
if (!this.showCenterPlayBtn) this._player.el_.classList.add('mpx-no-show_center_play_btn')
|
|
196
|
+
|
|
197
|
+
if (!this.showMuteBtn) this._player.el_.classList.add('mpx-no-show_mute_btn')
|
|
198
|
+
},
|
|
199
|
+
initEvent () {
|
|
200
|
+
this._player.on('play', (e) => {
|
|
177
201
|
this.$emit('play', inheritEvent('play', e, {}))
|
|
178
202
|
})
|
|
179
203
|
|
|
180
|
-
|
|
204
|
+
this._player.on('pause', (e) => {
|
|
181
205
|
this.$emit('pause', inheritEvent('pause', e, {}))
|
|
182
206
|
})
|
|
183
207
|
|
|
184
|
-
|
|
208
|
+
this._player.on('ended', (e) => {
|
|
185
209
|
this.$emit('ended', inheritEvent('ended', e, {}))
|
|
186
210
|
})
|
|
187
211
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
this.$emit('timeupdate', inheritEvent('timeupdate', e, { currentTime: eNode.currentTime, duration: eNode.duration }))
|
|
212
|
+
this._player.on('timeupdate', (e) => {
|
|
213
|
+
this.$emit('timeupdate', inheritEvent('timeupdate', e, {}))
|
|
191
214
|
})
|
|
192
215
|
|
|
193
|
-
|
|
216
|
+
this._player.on('error', (e) => {
|
|
194
217
|
this.$emit('error', inheritEvent('error', e, {}))
|
|
195
218
|
})
|
|
196
219
|
|
|
197
|
-
|
|
220
|
+
this._player.on('waiting', (e) => {
|
|
198
221
|
this.$emit('waiting', inheritEvent('waiting', e, {}))
|
|
199
222
|
})
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const eNode = e.target
|
|
203
|
-
this.$emit('loadedmetadata', inheritEvent('loadedmetadata', e, { width: eNode.videoWidth, height: eNode.videoHeight, duration: eNode.duration }))
|
|
223
|
+
this._player.on('loadedmetadata', (e) => {
|
|
224
|
+
this.$emit('loadedmetadata', inheritEvent('loadedmetadata', e, {}))
|
|
204
225
|
})
|
|
205
226
|
|
|
206
|
-
|
|
227
|
+
this._player.on('progress', (e) => {
|
|
207
228
|
const eNode = e.target
|
|
208
229
|
const buffered = (eNode?.buffered?.end(0)) / (eNode?.duration)
|
|
209
230
|
this.$emit('progress', inheritEvent('progress', e, { buffered: buffered * 100 }))
|
|
210
231
|
})
|
|
211
232
|
|
|
212
|
-
|
|
233
|
+
this._player.on('seeked', (e) => {
|
|
213
234
|
const eNode = e.target
|
|
214
|
-
this.$emit('seekcomplete', inheritEvent('seekcomplete', e, { position: eNode.currentTime
|
|
235
|
+
this.$emit('seekcomplete', inheritEvent('seekcomplete', e, { position: eNode.currentTime }))
|
|
215
236
|
})
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
this.$emit('fullscreenchange', inheritEvent('fullscreenchange', e, { fullScreen: false }))
|
|
237
|
+
this._player.on('fullscreenchange', (e) => {
|
|
238
|
+
if (!this._player.paused()) {
|
|
239
|
+
// hack: 解决退出全屏自动暂停
|
|
240
|
+
setTimeout(() => {
|
|
241
|
+
this._player.play()
|
|
242
|
+
}, 500)
|
|
223
243
|
}
|
|
244
|
+
this.$emit('fullscreenchange', inheritEvent('fullscreenchange', e, { fullScreen: this._player.isFullscreen() }))
|
|
224
245
|
})
|
|
225
246
|
|
|
226
|
-
|
|
247
|
+
this._player.on('enterpictureinpicture', (e) => {
|
|
227
248
|
this.$emit('enterpictureinpicture', inheritEvent('enterpictureinpicture', e, {}))
|
|
228
249
|
})
|
|
229
250
|
|
|
230
|
-
|
|
251
|
+
this._player.on('leavepictureinpicture', (e) => {
|
|
231
252
|
this.$emit('leavepictureinpicture', inheritEvent('leavepictureinpicture', e, {}))
|
|
232
253
|
})
|
|
254
|
+
|
|
233
255
|
}
|
|
234
256
|
}
|
|
235
257
|
}
|
|
236
|
-
</script>
|
|
258
|
+
</script>
|
|
259
|
+
|
|
260
|
+
<style lang="stylus">
|
|
261
|
+
|
|
262
|
+
.vjs-chapters-button
|
|
263
|
+
display: none !important
|
|
264
|
+
|
|
265
|
+
.mpx-no-show_controls
|
|
266
|
+
.vjs-control-bar
|
|
267
|
+
display none !important
|
|
237
268
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
&::-webkit-media-controls-timeline
|
|
242
|
-
display none !important
|
|
269
|
+
.mpx-no-show_progress
|
|
270
|
+
.vjs-progress-control
|
|
271
|
+
display none !important
|
|
243
272
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
273
|
+
.mpx-no-show_fullscreen_btn
|
|
274
|
+
.vjs-fullscreen-control
|
|
275
|
+
display none !important
|
|
247
276
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
277
|
+
.mpx-no-show_play_btn
|
|
278
|
+
.vjs-play-control
|
|
279
|
+
display none !important
|
|
251
280
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
281
|
+
.mpx-no-show_center_play_btn
|
|
282
|
+
.vjs-big-play-button
|
|
283
|
+
display none !important
|
|
255
284
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
</style>
|
|
285
|
+
.mpx-no-show_mute_btn
|
|
286
|
+
.vjs-mute-control
|
|
287
|
+
display none !important
|
|
288
|
+
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.57",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"postcss-modules-values": "^4.0.0",
|
|
55
55
|
"postcss-selector-parser": "^6.0.8",
|
|
56
56
|
"postcss-value-parser": "^4.0.2",
|
|
57
|
-
"source-list-map": "^2.0.0"
|
|
57
|
+
"source-list-map": "^2.0.0",
|
|
58
|
+
"video.js": "^8.6.0"
|
|
58
59
|
},
|
|
59
60
|
"peerDependencies": {
|
|
60
61
|
"webpack": "^5.48.0"
|
|
@@ -81,5 +82,5 @@
|
|
|
81
82
|
"engines": {
|
|
82
83
|
"node": ">=14.14.0"
|
|
83
84
|
},
|
|
84
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "f533e8035850c01d5e98fc748ee4d57f60ba9dba"
|
|
85
86
|
}
|