casolorz
casolorz

Reputation: 9574

Who determines the MediaInfo stream type?

I started using the VideoCastManager.isRemoteStreamLive() method on the CCL but I just realized it always returns false. That method seems to depend on info.getStreamType() so I'm wondering who should be setting that type to live stream? is there maybe a way to do this on the receiver end?

Thanks.

Upvotes: 1

Views: 729

Answers (1)

jlmcdonald
jlmcdonald

Reputation: 13667

Are these your streams? If so, the best option is to put something into the metadata or a track that indicates it's a live stream. If that's not possible, there are some "sniffing" strategies that may or may not be useful.

First of all, the spec for the HTML5 video element states that if the bounds of a video (i.e. duration) cannot be determined, then the getDuration method should return infinity (the javascript constant is equal to Number.POSITIVE_INFINITY). This doesn't always mean that the video is streaming (there may be problems with the response's content-length header, for example), but it is possibly your best option -- have your receiver, once the metadata is loaded, call getDuration and see what's returned.

You could also have your receiver look at the source (the currentSrc attribute of the video's metadata) -- a lot of live streams are adaptive bitrate streams, and so would be represented in the video element as .m3u8 sources.

But these are just ways to make educated guesses; as Ali noted in one of his comments, there is no programmatic way for the client (whether through native javascript APIs or the Chromecast APIs) to determine that a stream is a live stream.

Upvotes: 1

Related Questions