vmichalak / sonos-controller

Java API for controlling SONOS players
MIT License
43 stars 9 forks source link

PlayUri not working #5

Closed chetanmekha closed 7 years ago

chetanmekha commented 7 years ago

Hello Vmichalak, Thanks for such a great library. I am successfully able to perform operation like as pause,play from android app to sonos. But when i tried with method playUri(String uri,String meta) it 's giving me UPnPSonosControllerException. How can i overcome this error. Also I want to achieve below functionality, Stop currently playing song on sonos device, play my announcement(from app) on sonos and resume previously running song if it was running from other devices like as Sonos Controller. Will it be possible to achieve this from your code?

vmichalak commented 7 years ago

Hi chetanmekha, It depend of your currently playing song source, can you describe to me your test process to reproduce the exception ?

chetanmekha commented 7 years ago

Thanks for quick reply. My test case is, I am passing audio file uri like as Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()+"/Heropanti.mp3"); String path = uri.getPath(); SonosDevice sonos = new SonosDevice("192.168.43.40"); sonos.playUri(path,"Testing data"); and getting UPnPSonosControllerException. SonosDevice.previous(); also not working.. :(

vmichalak commented 7 years ago

It's from an Android phone ?

chetanmekha commented 7 years ago

yes, I am trying to play audio file from android app.

vmichalak commented 7 years ago

I think it doesn't work because the Sonos cannot access to the file URI. Can u attempt with a file hosted on the web ?

chetanmekha commented 7 years ago

Thanks for the help. Can we achieve something like as, Stop currently playing song on sonos device, play my announcement(from app) on sonos and resume previously running song if it was running from other devices like as Sonos Controller. It's implemented in https://github.com/jishi/node-sonos-http-api

chetanmekha commented 7 years ago

I achieved it in android app.. :) Using nanoHTTPD . Need your help for second point.

vmichalak commented 7 years ago

You use nanoHTTPD for expose your mp3 ?

This feature is not on the library for the moment, i add it to the todo list ;)

chetanmekha commented 7 years ago

Yes, with nanoHTTPD i created a light weight server within app and host the media file over it. The previous() method not working will you please check it. Also Is there any method available which returns current running song details? Like as uri, getduration(), getInfo() etc.

vmichalak commented 7 years ago

The feature you ask is now on sonos-controller ! SonosDevice.clip()

Have fun 😄

chetanmekha commented 7 years ago

Thanks you vmichalak.. You achieve with nanoHttp or implemented with other technique?

vmichalak commented 7 years ago

I've made a webserver directly on the phone in java to expose phone medias and i use Clip to send it to sonos system :)

chetanmekha commented 7 years ago

Great job man, and play previous song functionality also implemented? Let's connect on skype , please share your skype id

vmichalak commented 7 years ago

We have a slack channel (check on the readme.md). Join us on it !

vmichalak commented 7 years ago

And yes, SonosDevice.previous() do the job ;-)