Skip to content

Application freezes when accessing camera for the first time #96

@SleepySquash

Description

@SleepySquash

Revealed from team113/messenger#219

Summary

When accesing the user's camera for the first time, the application freezes for ~1-2 seconds. Afterwards any camera access doesn't freeze the application.

I suppose there's something that is being calculated synchronically, which takes some time. This is usually not good for UI/UX, as the main thread rendering the application freezes aswell.

Also it's worth mentioning than this freeze takes ~1-2 seconds when running an ARM native version of the application. When running through Rosetta (Intel version), then this freeze takes up to ~3-5 seconds.

Platform information

  • Flutter version:
[✓] Flutter (Channel stable, 3.3.7, on macOS 13.0 22A380 darwin-arm, locale ru-RU)
    • Flutter version 3.3.7 on channel stable at /opt/homebrew/Caskroom/flutter/2.5.3/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e99c9c7cd9 (4 недели назад), 2022-11-01 16:59:00 -0700
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/mayday/Library/Android/sdk
    • Platform android-33, build-tools 32.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A400
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.73.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.52.0

[✓] Connected device (2 available)
    • macOS (desktop)          • macos                     • darwin-arm64   • macOS 13.0 22A380 darwin-arm
    • Chrome (web)             • chrome                    • web-javascript • Google Chrome 105.0.5195.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
  • Plugin version: any (including the latest from pub.dev)
  • Platform: macOS
  • OS/Browser version: macOS Ventura 13.0

Steps to reproduce

  1. Run the example provided with this package.
  2. Get user media -> Call.
  3. Application freezes for 1-2 seconds.
  4. Hangup, optionally go on a previous screen to trigger re-initialization of the library.
  5. Get user media -> Call.
  6. No freezes, UI is responsible.

What is the current bug behavior?

UI freezes for 1-2 when accessing the camera for the first time.

What is the expected correct behavior?

Nothing freezes, initialization should be async.

Relevant logs and/or screenshots

Notice the CircularProgressIndicator I added in a Stack, it freezes for the first time:

1.mp4

Possible fixes

Perhaps spawning an isolate would help, if something heavy must be performed sync?

Metadata

Metadata

Labels

bugSomething isn't workingk::ui/uxRelated to UI/UX

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions