mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-16 00:42:37 +00:00
fix: don't restart stream on next-track media key when no next video
The 'next-track' media-key handler called video.setTime(0) before checking whether a next video existed. onNextVideoRequested() no-ops when player.nextVideo is null, but the unconditional setTime(0) had already rewound the current stream — causing movies (which have no next video) to restart from the beginning when the Windows next-track media key was pressed. Guard both calls with the same player.nextVideo check that the navigator.mediaSession 'nexttrack' handler already uses.
This commit is contained in:
parent
17d823565a
commit
f579873e1b
1 changed files with 5 additions and 3 deletions
|
|
@ -650,8 +650,10 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
video.state.paused ? onPlayRequested() : onPauseRequested();
|
video.state.paused ? onPlayRequested() : onPauseRequested();
|
||||||
break;
|
break;
|
||||||
case 'next-track':
|
case 'next-track':
|
||||||
video.setTime(0);
|
if (player.nextVideo !== null) {
|
||||||
onNextVideoRequested();
|
video.setTime(0);
|
||||||
|
onNextVideoRequested();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'previous-track':
|
case 'previous-track':
|
||||||
if (video.state.time !== null && video.state.time > 5000) {
|
if (video.state.time !== null && video.state.time > 5000) {
|
||||||
|
|
@ -662,7 +664,7 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
};
|
};
|
||||||
shell.on('media-key', onMediaKey);
|
shell.on('media-key', onMediaKey);
|
||||||
return () => shell.off('media-key', onMediaKey);
|
return () => shell.off('media-key', onMediaKey);
|
||||||
}, [video.state.paused, video.state.time, onPlayRequested, onPauseRequested, onNextVideoRequested, onSeekRequested]);
|
}, [video.state.paused, video.state.time, player.nextVideo, onPlayRequested, onPauseRequested, onNextVideoRequested, onSeekRequested]);
|
||||||
|
|
||||||
onShortcut('seekForward', (combo) => {
|
onShortcut('seekForward', (combo) => {
|
||||||
if (video.state.time !== null) {
|
if (video.state.time !== null) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue