Author Topic: UPnP 2025 - Continuation of the original UPnP/DLNA plugin  (Read 35188 times)

BoringName

  • Sr. Member
  • ****
  • Posts: 916
UPnP 2025

Available here - UPnP 2025

This is a fork of the original UPnP plugin created by Steven.

I was going to call it UPnP 2.0 but didn’t want to imply that it supports the UPnP Device architecture 2.0 standard, because it doesn’t….. yet.

Changes
- Converted all the code from VB to C#.
- Changed the Net target to 4.8
- Small layout adjustments to the config page.
- Removed references to FileCodec.AnyPCM as that is no longer part of the Musicbee API.
- Added support for Podcasts (downloaded only). I took some tips from GoodMorning’s fork to do this.
- Adjusted some of the default profiles to reflect current capabilities and added some new ones. Eg) BubbleUPnP now supports higher sample rates. In fact it pretty much supports anything. By default BubbeUPnP is set to downmix multi channel audio to stereo. If you toggle that off you can stream 192 kHz 6 channel audio straight to it, no transcoding. This worked with Flac and Ogg (Vorbis) for me. You also need to uncheck the "stereo only" checkbox in the plugin settings.

I’ve currently only tested it running the BubbleUPnP app on my android 14 mobile and an LGB6OLED TV from 2016 and it seems to work fine on both.

I’m testing it on 3.6.9143 P and haven’t noticed any crashes or memory leak problems rumoured in the other thread.

I have done no testing at all with using Musicbee to play to UPnP device. I have a vested interest in getting this working with modern devices so that will be worked on.

I just wanted to get this out as a starting point which hopefully will help some users as it should work with current versions of Musicbee.

I have some experience with DLNA servers, I helped get some things working on Serviio for sony bluray players a decade ago but my knowledge of UPnP and everything associated with it is very limited. I need to get up to speed on the UPnP documentation and the standards. The plan is to add support for modern UPnP standards to this plugin.

So for now, please don’t fill the thread with wishlists and issues you are having. I’m sure a good chunk of them are related to mismatched standards which I will get to.

In the meantime. The following might help you with any current issues.

To match a profile to your device the User Agent field is the key. To find the user agent your device is using.
- Check “log debug information”
- Click Save.
- Start your device and tap the Musicbee server
- Open the UPnP config page again in Musicbee and click the “View” button
You should see entries ending like this -
useragent=Android/14 UPnP/1.0 BubbleUPnP/4.4.9
useragent=Linux/3.10.19-p.57.digya.k2l.2 UPnP/1.0 LGE WebOS TV LGE_DLNA_SDK/1.6.0/05.70.40 DLNADOC/1.50

The values you need to worry about are highlighted in blue.

You need to set the “applies when user-agent contains” field to match this user-agent name. eg) for the LG TV above you could use “LGE” or  “LGE WebOS” or the full name “ LGE WebOS TV LGE_DLNA_SDK”. They will all match and use that profile.

You can set a profile to match multiple user-agents by separating them with a pipe symbol. Eg) if you set the field to “Bubble | LGE WebOS” it will match to both devices.

To make sure it’s using the correct profile, restart your device and Musicbee and check the debug log again, it should list what profile is being used for your device. Remember to uncheck the log debug checkbox and click save when you’re done troubleshooting. To clear the log you can just click view which opens it in notepad. Hit ctrl+a to select everything, hit delete and save it.

The other settings are thresholds and if the selected song is outside those thresholds it will be transcoded to be within the thresholds, otherwise it will direct stream the song to the device as long as your device advertises it can play the format. eg) if it’s Flac and your device doesn’t advertise it can play Flac, it will be transcoded even if it’s within the thresholds above.

When a song is transcoded it will follow the “output format” and “output sample rate” values.

As it states, the “force transcode” setting is global and applies to all profiles when checked.

Note: if you set the output format to PCM - 24 bit but have the “maximum bit depth” for that profile set to 16, it will save the output format as PCM – 16.

The “stereo only” checkbox will force a transcode on anything that isn’t 2 channels. Whether it’s mono or 5.1

If songs are getting transcoded even though the profile is matching and the song is within the thresholds, make sure your device is not transcoding, when I was testing 5.1 Flac and Ogg files it took me a while to figure out it was actually BubbleUPnP downmixing the incoming stream to stereo.


And just to pre-empt some queries. Here are some things that I am not going to do.

- Enable streaming to multiple devices at the same time.
- Enable streaming outside of the local network. You’re probably better off using something like Emby/Plex for this anyway. I highly recommend Emby, been using it for years and it’s fantastic.
- Do workarounds for obscure devices that don’t work because they are not following UPnP standards.

If devices are not being detected at all you should check firewall settings. Especially if the debug log states a connection was actively refused. If you’re having issues with a device newer than 2020, there is a good chance it’s not going to work until I update the plugin to handle modern UPnP standards. I can’t give a timeline for this, I’ll just say soon™.

edit: This plugin has a different filename to the original so make sure you disable the original and backup the \AppData\UPnPSettings.dat file if you want to experiment with the new version. Running them both at once probably won't be good.
Last Edit: January 25, 2025, 10:25:29 AM by BoringName


hiccup

  • Hero Member
  • *****
  • Posts: 9107
When I tried and installed it first, MusicBee would start but then immediately shut-down again within a second or so.
It was a quite recent version of 3.6, but not the very latest.
After installing the latest patch update (3.6.9156) MusicBee started properly again.

So, it might be good to clearly mention that there is some minimum version requirement.

sveakul

  • Hero Member
  • *****
  • Posts: 3262
Thanks Boring_Name you've made a lot of people happy with this one I'm sure!

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10266
Nicely done, BoringName.

This worked right out of the box with my Internet radio. All default settings. Haven't changed a thing.

Thanks for yet another wonderful BoringName project.
Download the latest MusicBee v3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Custom Forum Search
Posting screenshots is here

hiccup

  • Hero Member
  • *****
  • Posts: 9107
This worked right out of the box with my Internet radio. All default settings. Haven't changed a thing.
Could you also try it with LMS if/when you have the time?
(if I recall correctly, you are using that too, same as me?)
I can't get it to work (while I had it working to some extend in the past), but me failing now may be a result of the brain cells that were tasked for that job then have by now retired or have found another job.

LMS should be showing up in this 'output' dropdown, shouldn't it?



edit:
LMS used to be Logitech Media Server, but the (very active) community is now maintaining and releasing it as Lyrion Music Server
Last Edit: January 25, 2025, 04:13:50 PM by hiccup

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10266

Could you also try it with LMS if/when you have the time?
(if I recall correctly, you are using that too, same as me?)
You used to know, but you forgot??
Yes, I'm still using LMS (now rebranded as Lyrion) albeit with one less device.
I've never used it with DLNA, but I'm willing to test it for you.
Answer me one question before I do so --- are you using the plugin? By Andy Grundman? As it's the only DLNA option I see. Unless there's something built in that I've missed.

And yes, their forum is fantastic even with the new branding. Very detailed, very helpful.
Download the latest MusicBee v3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Custom Forum Search
Posting screenshots is here

hiccup

  • Hero Member
  • *****
  • Posts: 9107
Answer me one question before I do so --- are you using the plugin? By Andy Grundman? As it's the only DLNA option I see. Unless there's something built in that I've missed.
I don't think I ever used an additional plugin for LMS for this, but I could be wrong.

My setup:
LMS as a server, controlling and playing music to three Squeezebox Classic players. (for three rooms)
That has been working fine for many years now.
What I additionally would want to be able to do, is using MusicBee with the UPnP plugin to use LMS as the output, and then LMS sending the music to my Squeezeboxes.
In the past I got that to work with the original UPnP/DNLA plugin, but it had too many issues, so I abandoned it.

I should probably put in some time to get a better understanding of everything involved. The new Lyrion forum will probably also be helpful with that.
And I will check out if the plugin that you mentioned might be a part of the solution.

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10266
And I will check out if the plugin that you mentioned might be a part of the solution.
Let me know if the plugin accomplishes your goal. If not, I will test it on my side.

As I said, I've never used/needed DLNA/UPNP to listen to music on my Squeezebox devices.
Download the latest MusicBee v3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Custom Forum Search
Posting screenshots is here

hiccup

  • Hero Member
  • *****
  • Posts: 9107
As I said, I've never used/needed DLNA/UPNP to listen to music on my Squeezebox devices.
OK, so to be clear: you never tried to use MusicBee as the controller to send music to play on your Squeezeboxes?

PS
After installing an older Logitech LMS version that I am more familiar with (v7.7), I noticed a checkbox setting in LMS to activate 'UPnP/DLNA Media Interface'.
I probably had that one checked in the ole days, and I see it mentioned that it was indeed created by this 'Andy Grundman'.
I'll see if I can get things to work again with 7.7, and if so, update to the latest Lyrion version (v9 or 10 I think) and see if that then works too.

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10266
OK, so to be clear: you never tried to use MusicBee as the controller to send music to play on your Squeezeboxes?
Correct.

I'm using LMS 8.5.3 and the Community Firmware 0.0.9 plugin for Radio/Touch/Controller. I have some time now, so I will add the UPNP plugin and report back.

I also don't want to hijack this thread, but since it's related to the new MB plugin, I think we're okay.
Download the latest MusicBee v3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Custom Forum Search
Posting screenshots is here

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10266
So far only minimal success.

I installed the LMS UPNP plugin, restarted LMS, restarted the Squeezebox Touch, and restarted MB.

The "living room" Squeezebox shows up in MB Preferences > Player > output.


On the Squeezebox, I went to My Music > Remote Music Libraries (only because I don't see anything in its menus that might apply.) But it says it find any other media server. So for the time being, I'm done.
Download the latest MusicBee v3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Custom Forum Search
Posting screenshots is here

BoringName

  • Sr. Member
  • ****
  • Posts: 916
When I tried and installed it first, MusicBee would start but then immediately shut-down again within a second or so.
It was a quite recent version of 3.6, but not the very latest.
After installing the latest patch update (3.6.9156) MusicBee started properly again.

So, it might be good to clearly mention that there is some minimum version requirement.


That's a strange one as there is nothing in there that needs a newer version of Musicbee. Usually that requirement is due to Steven adding a recent fix which isn't the case with this plugin. One thing that may cause an issue is if the original settings file exists from the old UPnP plugin. In hindsight I should have used a different name for the settings file to avoid any possible conflicts.

I just downloaded the portable version 3.5 into a new folder and that fired up perfectly fine with UPnP 2025 installed.

edit: Probably too late now but was there an error message in the Musicbee log or windows event viewer?
Last Edit: January 25, 2025, 10:56:28 PM by BoringName

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Probably worth mentioning that I have changed absolutely nothing with how the UPnP operations function. So any issues you had in that regard with the original plugin will still be there for now.

The only thing this version should do is fix some possible compatibility problems with newer versions of musicbee.

It's going to be a while before I work on UPnP compatibility.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
After going through the UPnP 2.0 spec (it's a real page turner....) I can say the likelihood of me updating this plugin to meet that standard is extraordinarily small. Mainly because it requires implementing UCA which is a cloud based version of UPnP and adds a lot of complexity to the code which is completely unnecessary for what it needs to do. It also forces IPv6 compatibility.

It's not all bad news. I can still implement IPv6 support as part of the 1.1 standard, it's just not compulsory.

The UPnP 2.0 spec also states UPnP 2.0 devices and control points must be backwards compatible with UPnP 1.1, It just means UPnP 2.0 only functions won't be available to UPnP 1.1. Apart from UCA I can't really see anything in 2.0 that will reduce functionality of this plugin, most of the changes are just in header formats and the UCA implementation.

On top of the main UPnP specs there are specs for difference devices/services like MediaRenderer:1, AVTransport:1 etc... these are the elements that actually provide the functionality with this plugin and there are few different versions of each, some of which are currently not supported. They are all supposed to be backwards compatible but I'll start by adding support for the newer versions and see how that goes.