1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix playback control issues with chromecast

This commit is contained in:
Sky-High 2023-10-19 13:05:56 +02:00 committed by Bill Thornton
parent 7df0ffcdfc
commit 108e00ac45
5 changed files with 125 additions and 66 deletions

View file

@ -170,17 +170,20 @@ function bindEvents(elem) {
elem.querySelector('.previousTrackButton').addEventListener('click', function (e) {
if (currentPlayer) {
if (lastPlayerState.NowPlayingItem.MediaType === 'Audio') {
if ( playbackManager.isPlayingAudio(currentPlayer) ) {
// Cancel this event if doubleclick is fired. The actual previousTrack will be processed by the 'dblclick' event
if (e.detail > 1 ) {
return;
}
// Return to start of track, unless we are already (almost) at the beginning. In the latter case, continue and move
// to the previous track, unless we are at the first track so no previous track exists.
if (currentPlayer._currentTime >= 5 || playbackManager.getCurrentPlaylistIndex(currentPlayer) <= 1) {
// currentTime is in msec.
if (playbackManager.currentTime(currentPlayer) >= 5 || playbackManager.getCurrentPlaylistIndex(currentPlayer) <= 1) {
playbackManager.seekPercent(0, currentPlayer);
// This is done automatically by playbackManager, however, setting this here gives instant visual feedback.
// TODO: Check why seekPercentage doesn't reflect the changes inmmediately, so we can remove this workaround.
// TODO: Check why seekPercent doesn't reflect the changes inmmediately, so we can remove this workaround.
positionSlider.value = 0;
return;
}
@ -574,7 +577,10 @@ function updateNowPlayingInfo(state) {
itemContextMenu.show(Object.assign({
item: item,
user: user
}, options));
}, options))
.catch(function (err) {
console.debug('[nowPlayingBar:updateNowPlayingInfo] click event reject', err);
});
});
});
}
@ -642,7 +648,8 @@ function hideNowPlayingBar() {
}
function onPlaybackStopped(e, state) {
console.debug('nowplaying event: ' + e.type);
console.debug('[nowPlayingBar:onPlaybackStopped] event: ' + e.type);
const player = this;
if (player.isLocalPlayer) {
@ -669,7 +676,7 @@ function onStateChanged(event, state) {
return;
}
console.debug('nowplaying event: ' + event.type);
console.debug('[nowPlayingBar:onStateChanged] event: ' + event.type);
const player = this;
if (!state.NowPlayingItem || layoutManager.tv || state.IsFullscreen === false) {