I got that piece of code:
'use strict';
var constraints = {
video: true
};
var video = document.querySelector("video");
function handleSuccess(stream) {
video.srcObject = stream;
window.video = video
}
function handleError(error) {
console.error('getUserMedia error: ', error);
}
navigator.mediaDevices.getUserMedia(constraints).then(handleSuccess).catch(handleError);
How Can I integrate this code in Elm?
How Can I / Should I pass the MediaStream object to the Elm app and integrate it in my Elm view? Is there a library that can deal with the mediastream Object through a port, Is there a MediaStream Type
somewhere?
Should I just notify the state of the promise navigator.mediaDevices.getUserMedia()
to the elm app (MediaStreamSuccess
, MediaStreamError String
) and treat the MediaStream completely apart?
Tks.