Media events on RTCView


Are there any events on RTCView, or maybe another way to get to know when a track starts playing? Perfectly, looking for something similar to media events or at least corresponding HTMLMediaElement.readyState property.

To simplify my problem, I wanna show a loading spinner until the moment, when incoming video starts playing (perfectly, when a key frame is being rendered). Currently I know when the stream comes in (via RTCPeerConnection.onaddstream()), but there’s a chance (due to app specifics) to get a stream from a slow or dead camera. For example, latter triggers MediaStreamTrack#onended(), but it happens with a noticeable delay, and before that, track’s state is “live”.

Maybe some workaround would be possible?

P.S. Thanks for this library and all the hard work!

There are currently no such events. There is, however, onmute / unmute (stream event) which will kick in when no data is received on that stream.

Thanks for reply!

Looks like there’s a PR #715, which adds just enough for my particular use case. Would be cool getting it merged, when you have time.