Reputation: 27226
By taking a look at the samples, libraries, source code, etc. from Google Cast, I can say that the whole Cast SDK is relatively complicated and has little abstraction to the dev.
I assume that's why Google created the CastCompanionLibrary…
However, by reading the .pdf, source code and the sample, it's still not clear to me what the right approach to casting only audio is.
On the other side of the spectrum is the not-yet-Android-Studio updated "democastplayer".
I've converted this app to Android Studio and it works with my own App Id, but I still have two fundamental questions:
1) What is the difference between Cast SDK Mode and MediaRouter Mode? (Even looking at the source code, I have not yet been able to find the difference or advantage of one over the other, or more specifically, when to use each and why?)
2) If you already have a Service that does all you need (because you already have an app that streams music) using a standard MediaPlayer, you already buffer (async!) and play when the player is prepared, you also have a notification in the bar, in other words, you have a media player app… how would you approach adding Chromecast Support?
CastCompanionLibrary seems relatively bloated with unneeded features (a player Activity/fragment that I don't need because I already have one), notification support which I already have in my App… etc.
Should I just approach it in a way where there's a "second" player/service in my App that is exclusive to Chromecast and therefore takes care of all the Notification, RemoteMediaPlayer (as opposed to my regular MediaPlayer), etc.?
Will this player give me a callback when playback is finished? paused? (So I can update my UI, make my API calls, etc.)
I'm new to Google Cast, so apologies in advance if anything is easy to see, please point me to the right resources (I've read the samples and code, but haven't come across these simple answers). I am not interested in video at all.
My music comes from an API (I have to request a track and I will get a URL to the media -mp3 or similar-). I also have to know when the track has reached certain point. I haven't seen anything similar to the real MediaPlayer in the RemoteMediaPlayer, those callbacks seem incomplete to me.
What am I missing here? :)
Thanks.
Upvotes: 2
Views: 602
Reputation: 19034
You have different choices:
Upvotes: 1