[Webkit-unassigned] [Bug 252465] In PWA, HTML Video Element may be unable to play stream from 'getUserMedia()'

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 15 11:35:58 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=252465

--- Comment #34 from rooke at mash.com ---
Just to add to the information available, and provide a detection method, you can subscribe to the HTMLMediaElement's events (e.g. <video muted="true" />). In a normal situation, the events follow this order:

play 
waiting 
loadstart 
progress 
suspend 
durationchange 
loadedmetadata 
loadeddata 
canplay 
playing 
canplaythrough
timeupdate (repeatedly for every frame)

When the PWA camera issue rears its head, the events are cut off at 'suspend', i.e.:

play 
waiting 
loadstart 
progress 
suspend 
<then nothing>

This is the method to detect when you're in that situation. Just timeout on any of the missing 'expected' events, e.g. canplay:

let timeoutId: NodeJS.Timeout;

// set timeout of 3 seconds to wait for oncanplay
timeoutId = setTimeout(() => {
  // The video didn't get to 'canplay'
}, yourPreferredTimeoutInMillis);

videoElement.oncanplay = () => {
  // clear the timeout because oncanplay was called
  clearTimeout(timeoutId);
};

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230615/1b591982/attachment.htm>


More information about the webkit-unassigned mailing list