Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2024-04-09 11:21:31 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
31fcad59350d9e960f87b311bd443cde7e990624
31fcad59
1 parent
df286f97
remove cast on media stream
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
14 deletions
lib/src/web/mobile_scanner_web.dart
lib/src/web/mobile_scanner_web.dart
View file @
31fcad5
...
...
@@ -121,24 +121,12 @@ class MobileScannerWeb extends MobileScannerPlatform {
// Retrieving the media devices requests the camera permission.
_permissionRequestInProgress
=
true
;
final
MediaStream
?
videoStream
=
await
window
.
navigator
.
mediaDevices
.
getUserMedia
(
constraints
)
.
toDart
as
MediaStream
?;
final
MediaStream
videoStream
=
await
window
.
navigator
.
mediaDevices
.
getUserMedia
(
constraints
).
toDart
;
// At this point the permission is granted.
_permissionRequestInProgress
=
false
;
if
(
videoStream
==
null
)
{
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
genericError
,
errorDetails:
MobileScannerErrorDetails
(
message:
'Could not create a video stream from the camera with the given options. '
'The browser might not support the given constraints.'
,
),
);
}
return
videoStream
;
}
on
DOMException
catch
(
error
,
stackTrace
)
{
final
String
errorMessage
=
error
.
toString
();
...
...
Please
register
or
login
to post a comment