1
votes

In Chromecast's documentation it is stated that Chromecast does support HLS streams. But I cannot make it work.

I created a simple app that have one button that initiates playback. For MP4 files it works great, but not for HLS streams. This is how I start stream:

btnStart.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
  String url = "http://planeta-online.tv:1935/vod/mp4:tvt.russia.time_laps_in_st_piter.flv/manifest.m3u8";
  MediaMetadata movieMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
   movieMetadata.putString(MediaMetadata.KEY_SUBTITLE, "Subtitle");
   movieMetadata.putString(MediaMetadata.KEY_TITLE, "Title");
   movieMetadata.putString(MediaMetadata.KEY_STUDIO, "Studio");
   movieMetadata.addImage(new WebImage(Uri.parse("http://cdn.planeta-online.tv/kp/app/icons/i5.png")));
   movieMetadata.addImage(new WebImage(Uri.parse("http://cdn.planeta-online.tv/kp/app/icons/i5.png")));

   MediaInfo mSelectedMedia = new MediaInfo.Builder(url)
    .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
    .setContentType("application/vnd.apple.mpegurl")
    .setMetadata(movieMetadata)
    .build();

    mVideoCastManager.startCastControllerActivity(MainActivity.this, mSelectedMedia, 0, true);
   }
  });

I enabled CORS for this stream on Wowza, but it didn't help. Changing StreamType from MediaInfo.STREAM_TYPE_BUFFERED to MediaInfo.STREAM_TYPE_LIVE doesn't have any effect either. Any other ideas?

2

2 Answers

5
votes

What receiver are you using? You can use either the Default receiver, or a Styled receiver; they both support HLS. Handling of adaptive streams is handled by the Media Player Library (MPL) and if you want to write your own custom receiver, you need to use that library; we have a sample that does that.

-1
votes

I've found that setting the contentType of the stream to "video/m3u" or "video/m3u8" (depending on your format) worked for my HLS streams with the Default receiver.