Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add pausePreview and resumePreview implementation
  • Loading branch information
bselwe committed Aug 13, 2021
commit 406c5ea7ecf61a18ea9afa6e309ebc3bcc60be59
21 changes: 21 additions & 0 deletions packages/camera/camera_web/lib/src/camera_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,27 @@ class CameraPlugin extends CameraPlatform {
}
}

@override
Future<void> pausePreview(int cameraId) async {
try {
getCamera(cameraId).pause();
} on html.DomException catch (e) {
throw PlatformException(code: e.name, message: e.message);
}
}

@override
Future<void> resumePreview(int cameraId) async {
try {
await getCamera(cameraId).play();
} on html.DomException catch (e) {
throw PlatformException(code: e.name, message: e.message);
} on CameraWebException catch (e) {
_addCameraErrorEvent(e);
throw PlatformException(code: e.code.toString(), message: e.description);
}
}

@override
Widget buildPreview(int cameraId) {
return HtmlElementView(
Expand Down