Created attachment 312926 [details] Testcase When a video is loaded, we dispatch the "resize" and "loadedmetadata" events first, but when either is dispatched, at least with a local file, audioTracks and videoTracks are empty. We get "addtracks" events for both of those properties later on, at which point we correctly get the list of tracks. This means that catching a "loadedmetadata" is not sufficient to obtain basic information about the media. In STP 33, the attached test reports the following: Received "resize" on [object HTMLVideoElement] time since last event – "8.50ms" videoWidth – 320 videoHeight – 240 audioTracks – 0 videoTracks – 0 Received "loadedmetadata" on [object HTMLVideoElement] time since last event – "1.30ms" videoWidth – 320 videoHeight – 240 audioTracks – 0 videoTracks – 0 Received "addtrack" on [object AudioTrackList] time since last event – "6.60ms" videoWidth – 320 videoHeight – 240 audioTracks – 1 videoTracks – 1 Received "addtrack" on [object VideoTrackList] time since last event – "0.40ms" videoWidth – 320 videoHeight – 240 audioTracks – 1 videoTracks – 1
Created attachment 312927 [details] media file used by test
<rdar://problem/32778557>
I don't think it makes sense that we report non-zero videoWidth/videoHeight values when videoTracks.length is 0. I would expect that we only dispatch "addtrack" and other track event in the event that the track list changes *after* the "loadedmetadata" event is fired and that when dispatching "loadedmetadata" we ought to have the initial list of tracks reflected.
Is there a fix for this? what is the expected behaviour? When using hls.js or shaka(MSE based playback libs) the metadata is already available before loadeddata is dispatched.