Reputation: 1558
I have a list of HTTP links that are basically links for streaming videos (HLS). I was wondering if there was a simple and straightforward way to basically pick from a list of HTTP links from an Android app and have them stream on my TV via chromecast.
I've looked at some of the sample apps on the Google Cast github and couldn't find any examples.
Thanks
Upvotes: 1
Views: 435
Reputation: 6289
HLS support is Yes so, to accomodate the HLS/m3u8 playlist in terms of android chromecast api you might consider remapping the m3u8 to a MediaList/MediaInfo combo and then using the chromecast ccl calls to play a mediainfo entry from the new list...
details making a new list entry and adding to list:
mediaList = new ArrayList<MediaInfo>();
JSONObject jsonObj = new VideoProvider().parseUrl(url);
JSONArray categories = jsonObj.getJSONArray(TAG_RESULTS);
if (null != categories) {
for (int i = 0; i < categories.length(); i++) {
JSONObject category = categories.getJSONObject(i);
String title = category.getString(TAG_MSG);
if(title.length() > 25) title = title.substring(0, 24);
String subTitle = category.getString(TAG_MSG);
JSONObject media3 = category.getJSONObject(TAG_MEDIA3);
String videoUrl = media3.getString(TAG_URL);
JSONObject media1 = category.getJSONObject(TAG_MEDIA1);
String bigImageurl = media1.getString(TAG_URL);
JSONObject media4 = category.getJSONObject(TAG_MEDIA4);
String imageurl = media4.getString(TAG_URL);
String studio = category.getJSONObject(TAG_CREATEDBY).getString(TAG_USERNAME);
mediaList.add(buildMediaInfo(title, studio, subTitle, videoUrl, imageurl,
bigImageurl));
}
The above provides some type of 'media bundle' that can be provide to one of the many, types of calls to startCastControllerActivity(@Type) in the ccl class VideoCastManager
take a good look at the section /==VideoCastControllerActivity management ===/ in that class. It may help you out
Upvotes: 1