0

ref: https://developer.sony.com/develop/audio-control-api/api-references/api-overview-2#_setplaycontent_v1_2

Is it possible to play an mp3 stored on a webserver, e.g. http://example.com/myfile.mp3? Or even better, a Shoutcast mp3 stream URL?

The API docs do not really give many examples of the URI parameter for the setPlayContent function. Just a single DLNA mp3 example. And the Device URI page is very vague: https://developer.sony.com/develop/audio-control-api/api-references/device-uri

Thanks in advance.

grolschie
  • 2,163
  • 2
  • 12
  • 29

2 Answers2

0

Yes and No, you can't do it via the setplaycontent, you have to use the DLNA protocol instead. To do this use the "SetAVTransportURI" message to select the music file to play set CurrentURI=http://example.com/myfile.mp3 and add some dummy data if you can't get it automatically for the rest, the device is cutie picky so you might have to experiment to get the correct format of the message. I have also had some problem in the past then using "example.com" the DNS lookup have not always worked for me so use ip number instead is safer. There is no support for Shoutcast, some streaming mp3 files works but not all.

Have a look at https://github.com/sonydevworld/audio_control_api_examples/blob/master/DLNA/AVTransport/play_file.adoc for more detailed information.

David - Sony
  • 161
  • 4
  • Thanks, David. Ok, so it's by DLNA not the API. Alas, Shoutcast was where I was headed. The STR-DN1080 should have been easily capable had Sony implemented support in the API. Thank you anyway. – grolschie Mar 31 '19 at 23:27
  • 1
    Actually, it can be done using the built-in Chromecast Audio device, as per this answer on another question: https://stackoverflow.com/a/53872280/10309564. One can use the Google Cast SDK (https://developers.google.com/cast) or an alternative such as Chromecast Java API v2 (https://github.com/vitalidze/chromecast-java-api-v2). I managed to get Shoutcast streams to play on the STR-DN1080 using the latter. One may need to append `;stream.mp3` to the stream URL e.g. `http://s2.onweb.gr:8604/;stream.mp3`. – grolschie May 19 '19 at 07:38
  • I have found that I can send Shoutcast MP3 streams, Icecast OGG Vorbis streams, FLAC, AAC, etc, to the inbuilt Chromecast Audio using 'ChromeCast Java API v2' library! – grolschie May 25 '19 at 23:48
  • However, even though the built-in Chromecast Audio player shows Title, Artist, Album fields on screen, it does not populate these from either the embedded metadata in the streams, or by sending the metadata Title field manually to the device using the 'ChromeCast Java API v2' library. It seems the player ignores the metadata. It also doesn't show any indication of buffering, etc, which is a shame. – grolschie May 25 '19 at 23:51
0

It is not possible to play streaming audio from the internet (e.g. Shoutcast, etc) on the Sony STR-DN1080 using the Sony Audio Control API. However, it can be done using the built-in Chromecast Audio device, as per this answer on another question. For example, one can use the Google Cast SDK or an alternative such as Chromecast Java API v2.

I cannot speak of the Google Cast SDK, but I managed to get Shoutcast streams to play on the Sony STR-DN1080 using Chromecast Java API v2. In some cases one may need to append ;stream.mp3 to the Shoutcast stream URL, e.g. http://s2.onweb.gr:8604/ becomes http://s2.onweb.gr:8604/;stream.mp3.

I have had success playing MP3, AAC, Opus, FLAC, and Ogg streams. I hope that this helps someone.

grolschie
  • 2,163
  • 2
  • 12
  • 29