Closed Bug 926753 Opened 6 years ago Closed 5 years ago
Width and video Height should be set in loadedmetadata for get User Media & Peer Connection-connected video elements
Component: Untriaged → Video/Audio
Product: Firefox → Core
This is also an issue on the receiving side of a WebRTC stream using PeerConnection. I would like "loadedmetadata" to fire after the videoWidth and videoHeight properties are defined in this case too.
I should point out it does for Chrome as well.
I reproduced this bug. The "loadedmetadata" callback works fine on Chrome, but returns with zero values for videoHeight and videoWidth in Firefox. I explored the other callbacks, but nothing else worked. Is there a fix or a known workaround? Thanks.
Status: UNCONFIRMED → NEW
Component: Video/Audio → WebRTC: Audio/Video
Ever confirmed: true
Summary: videoWidth and videoHeight should be set in loadedmetadata for getUserMedia videos → videoWidth and videoHeight should be set in loadedmetadata for getUserMedia & PeerConnection-connected video elements
In the case of PeerConnection-connected video elements ideally this event wouldn't fire until the connection has successfully established. We use this event in Chrome to detect PeerConnection failure by timing out waiting for "loadedmetadata". As far as I know there is no other way to detect PeerConnection failure until this ticket is resolved: https://bugzilla.mozilla.org/show_bug.cgi?id=852665
I've also run into this issue... my work around is to have the video visible, but offscreen (EG: fixed: -1024px;) apply no styles to the video so it takes up 100% of its dims, then instead of using this.videoHeight or this.videoWidth use this.clientHeight or this.clientWidth... or $.height() or $.width()... once the dimensions are stored you can hide the video element
Nevermind, this still posed issues with getting incorrect widths and heights. For now I have sadly gone with a timeout of 500 ms.
This is breaking examples we have that have previously supposedly worked correctly on Firefox but currently work on Chrome, and is affecting attempts to write sample code for our WebRTC docs, fwiw. See http://jsfiddle.net/codepo8/agaRe for example, which is referenced from a past Hacks blog post and existing WebRTC documentation, which implies that it worked at one point but no longer does, due to videoWidth and videoHeight being 0 when the "canplay" event is fired. I also tried changing it to check those values when "loadedmetadata" is fired, but no go.
We also have a failing example on MDN: https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Taking_still_photos
Duplicate of this bug: 1096723
Fixed by bug 879717.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Brian, Adam, Bill, Ian, It'd be great if you could verify that this is working for your use cases now in latest nightly and/or aurora. Thanks!
Yep, it's working in Nightly for me. Specifically when loadedmetadata fires on a video attached to a remote stream the videoWidth and videoHeight are populated.
Target Milestone: mozilla35 → mozilla38
Yup, this works for me now. Thanks for the fix.
This fix needs to be documented; it improves interoperability enormously!
You need to log in before you can comment on or make changes to this bug.