I have an Android app which plays live streams from web (mostly icecast) via Google Cast. Everything worked fine and fast, but now it takes much longer time for some streams to start (make sound). This may be somehow related to the Chromecast firmware upgrade as my Chromecast device got updated to the latest version (1.32.124602) recently.
This is how I play stream via Cast:
MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_GENERIC);
metadata.putString(MediaMetadata.KEY_TITLE, "My title");
metadata.putString(MediaMetadata.KEY_SUBTITLE, "My subtitle");
metadata.addImage(new WebImage(myImageUri);
MediaInfo mediaInfo = new MediaInfo.Builder(streamUrl)
.setStreamType(MediaInfo.STREAM_TYPE_LIVE)
.setContentType("audio/mpeg")
.setMetadata(metadata)
.build();
MediaLoadOptions options = new MediaLoadOptions.Builder()
.setAutoplay(true)
.setPlayPosition(0)
.build();
sessionManager.getCurrentCastSession().getRemoteMediaClient().load(mediaInfo, options);
Strange thing is, that some streams are pretty fast and others not:
- http://stream.funradio.sk:8000/dance128.mp3 - This makes sound after more than 20 seconds
- http://stream.expres.sk:8000/128.mp3 - This makes sound in 1 second
I also noticed that ResultCallback of the load() function is triggered almost instantly for the second stream, while first one takes about 3 seconds.
I appreciate any help or idea how to fix this.