getmusicbee.com

Support => Developers' Area => MusicBee API => Topic started by: BoringName on February 22, 2025, 04:24:35 AM

Title: UPnP woes with SetNextAVtransportURI
Post by: BoringName on February 22, 2025, 04:24:35 AM
TL;DR

Is there a way to get musicbee to play a track without calling Player_PlayNextTrack()

Long version.
I'm trying to get gapless playback working with SetNextAVTransportURI.

I've got the main functionality working. Foobar will play a track and automatically GET the NextURI stream from musicbee and transition to it with no gaps. All good.

The issue is musicbee still displays that it's playing the first song and doesn't realise foobar has moved to the next track. The progress bar in the player control panel goes over 100%.  I can check for when this occurs but I can't figure out how to get musicbee to show it's playing the next track without calling Player_PlayNextTrack().

But calling player_PlayNextTrack closes the foobar stream and stops it playing. I assume this is just a failsafe to make sure streams are not left open all over the place. I can tell foobar to re-GET the stream but that defeats the purpose of using NextURI.

Title: Re: UPnP woes with SetNextAVtransportURI
Post by: Steven on February 22, 2025, 04:57:35 AM
There is a function already that looks like what you need. I have exposed it by calling: MB_SendNotification
you need to add
NextTrackPlayStarted = 17 to the list of notification types

https://getmusicbee.com/patches/MusicBee36_Patched.zip
Title: Re: UPnP woes with SetNextAVtransportURI
Post by: BoringName on February 22, 2025, 05:09:27 AM
There is a function already that looks like what you need. I have exposed it by calling: MB_SendNotification
you need to add
NextTrackPlayStarted = 17 to the list of notification types

https://getmusicbee.com/patches/MusicBee36_Patched.zip

17 is already used for "ShutdownStarted". Does NextTrackPlayStarted replace it?

Nevermind, I was looking in the wrong spot.

That's got me most of the way there. The progress bar in the player controls panel turns into a total mess but I should be able to figure that out. Thanks.
Title: Re: UPnP woes with SetNextAVtransportURI
Post by: Steven on February 22, 2025, 05:45:03 AM
if you let me know what needs to be done, i will make an enhancement
it sounds like the progress bar needs to be reset
anything else?

edit:
perhaps you could send me the plugin.dll - does the api work with foobar? I dont have bubble installed
Title: Re: UPnP woes with SetNextAVtransportURI
Post by: BoringName on February 22, 2025, 06:14:43 AM
if you let me know what needs to be done, i will make an enhancement
it sounds like the progress bar needs to be reset
anything else?

edit:
perhaps you could send me the plugin.dll - does the api work with foobar? I dont have bubble installed

All good for now. I just set the track position to zero before calling NextTrackPlayStarted and that's fixed it.

It's mostly working with 32 bit foobar with the UPNP plugin installed. As long as the stream is not PCM. With PCM, foobar will open a bunch of streams and not close them. With MP3 streams, version 1.4 of the plugin works perfectly.

The version I'm working on now is a bit of a mess from me trying to sort out this NextURI stuff so it's not fully functional at the moment. I'm on the home stretch I think,  I have solutions for all the current problems, I just need to write the code. I need to stop testing with BubbleUPnP, it does too many things off spec and just wastes my time over things I ultimately can't fix because it's a BubbleUPnP problem.

Thanks.
Title: Re: UPnP woes with SetNextAVtransportURI
Post by: BoringName on February 22, 2025, 11:51:58 PM
Actually I'm still having issues with the player controls after calling NextTrackPlayStarted

Seeking stops working correctly. SetPlayPosition is called with the current position value instead of the value I'm trying to seek to.
I can click pause which stops playing the track but then the play button is unresponsive.
Clicking the previous or next track controls moves to another track and everything starts working normally after that.
Title: Re: UPnP woes with SetNextAVtransportURI
Post by: Steven on February 23, 2025, 03:59:41 AM
i really need your plugin in order to see what is going on. Could you also let me know which settings are enabled. I can use foobar as the player
Title: Re: UPnP woes with SetNextAVtransportURI
Post by: BoringName on February 23, 2025, 04:28:19 AM
PM sent.

Thanks.