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

View File

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