I am working on a Flutter web application where I need to request camera permissions and access the camera stream for another web view. I am using the dart:html library to request camera access with getUserMedia. However, I'm facing issues, and I could use some guidance.
Code to allow the camera for webview but not working
onWebViewCreated: (controller) {
// webViewController = controller;
controller.evaluateJavascript(source: '''
navigator.mediaDevices.getUserMedia({ video: true })
.then(function (stream) {
// Handle the camera stream for website B
})
.catch(function (error) {
console.error('Error accessing camera in website B:', error);
});
''');
},