From b1183fe0c0ee5af5bee08a4880f9025259c769fd Mon Sep 17 00:00:00 2001 From: Svallinn <41585298+Svallinn@users.noreply.github.com> Date: Sun, 19 Jun 2022 19:02:57 +0100 Subject: [PATCH] Utils+Everywhere: Add a start offset tolerance for the external player (#2325) 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 682ecef1..5f31a7ff 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 8f2518fe..0d218f2b 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 a8bdb99e..d0d2be5e 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 {