Replies: 1 comment
-
|
Hi, how about using navigator.mediaDevices, a front-end API, this works on the Wails app. A simple exmple like: function handleMediaStream(MediaStream) {
console.log('MediaStream Object:', MediaStream)
const video = document.createElement('video');
video.controls = true;
video.srcObject = MediaStream;
video.onloadedmetadata = function () {
video.play();
};
var container = document.getElementById('videoContainer');
container.appendChild(video);
};
function getUserMedia() {
try {
const options = {
audio: true,
video: true,
}
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia(options).then(function (MediaStream) {
handleMediaStream(MediaStream)
}).catch(function (err) {
console.error(err);
})
}
else if (navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia) {
try {
navigator.getUserMedia(options, function (MediaStream) {
handleMediaStream(MediaStream)
}, function (err) {
console.error(err);
})
} catch (error) {
console.error(err);
}
} else {
console.error("Your browser does not support getUserMedia API");
}
} catch (error) {
console.error(error);
}
};
getUserMedia(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Have you read the Documentation Contribution Guidelines?
Description
Only barely mentioned here:
How to use the webcam/camera feed in a Wails app?
Self-service
Beta Was this translation helpful? Give feedback.
All reactions