I have a remote MediaStream
object obtained by a remote WebRTC Peer Connection
.
I want to check when the remote MediaStream
becomes inactive (indipendently by the reason).
I have read that for this purpose I should use the events active
and inactive
of the MediaStream
object.
But these two events are never triggered: even if I set a specific handler for these two events, the handlers are never executed.
Here my implementation:
function onRemoteStream(event) {
event.stream.addEventListener("active", function(){
console.log('The video is active');
}, false);
event.stream.addEventListener("inactive", function(){
console.log('The video is not active');
}, false);
remoteVideo.src = window.URL.createObjectURL(event.stream);
}
The two messages are never showed.
I also tried:
function onRemoteStream(event) {
event.stream.onactive = function(){
console.log('The video is active');
};
event.stream.oninactive = function(){
console.log('The video is not active');
}
remoteVideo.src = window.URL.createObjectURL(event.stream);
}
But the behaviour is the same.
I don't understand why the two events are not triggered.
I'm using Google Chrome 52.0.2743.116 m