1

I am currently developing a media application for Android that can cast it's media to a Google Chromecast.

This application is not meant to be published so some of the unorthodox choices I have made (web server, local files etc.) isn't part of the discussion.

The problem is that when I load a media stream to the Chromecast, or seek in the stream, it doesn't change. The callback says it succeeds, but the movie keeps playing from scratch (when I load with initial position) and doesn't change when I perform remoteMediaPlayer.seek(XX).

The movie that is playing locally is a file on the SD card. At the same time, the phone runs a Web server (KWS) and the chromecast is fed with this URL. This works perfecly otherwise - I can play, pause and change the movie playing. No problem there. But I do have the seek problem.

The reason I'm mentioning the web server is because when I run the URL "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" from googles samples, the seeking work.

Could anyone help me figure out what is different because I host the file myself? I saw posts mentioning that if the stream doesn't have a duration, remoteMediaPlayer cannot seek in it. But it does. A call to remoteMediaPlayer.getStreamDuration() returns the actual media duration.

There seems to be something in missing in how I host the files...

All help is appreciated.

Joakim
  • 3,224
  • 3
  • 29
  • 53
  • Is the same issue that: https://stackoverflow.com/questions/47031243/chromecast-live-duration? Thanks – juanpe_f Oct 31 '17 at 15:18

2 Answers2

1

I have now solved my problem. If anyone else has this or a similar problem, use a web server that supports http progressive download. In the android specific case, this was an app called Boa Web server.

Joakim
  • 3,224
  • 3
  • 29
  • 53
1

I solved similar problem with NanoHttpd, solution was to add this response header

Accept-Ranges: bytes
komo
  • 249
  • 4
  • 10