Audio Player 2.4.0 - supporting SONOS

Hi there,
I am happy to announce that as of todays 2.4.0, Audio Player has some interesting new Features.


SONOS Playback
Settings let you choose between classical streaming to the browser or SONOS playback.
After selecting one from the available players, Audio Player will act a s a remote and fill the SONOS’ queue.

Attention: Audio Player does not stream to SONOS via Airplay or whatever. It just tells your speaker where to find the titles.

There are a some important prerequisites to understand.

This is the first version with some topics still open (webstream urls; currenty playing indicator). I am happy to get your feedbacks


Dashboard Widget
A test-widget (non playing yet) for the upcoming cool new gridstack version of the Dashboard App


various fixes and enhancements like reworked user-settings-menu and upgraded getID3 library


Enjoy!
If you like it, I am happy to get some drinks

Changelog / Full release history
Bug Reports and Feature Requests

2 Likes

Hi Rello,
thanks for the great app. I need support to use sonos playback please.

I use auido player V2.6.0 and sonos zp90. In the settings its not possible to set a sonos player because of an empty dropdown list. Is there another possibility to define a sonos player?

image
image
image …after confirming the error message

thanks for your help.
Lucy

@Rello ,

I have the same problem as @Lucy_de_Light , an empty Sonos dropdown menu , this would be awesome to get this working with sonos.
Also quick question the local smb path is just the directory that nextcloud stores the audio files in , right?
I don’t need to anything else?

thanks in advance

Hello @Greylinux @Lucy_de_Light
is the issue still open?
the NC server needs to be in the same network segment as the sonos players. Then its using some standard called multicast. thats the same feature the sonos app on the mobile uses to find the players.

…anything in the nextcloud log?

Hi Rello , yeah issue still exists strangely I have a home assistant instance that has detected the Sonos speakers and I believe that too uses multicast . Is it possible the firewall has something to do with it ?. I am using NextcloudPi and so I’ve started the UFW firewall via the UI so I haven’t added any rules for local incoming traffic. I’m not in front on my instance at the moment so I can’t check the log for you yet I’ll post anything I find here

yes, ufw should block it.

I found different parts

or go via the multicast IP

let me know what you found out. I am happy to add it to the wiki!

1 Like

Ok, So i’m a step closer now , i allowed access to the local IP of the Sonos speaker to all ports, for the moment ! and i can now discover the speaker. Adding the multicast rule and work around mentioned in the link didn’t work. But the first solution did .

However when I select the speaker and direct it to my media folder which i believe is at
/media/mydrivename/ncdata/admin/files/Music i get an error that the speaker isn’t available


this is the nextcloud log

Error	index	Exception: Error sending command: HTTP/1.1 500 Internal Server Error CONTENT-LENGTH: 347 CONTENT-TYPE: text/xml; charset="utf-8" EXT: Server: Linux UPnP/1.0 Sonos/48.2-61220 (ZPS1) Connection: close s:ClientUPnPError

    /var/www/nextcloud/apps/audioplayer/3rdparty/PHPSonos.php - line 2188:

    PHPSonos->sendPacket("POST /Media ... >")

    /var/www/nextcloud/apps/audioplayer/lib/Controller/SonosController.php - line 75:

    PHPSonos->AddToQueue("x-file-cifs://")

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 166:

    OCA\audioplayer\Controller\SonosController->setQueue([ "6965"], "0")

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 99:

    OC\AppFramework\Http\Dispatcher->executeController(OCA\audiopla ... {}, "setQueue")

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 118:

    OC\AppFramework\Http\Dispatcher->dispatch(OCA\audiopla ... {}, "setQueue")

    /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47:

    OC\AppFramework\App::main("OCA\\audiop ... r", "setQueue", OC\AppFramew ... {}, { _route: "a ... "})

    <<closure>>

    OC\AppFramework\Routing\RouteActionHandler->__invoke({ _route: "a ... "})

    /var/www/nextcloud/lib/private/Route/Router.php - line 297:

    call_user_func(OC\AppFramew ... {}, { _route: "a ... "})

    /var/www/nextcloud/lib/base.php - line 987:

    OC\Route\Router->match("/apps/audioplayer/sonosqueue")

    /var/www/nextcloud/index.php - line 42:

    OC::handleRequest()

is this a permission thing ? if i want to see this directory in terminal i have to change to root user , the directory is owned by the user and group www-data so surely this should work ?

also out of interest , I can only select on speaker at a time in the advanced settings , could an option to choose which speaker be available in the audio player app ? so you can change before you play the music

naja. I think here is the issue. thats the hardest part to explain here how Sonos works.
from the wiki:

  • All titles need to be stored in a location, which can be reached via SMB from the SONOS controller
  • The SMB location needs to be available in the SONOS App Music Library section

so AP will just be a nicer graphical remote (with user management, which Sonos does not have).
In my case, all files are on a NAS. SONOS is accessing it via the “music library” setting. and NC is accessing it via a smb “external storage”
So AP can just point your speaker to a file, which the speaker itself could find via the sonos app.
do you know what I mean?

in your case, sonos does not know the location. “ClientUPnPError” is not really displayed as “Player not available” correctly here

does this help?

This does make sense but I’m still struggling a little bit, so after doing tons of research last night I’ve discovered a few things .
I set up samba shares using NextcloudPi, which was nice and painless and can access the share using my laptop . A music file can be played on the laptop with a path shown as smb://nextcloudpi.local/ncp-admin/Music

would you know how this is represented as a local path for the settings page on Audio player ?
I’ve tried a few options but none were successful such //ncp-admin/Music

also I tried accessing the share via the sonos app to try and play the music stored on nextcloud this way , unfortunately it would appear Sonos only support smb protocol version 1 and the smb version on nextcloud is version 3

Nas drive Sonos

oh. interesting issue. just checked my NAS and found that SMB1 is still enabled there.
you should be able to change the min-version on your PI in

/etc/samba/smb.conf

I changed the version to 1 and it showed it trying to connect to nextcloud but then suggests it can’t find it . Still it didn’t remedy the option to control from audio player app. Which still shows unavailable no matter what path I suggest for local SMB , I might have to wait till http for Linux Is supported in Sonos

Hello.
In first, excuse me for my bad English.
I have installed my new “Sonos One” yesterday and i discover the audioplayer add-on.
I find that the documentation is very poorly made and is aimed at very “trendy” people.
I use NextCloud (17.0.3) on a shared server, at OVH.
In first, the list “SONOS Player:” is always empty. In my config.php file ‘datadirectory’ => ‘/home/mydomain/Musique’,
My nextcloud.log :
socket_sendto(): unable to write to socket [1]: Operation not permitted at /home/mydomain/myNC/apps/audioplayer_sonos/lib/Controller/SonosController.php#211
What can I do ?

Hello @jbyvosges,
what you are seeing is a php error. there seems to be sockets disabled in php settings. is it your own setup? php.ini might be the place to start looking. I never had this error before

Hello @Rello . As I said, I work on a shared server, at OVH, and, therefore, I do not have access to php.ini

Does this also work with other UPnP players?

I would like to use it as a streaming backend for this:

Hello,
at the moment, this add-on is only focused on SONOS.
It has a pretty limited usecase due to its dependencies (only internal; audio files need to be on a SMB share), but it originated from a personal demand.

@Krischan
what is your idea? to have standard UPnP players connect to the library within Nextcloud?
Music does something like that with Ampache. I looked at a similar concept already but to provide it also as an add-on on top of Audio Player. then the existing library could also provide the basis for any other player.
But for the moment the time is limited due to my Analyitcs app

Do you have any insides/dev experience there?
It would be interesting to have someone with time/knowledge in this area and then work together to tie them up in the background

Thank you…

Ah, The Music app might work for my usecase with Subsonic support. Wasn’t aware that it had support for it.

Sorry don’t have further insights.

FYI Sonos devices are not visible to Nextcloud hosted in a Docker container.

Hello,
i am not sure about docker - but I expect its a firewall thing.
to find the sonos, broadcasting messages are being sent within the same network only

Docker runs its containers on a different subnet than the host network. On top of that, there is a reverse proxy exposing the name to the outside world. Perhaps an override can be added to tell the plugin where to search for the Sonos devices.