|
|
@@ -5,7 +5,7 @@
|
|
|
<div class="video-section">
|
|
|
<div class="video-title">{{ media.name || tpl.name }}</div>
|
|
|
<div class="video-player-wrap">
|
|
|
- <video-player id="myVideo1" ref="videoPlayer" :playsinline="true" @pause="onPlayerPause($event)"
|
|
|
+ <video-player v-if="options.sources.length" id="myVideo1" ref="videoPlayer" :playsinline="true" @pause="onPlayerPause($event)"
|
|
|
@timeupdate="onPlayerTimeupdate($event)" @play="onPlayerStart($event)" @ready="playerReadied"
|
|
|
@ended="onPlayerEnded($event)" @error="onPlayerError($event)"
|
|
|
:globalOptions="{controls:true}" :options="options">
|
|
|
@@ -296,7 +296,18 @@
|
|
|
this.hasSeeked = false
|
|
|
this.options = {
|
|
|
...this.options,
|
|
|
- sources: [{ src: mediaUrl, type: "application/x-mpegURL" }],
|
|
|
+ sources: [{
|
|
|
+ src: mediaUrl + (mediaUrl.includes('?') ? '&' : '?') + '_t=' + Date.now(),
|
|
|
+ type: "application/x-mpegURL"
|
|
|
+ }],
|
|
|
+ html5: {
|
|
|
+ hls: {
|
|
|
+ xhrSetup(xhr) {
|
|
|
+ xhr.setRequestHeader('Cache-Control', 'no-cache, no-store, must-revalidate')
|
|
|
+ xhr.setRequestHeader('Pragma', 'no-cache')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
playtimes: this.media.position || 0,
|
|
|
autoplay: true
|
|
|
}
|
|
|
@@ -334,11 +345,6 @@
|
|
|
},
|
|
|
onPlayerError(event) {
|
|
|
console.error("Video error:", event)
|
|
|
- let player = this.$refs.videoPlayer && this.$refs.videoPlayer.player
|
|
|
- if (player && player.reset) {
|
|
|
- player.reset()
|
|
|
- setTimeout(() => this.safePlay(player), 500)
|
|
|
- }
|
|
|
},
|
|
|
onPlayerTimeupdate(player) {
|
|
|
let curTimes = player.currentTime();
|
|
|
@@ -410,8 +416,8 @@
|
|
|
doPause() {
|
|
|
this.stopTick()
|
|
|
this.onPlay = false
|
|
|
- let myPlayer = this.$refs.videoPlayer.player;
|
|
|
- myPlayer && myPlayer.pause()
|
|
|
+ let myPlayer = this.$refs.videoPlayer && this.$refs.videoPlayer.player
|
|
|
+ if (myPlayer) myPlayer.pause()
|
|
|
},
|
|
|
doPlay() {
|
|
|
this.onPlay = true
|
|
|
@@ -548,7 +554,12 @@
|
|
|
src: mediaUrl,
|
|
|
type: "application/x-mpegURL"
|
|
|
}],
|
|
|
- playtimes: position,
|
|
|
+ html5: {
|
|
|
+ hls: {
|
|
|
+ overrideNative: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ playtimes: this.media.position || 0,
|
|
|
autoplay: true
|
|
|
}
|
|
|
this.startTick()
|