You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!DOCTYPE html><html><head><title>captureStream for Video Element</title></head><body><videoid="video"></video><buttononclick="streamFromVideo()">Stream from Video Element</button><script>functionstreamFromVideo(){constvideo=document.getElementById('video');video.src='./test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm';video.onerror=(error)=>{console.error('Error:',error);};if(typeofvideo.captureStream!=='function'&&typeofvideo.mozCaptureStream==='function'){HTMLVideoElement.prototype.captureStream=HTMLVideoElement.prototype.mozCaptureStream;}conststream=video.captureStream();stream.onaddtrack=()=>{console.log('onAddTrack');consttracks=stream.getTracks();for(consttrackoftracks){console.log('Track readyState:',track.readyState);console.log('Track kind:',track.kind);}console.log('Video tracks:',stream.getVideoTracks().length);console.log('Audio tracks:',stream.getAudioTracks().length);};}</script></body>
onAddTrack
Track readyState: live
Track kind: audio
Track readyState: live
Track kind: video
Video tracks: 1
Audio tracks: 1
onAddTrack
Track readyState: live
Track kind: audio
Track readyState: live
Track kind: video
Video tracks: 1
Audio tracks: 1
Firefox 126.0:
onAddTrack
Track readyState: live
Track kind: audio
Video tracks: 0
Audio tracks: 1
onAddTrack
Track readyState: live
Track kind: audio
Track readyState: live
Track kind: video
Video tracks: 1
Audio tracks: 1
In Chrome, the onaddtrack is fired twice, however even with the first event, both audio and video tracks are present in the stream. In Firefox, the onaddtrack is fired twice, but the first event only has the audio track, and the second event has both audio and video tracks.
I wonder which behavior is correct. The current web platform test assumes that the behavior in Chrome is correct (it checks only the first event), but it may be an implementation detail of Chrome.
The text was updated successfully, but these errors were encountered:
I'll also note that the addtrack event on AudioTrackList and VideoTrackList in the media element spec is fired sync, while the change event on the same objects is fired async.
Consider the following code:
The test video file test-av-384k-44100Hz-1ch-320x240-30fps-10kfr.webm has both audio and video tracks. This code is almost identical to the one in the web platform test.
Below are the logs from the code above:
Chrome 125.0.6422.141:
Firefox 126.0:
In Chrome, the
onaddtrack
is fired twice, however even with the first event, both audio and video tracks are present in the stream. In Firefox, theonaddtrack
is fired twice, but the first event only has the audio track, and the second event has both audio and video tracks.I wonder which behavior is correct. The current web platform test assumes that the behavior in Chrome is correct (it checks only the first event), but it may be an implementation detail of Chrome.
The text was updated successfully, but these errors were encountered: