Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blocking error when navigating away from an age-restricted video #5343

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,9 +1100,9 @@ export default defineComponent({

handleWatchProgress: function () {
if (this.rememberHistory && !this.isUpcoming && !this.isLoading && !this.isLive) {
const player = this.$refs.videoPlayer.player
const player = this.$refs.videoPlayer?.player

if (player !== null && this.saveWatchedProgress) {
if (player && this.saveWatchedProgress) {
const currentTime = this.getWatchedProgress()
const payload = {
videoId: this.videoId,
Expand Down Expand Up @@ -1339,7 +1339,7 @@ export default defineComponent({
return
}

if (this.watchingPlaylist && this.$refs.watchVideoPlaylist.shouldStopDueToPlaylistEnd) {
if (this.watchingPlaylist && this.$refs.watchVideoPlaylist && this.$refs.watchVideoPlaylist.shouldStopDueToPlaylistEnd) {
absidue marked this conversation as resolved.
Show resolved Hide resolved
// Let `watchVideoPlaylist` handle end of playlist, no countdown needed
this.$refs.watchVideoPlaylist.playNextVideo()
return
Expand All @@ -1359,8 +1359,8 @@ export default defineComponent({

const nextVideoInterval = this.defaultInterval
this.playNextTimeout = setTimeout(() => {
const player = this.$refs.videoPlayer.player
if (player !== null && player.paused()) {
const player = this.$refs.videoPlayer?.player
if (player && player.paused()) {
if (this.watchingPlaylist) {
this.$refs.watchVideoPlaylist.playNextVideo()
} else {
Expand Down Expand Up @@ -1408,9 +1408,9 @@ export default defineComponent({
this.handleWatchProgress()

if (!this.isUpcoming && !this.isLoading) {
const player = this.$refs.videoPlayer.player
const player = this.$refs.videoPlayer?.player

if (player !== null && !player.paused() && player.isInPictureInPicture()) {
if (player && !player.paused() && player.isInPictureInPicture()) {
setTimeout(() => {
player.play()
player.on('leavepictureinpicture', (event) => {
Expand Down