Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the new player to nextTrack to allow mixed playlist playback #5488

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kevgrig
Copy link

@kevgrig kevgrig commented May 13, 2024

Changes
When a playlist is stopped (e.g. track finishes), if the player for the next playlist item is different, then this new player needs to be used as otherwise the current player has been nulled out.

Issues
Fixes #5486

Signed-off-by: Kevin G <kevin@myplaceonline.com>
@kevgrig kevgrig requested a review from a team as a code owner May 13, 2024 02:53
Copy link

sonarcloud bot commented May 13, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@dmitrylyzo dmitrylyzo added bug Something isn't working playback This PR or issue mainly concerns playback labels May 13, 2024
@dmitrylyzo dmitrylyzo added this to In progress in Release 10.9.z via automation May 13, 2024
@jellyfin-bot
Copy link
Collaborator

Cloudflare Pages deployment

Latest commit 8f03986
Status ✅ Deployed!
Preview URL https://af3d0705.jellyfin-web.pages.dev
Type 🔀 Preview

View build logs
View bot logs

@dmitrylyzo
Copy link
Contributor

It crashes here (the player has been killed on the stop event):

function getPreviousSource(player) {
const prevSource = self.currentMediaSource(player);

IMO, passing a new player breaks the logic - getting the previous source from the new player.

We probably need to change this check:

if (newPlayer !== player) {

to !newPlayer.

This:


to newPlayer.

And kill the player after the event is triggered:

Events.trigger(self, 'playbackstop', [{
player: activePlayer,
state: state,
nextItem: newItem,
nextMediaType: newItem.MediaType
}]);

So the previous player will be alive until it is no longer needed (for the next item).

In fact, our playback code is a mess and requires a lot of refactoring. At first glance, we should also kill the player on error, but this is probably handled by onInterceptorRejection.

@thornbill thornbill added this to the v10.9.2 milestone May 13, 2024
@kevgrig
Copy link
Author

kevgrig commented May 15, 2024

Makes sense, thanks. I'll try it out when I have a chance.

@thornbill thornbill modified the milestones: v10.9.2, v10.9.3, v10.10.0 May 17, 2024
@thornbill thornbill removed this from In progress in Release 10.9.z May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working playback This PR or issue mainly concerns playback
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

Going from a video to audio in a playlist fails with Uncaught (in promise) Error: player cannot be null
4 participants