duncan3dc / sonos

A PHP library for interacting with Sonos speakers
Apache License 2.0
107 stars 33 forks source link

x-file-cifs and tts streaming #15

Closed patrickharris closed 9 years ago

patrickharris commented 9 years ago

I can play mp3 files fine by the track pointing to the mp3 file, and having it served up by apache, i.e. "http://192.168168... etc ... /path_to_file.mp3". However, I can't get the x-file-cifs working. I've tried from my NAS (which supports upnp/dlna), and from my mac (using sony ps3, and eyeConnect servers). If I use BubbleUpnp from an android phone, I can stream no problem from the servers. So I'm assuming I just don't know how to structure the url properly for the sonos to work.

If it's working via http and apache, maybe I don't need to worry about x-file-cifs?

duncan3dc commented 9 years ago

If your NAS is running unix then you'll need Samba running on it to access the files using CIFS.

I did find a couple of quirks with Sonos and CIFS:

An example path would be something like x-file-cifs://HOSTNAME/sharename/artist/album/01%20-%20Song.mp3

I achieve this in my code like so:

$filename = "artist/album/01 - Song.mp3";

$parts = explode("/", $filename);
$parts = array_map("rawurlencode", $parts);
$track = "x-file-cifs://HOSTNAME/sharename/" . implode("/", $parts);

Does that help?

889laurent commented 9 years ago

it works in my house when i add the url of directory in the music library of the Sonos app .

patrickharris commented 9 years ago

Thanks guys for that help. I changed the hostname to uppercase, and got a new message 'file could not be found'. I added the folder via the sonos software on the computer, but even trying to play the mp3 file via the library on the computer got the same error message. Tomorrow I'll reboot everything and see if that makes any difference. If I can't get it going, I'll just use the path to the file via apache, because that works for me fine.

duncan3dc commented 9 years ago

Ok, sorry I couldn't be of more help

patrickharris commented 9 years ago

I rebooted all the network devices today, and now suddenly it works! Thanks guys for your help.