0

When showing a camera feed through a <video> tag, I observe different behavior between Firefox and Chrome when suspending the operating system (i.e. closing/clamshelling the laptop on my Macbook). Afterwards, when resuming the OS:

  • on Firefox, the camera feed is immediately re-established
  • on Chrome, the camera feed goes black

As an aside, I've also noticed that the suspend event behaves differently:

  • on Firefox, it is sent when the camera feed is first connected to the video tag (i.e. nothing to do with OS suspend/resume, as far as I can tell)
  • on Chrome, it is sent when the OS resumes (i.e. after re-opening the laptop)

I'd like to have Chrome match Firefox's behavior, i.e. show the video feed after resuming from a suspend situation. Is this possible?

Duane J
  • 1,615
  • 1
  • 15
  • 22

1 Answers1

0

While I don't understand the underlying difference between browsers, I have a workaround:

Ignore any "suspend" event if it happens immediately after the video component is mounted. However, if a "suspend" event is received thereafter, do the following:

  1. Wait at least 2 seconds (any sooner and it seems an error will occur when re-querying for permission; another strategy could be to "keep trying" until success)
  2. Re-query for permission to use the camera/audio (Chrome will automatically grant it)
  3. Re-mount the video & audio tags, and establish a video stream again.

The camera stream will show in the video tag again.

Duane J
  • 1,615
  • 1
  • 15
  • 22