Prevent PiP video from repeating if video is finished. Also prevent it from holding up navigation on rare occasions

This commit is contained in:
Preston 2020-09-22 16:19:21 -04:00
parent 32c3e143c8
commit 6bf54a1dd7
1 changed files with 3 additions and 2 deletions

View File

@ -663,14 +663,15 @@ export default Vue.extend({
this.updateWatchProgress(payload) this.updateWatchProgress(payload)
} }
if (player.isInPictureInPicture()) { if (player !== null && !player.paused() && player.isInPictureInPicture()) {
const playerId = this.videoId
setTimeout(() => { setTimeout(() => {
player.play() player.play()
player.on('leavepictureinpicture', () => { player.on('leavepictureinpicture', () => {
const watchTime = player.currentTime() const watchTime = player.currentTime()
if (this.$route.fullPath.includes('/watch')) { if (this.$route.fullPath.includes('/watch')) {
const routeId = this.$route.params.id const routeId = this.$route.params.id
if (routeId === this.videoId) { if (routeId === playerId) {
const activePlayer = $('.ftVideoPlayer video').get(0) const activePlayer = $('.ftVideoPlayer video').get(0)
activePlayer.currentTime = watchTime activePlayer.currentTime = watchTime
} }