|
@@ -5,20 +5,29 @@
|
|
|
<ion-buttons slot="start">
|
|
<ion-buttons slot="start">
|
|
|
<ion-back-button text="" default-href="#" @click="$router.back()"></ion-back-button>
|
|
<ion-back-button text="" default-href="#" @click="$router.back()"></ion-back-button>
|
|
|
</ion-buttons>
|
|
</ion-buttons>
|
|
|
- <ion-title>{{ `第${curEpInfo.episodeNum}集` }}</ion-title>
|
|
|
|
|
|
|
+ <ion-title v-if="curEpInfo && curEpInfo.episodeNum">{{ `第${curEpInfo.episodeNum}集` }}</ion-title>
|
|
|
</ion-toolbar>
|
|
</ion-toolbar>
|
|
|
</ion-header>
|
|
</ion-header>
|
|
|
<ion-content class="view van-safe-area-bottom">
|
|
<ion-content class="view van-safe-area-bottom">
|
|
|
- <video
|
|
|
|
|
|
|
+ <!-- <div class="video-content">
|
|
|
|
|
+ <video
|
|
|
|
|
+ ref="videoRef"
|
|
|
|
|
+ :controls="false"
|
|
|
|
|
+ muted
|
|
|
|
|
+ playsinline="true"
|
|
|
|
|
+ webkit-playsinline="true"
|
|
|
|
|
+ class="video"
|
|
|
|
|
+ :src="curEpInfo.playUrl"
|
|
|
|
|
+ :poster="poster"
|
|
|
|
|
+ ></video>
|
|
|
|
|
+ <div class="video-box"></div>
|
|
|
|
|
+ </div> -->
|
|
|
|
|
+ <video-player
|
|
|
ref="videoRef"
|
|
ref="videoRef"
|
|
|
- controls
|
|
|
|
|
- muted
|
|
|
|
|
- playsinline="true"
|
|
|
|
|
- webkit-playsinline="true"
|
|
|
|
|
- class="video"
|
|
|
|
|
- :src="curEpInfo.playUrl"
|
|
|
|
|
|
|
+ :playUrl="curEpInfo.playUrl"
|
|
|
:poster="poster"
|
|
:poster="poster"
|
|
|
- ></video>
|
|
|
|
|
|
|
+ @videoEnded="videoEnded"
|
|
|
|
|
+ ></video-player>
|
|
|
|
|
|
|
|
<div class="right-fixed">
|
|
<div class="right-fixed">
|
|
|
<div class="right-btn" @click="collect">
|
|
<div class="right-btn" @click="collect">
|
|
@@ -78,6 +87,7 @@ import { showNotify } from 'vant'
|
|
|
import resolveUrl from 'resolve-url'
|
|
import resolveUrl from 'resolve-url'
|
|
|
import { nextTick } from 'vue'
|
|
import { nextTick } from 'vue'
|
|
|
import toast from '@/utils/toast'
|
|
import toast from '@/utils/toast'
|
|
|
|
|
+import VideoPlayer from '@/components/VideoPlayer.vue'
|
|
|
|
|
|
|
|
const poster = ref('')
|
|
const poster = ref('')
|
|
|
|
|
|
|
@@ -144,8 +154,9 @@ async function play(curEpId = 0, duration = 0) {
|
|
|
} else {
|
|
} else {
|
|
|
curEpInfo.value = res
|
|
curEpInfo.value = res
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
- videoRef.value.currentTime = duration
|
|
|
|
|
|
|
+ videoRef.value.setCurrent(duration)
|
|
|
videoRef.value.play()
|
|
videoRef.value.play()
|
|
|
|
|
+ videoRef.value.changeMuted()
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -202,7 +213,7 @@ function showVideoHistory() {
|
|
|
|
|
|
|
|
const videoRef = ref(null)
|
|
const videoRef = ref(null)
|
|
|
onBeforeRouteLeave((to, from, next) => {
|
|
onBeforeRouteLeave((to, from, next) => {
|
|
|
- saveHistories(videoRef.value.currentTime).finally(() => {
|
|
|
|
|
|
|
+ saveHistories(videoRef.value.getCurrent()).finally(() => {
|
|
|
next()
|
|
next()
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
@@ -219,16 +230,11 @@ async function saveHistories(time) {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-onMounted(() => {
|
|
|
|
|
- nextTick(() => {
|
|
|
|
|
- videoRef.value.addEventListener('ended', () => {
|
|
|
|
|
- console.log('播放结束')
|
|
|
|
|
- getEpisodes(curEpInfo.value.episodeNum + 1).then(() => {
|
|
|
|
|
- saveHistories(videoRef.value.currentTime)
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
|
|
+function videoEnded() {
|
|
|
|
|
+ getEpisodes(curEpInfo.value.episodeNum + 1).then(() => {
|
|
|
|
|
+ saveHistories(videoRef.value.getCurrent())
|
|
|
})
|
|
})
|
|
|
-})
|
|
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
function playVideo(num) {
|
|
function playVideo(num) {
|
|
|
getEpisodes(num, 0)
|
|
getEpisodes(num, 0)
|
|
@@ -283,9 +289,4 @@ function playVideo(num) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-.video {
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- height: calc(100vh - 95px - env(safe-area-inset-bottom) - env(safe-area-inset-top));
|
|
|
|
|
-}
|
|
|
|
|
</style>
|
|
</style>
|