From c9c6b38627b61dce8b047f16cfd1b9a369b272e0 Mon Sep 17 00:00:00 2001 From: Svallinn <41585298+Svallinn@users.noreply.github.com> Date: Sun, 19 Jun 2022 20:09:24 +0100 Subject: [PATCH] Utils+Everywhere: Add a start offset tolerance for the external player (#2326) If a current video is practically over or the value in the history's watch progress is almost the same as the length of the video, it's safe to deduce that if the external player button is clicked, the user is most likely just rewatching the video, making no sense to pass a start offset to it --- src/renderer/components/ft-list-video/ft-list-video.js | 1 + src/renderer/components/watch-video-info/watch-video-info.js | 1 + src/renderer/store/modules/utils.js | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/ft-list-video/ft-list-video.js b/src/renderer/components/ft-list-video/ft-list-video.js index 682ecef11..5f31a7ff0 100644 --- a/src/renderer/components/ft-list-video/ft-list-video.js +++ b/src/renderer/components/ft-list-video/ft-list-video.js @@ -252,6 +252,7 @@ export default Vue.extend({ watchProgress: this.watchProgress, playbackRate: this.defaultPlayback, videoId: this.id, + videoLength: this.data.lengthSeconds, playlistId: this.playlistId, playlistIndex: this.playlistIndex, playlistReverse: this.playlistReverse, diff --git a/src/renderer/components/watch-video-info/watch-video-info.js b/src/renderer/components/watch-video-info/watch-video-info.js index 8f2518fe9..0d218f2ba 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.js +++ b/src/renderer/components/watch-video-info/watch-video-info.js @@ -303,6 +303,7 @@ export default Vue.extend({ watchProgress: this.getTimestamp(), playbackRate: this.defaultPlayback, videoId: this.id, + videoLength: this.lengthSeconds, playlistId: this.playlistId, playlistIndex: this.getPlaylistIndex(), playlistReverse: this.getPlaylistReverse(), diff --git a/src/renderer/store/modules/utils.js b/src/renderer/store/modules/utils.js index a8bdb99e2..d0d2be5e7 100644 --- a/src/renderer/store/modules/utils.js +++ b/src/renderer/store/modules/utils.js @@ -895,7 +895,7 @@ const actions = { args.push(...defaultCustomArguments) } - if (payload.watchProgress > 0) { + if (payload.watchProgress > 0 && payload.watchProgress < payload.videoLength - 10) { if (typeof cmdArgs.startOffset === 'string') { args.push(`${cmdArgs.startOffset}${payload.watchProgress}`) } else {