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
This commit is contained in:
Svallinn 2022-06-19 19:02:57 +01:00 committed by GitHub
parent f6abd74878
commit b1183fe0c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

@ -252,6 +252,7 @@ export default Vue.extend({
watchProgress: this.watchProgress, watchProgress: this.watchProgress,
playbackRate: this.defaultPlayback, playbackRate: this.defaultPlayback,
videoId: this.id, videoId: this.id,
videoLength: this.data.lengthSeconds,
playlistId: this.playlistId, playlistId: this.playlistId,
playlistIndex: this.playlistIndex, playlistIndex: this.playlistIndex,
playlistReverse: this.playlistReverse, playlistReverse: this.playlistReverse,

View File

@ -303,6 +303,7 @@ export default Vue.extend({
watchProgress: this.getTimestamp(), watchProgress: this.getTimestamp(),
playbackRate: this.defaultPlayback, playbackRate: this.defaultPlayback,
videoId: this.id, videoId: this.id,
videoLength: this.lengthSeconds,
playlistId: this.playlistId, playlistId: this.playlistId,
playlistIndex: this.getPlaylistIndex(), playlistIndex: this.getPlaylistIndex(),
playlistReverse: this.getPlaylistReverse(), playlistReverse: this.getPlaylistReverse(),

View File

@ -895,7 +895,7 @@ const actions = {
args.push(...defaultCustomArguments) args.push(...defaultCustomArguments)
} }
if (payload.watchProgress > 0) { if (payload.watchProgress > 0 && payload.watchProgress < payload.videoLength - 10) {
if (typeof cmdArgs.startOffset === 'string') { if (typeof cmdArgs.startOffset === 'string') {
args.push(`${cmdArgs.startOffset}${payload.watchProgress}`) args.push(`${cmdArgs.startOffset}${payload.watchProgress}`)
} else { } else {