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
Daniel Newton
2022-03-31 21:59:14 +1300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
03a08b560dc62e0df73f0502b4d4b9fc2cfd15ee
03a08b56
1 parent
c078af9c
use non legacy API for .getUserMedia() so video works on iOS
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
lib/mobile_scanner_web_plugin.dart
lib/mobile_scanner_web_plugin.dart
View file @
03a08b5
...
...
@@ -106,14 +106,17 @@ class MobileScannerWebPlugin {
Map
?
capabilities
=
html
.
window
.
navigator
.
mediaDevices
?.
getSupportedConstraints
();
if
(
capabilities
!=
null
&&
capabilities
[
'facingMode'
])
{
var
constraints
=
VideoOptions
(
var
constraints
=
{
'video'
:
VideoOptions
(
facingMode:
(
cameraFacing
==
CameraFacing
.
front
?
'user'
:
'environment'
));
(
cameraFacing
==
CameraFacing
.
front
?
'user'
:
'environment'
))
};
_localStream
=
await
html
.
window
.
navigator
.
getUserMedia
(
video:
constraints
);
await
html
.
window
.
navigator
.
mediaDevices
?.
getUserMedia
(
constraints
);
}
else
{
_localStream
=
await
html
.
window
.
navigator
.
getUserMedia
(
video:
true
);
_localStream
=
await
html
.
window
.
navigator
.
mediaDevices
?.
getUserMedia
({
'video'
:
true
});
}
video
.
srcObject
=
_localStream
;
...
...
Please
register
or
login
to post a comment