Skip to content

Switching between front and rear cameras causes Chrome to freeze on Android 11 #77

@jaymemi

Description

@jaymemi

npm list @stencil/core
-- @stencil/core@1.8.11

I'm submitting a ...
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com

Current behavior:
While using Android 11's Chrome browser, any attempt to switch between front and rear cameras causes the entire browser to freeze.

Expected behavior:
The user should be able to switch between cameras without causing the browser to freeze.

Steps to reproduce:

  1. Open the pwa-camera overlay, the camera initializes and starts streaming as expected.
  2. Attempt to switch to rear camera, the browser becomes unresponsive without any errors showing on the console.

Tested in a fresh project, against both Capacitor v2 and v3, and using the latest pwa-elements version:
@capacitor/core": "^2.4.7"
@ionic/pwa-elements": "^3.0.2"

The issue can be reproduced on:

  • Samsung Galaxy s10 Android 11, Chrome 89.0.4389.90
  • Samsung Galaxy S21 Android 11, Chrome Beta 90.0.4430.19
  • Xiaomi Mi 10T, Android 11 (MIUI 12.1.2)
  • OnePlus Nord, Android 11

Workign as expected on:

  • Samsung Galaxy s10 Android 11 on Chrome Beta 90.0.4430.19

Related code:
rotate() attempts to stop previous streams and it seems to be the causing the issue:

stopStream() {
this.stream && this.stream.getTracks().forEach(track => track.stop());
}

Other information:
Twilio's issue tracker shows the same issue and some possible solutions:
twilio/twilio-video-app-react#355

I intend to submit a pull request with one of the possible workarounds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions