I am using webview_flutter: ^0.3.15+1 for in-app browser in flutter(here) and want to open this URL check which have a camera but it's not opening as expected nor camera is loaded on that webpage
Code for webView Page
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'dart:async';
class ExamWebView extends StatefulWidget {
final PageController controller;
final int destination;
const ExamWebView({Key key, this.controller, Key index, this.destination})
: super(key: key);
@override
_ExamWebViewState createState() => _ExamWebViewState();
}
class _ExamWebViewState extends State<ExamWebView> {
Completer<WebViewController> _controller = Completer<WebViewController>();
JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
return JavascriptChannel(
name: '_Toaster',
onMessageReceived: (JavascriptMessage message) {
Scaffold.of(context).showSnackBar(
SnackBar(content: Text(message.message)),
);
});
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Center(
child: Text("Exam"),
),
),
body: Column(
children: <Widget>[
Expanded(
child: WebView(
initialUrl:
"https://therealtechwiz.github.io/project/facerecognition",
gestureRecognizers: Set()
..add(
Factory<VerticalDragGestureRecognizer>(
() => VerticalDragGestureRecognizer(),
),
),
// Factory<VerticalDragGestureRecognizer>(
// () => VerticalDragGestureRecognizer()..onUpdate = (_) {},
// ),
initialMediaPlaybackPolicy: AutoMediaPlaybackPolicy
.require_user_action_for_all_media_types,
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
},
javascriptChannels: <JavascriptChannel>[
_toasterJavascriptChannel(context),
].toSet(),
),
)
],
));
}
}
Added these Permissions in android/app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.INTERNET"/>
response in terminal:
D/EgretLoader(23485): EgretLoader(Context context)
D/EgretLoader(23485): The context is not activity
W/ContentCatcher(23485): Failed to notify a WebView
I/chromium(23485): [INFO:CONSOLE(79)] "[object DOMException] please use the fiddle instead", source: https://therealtechwiz.github.io/project/facerecognition/script.js (79)
I/chromium(23485): [INFO:CONSOLE(1)] "Uncaught (in promise) Error: failed to fetch: (404) , from url: https://therealtechwiz.github.io/models/face_recognition_model-weights_manifest.json", source: https://therealtechwiz.github.io/project/facerecognition/face-api.min.js (1)
W/Choreographer(23485): Frame time is 0.077364 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
Getting this output :
Ouput expected : can be seen here
can anyone please see and suggest me a solution to fix