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

WIP: Possible fix for Starting song radio from queue creates a queue based on the wrong song #263 #264

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Millencolin
Copy link
Contributor

What is it?

  • New feature (user facing)
  • Update to existing feature (user facing)
  • Bugfix (user facing)
  • Codebase improvements or refactors (dev facing)
  • Other

Description of the changes in your PR

This is a possible fix for #263.

However:
It would probably be better to call startRadioSeamlessly with mediaMetadata as parameter and handling the logic of selecting the right songs in there.

Also adding another method in queueBoard to handle adding the songs and start it without interrupting the currently playing song would probably be cleaner than calling queueBoard.addQueue / queueBoard.setCurrQueuePosIndex.

I didn't want to start modifying too many things and let you use this code as a base to fix the issue

@mikooomich
Copy link
Collaborator

Ah. I see you've stumbled upon mymultiqueue mess.

Other than continuation not being supported, seamless switching (I didn't know this existed) isn't either. For non-seamless, it isn't hard, just do this and queueboard should already handle it fine.

playerConnection.playQueue(YouTubeQueue.radio(song.toMediaMetadata()))

For seamless, media items in player can be updated with player.replaceMediaItems() without interrupting playback, then sync with queueboard as you said ---> the add function in queueboard needs to be modified for seamless...... and that should be it(?)

Also adding another method in queueBoard to handle adding the songs and start it without interrupting the currently playing song would probably be cleaner than calling queueBoard.addQueue / queueBoard.setCurrQueuePosIndex.

I think shuffle, enqueue, reorder all modify the player seamlessly, but do so in different ways. Would it be better to have one function to handle all this instead?

@Millencolin Millencolin force-pushed the fix-start-radio-from-queue branch from b1f2388 to 9d3c953 Compare January 30, 2025 20:29
@Millencolin Millencolin force-pushed the fix-start-radio-from-queue branch from 9d3c953 to ee7d719 Compare January 30, 2025 20:30
@Millencolin
Copy link
Contributor Author

I updated the code:

It now uses playerConnection.playQueue(YouTubeQueue.radio(song.toMediaMetadata())) to start playback from the android auto song radio toggle as well ( I saw that you already changed that in one of the calls using startRadioSeamlessly )

To make seamless playback work I did the following:

Modified QueueBoard::setCurrQueue:

  • If the currently playing song matches the first item of the media items that we are adding => seamless playback: I remove all songs from the player except the currently playing one and add the new items. (player.replaceMediaItems does not work since it seems to stop playback)

  • If the first item of the media items does not match the currently playing song it replaces the whole list of media items in the player which matches the current behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants