Don't try to load nonexisting cameras. Fix #103

This commit is contained in:
Thomas Lovén 2020-10-21 21:08:29 +02:00
parent 6b61bf18cd
commit 415eb75e87
3 changed files with 7 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -381,6 +381,9 @@ class BrowserMod {
`; `;
document.body.appendChild(this._canvas); document.body.appendChild(this._canvas);
document.body.appendChild(this._video); document.body.appendChild(this._video);
if(!navigator.mediaDevices) {
return;
}
navigator.mediaDevices.getUserMedia({video: true, audio: false}).then((stream) => { navigator.mediaDevices.getUserMedia({video: true, audio: false}).then((stream) => {
this._video.srcObject = stream; this._video.srcObject = stream;
this._video.play(); this._video.play();

View File

@ -3,6 +3,9 @@ default_config:
demo: demo:
browser_mod: browser_mod:
devices:
camdevice:
camera: true
lovelace: lovelace:
mode: yaml mode: yaml