Skip to content

Commit

Permalink
Don't try to load nonexisting cameras. Fix #103
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasloven committed Oct 21, 2020
1 parent 6b61bf1 commit 415eb75
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/browser_mod/browser_mod.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ class BrowserMod {
`;
document.body.appendChild(this._canvas);
document.body.appendChild(this._video);
if(!navigator.mediaDevices) {
return;
}
navigator.mediaDevices.getUserMedia({video: true, audio: false}).then((stream) => {
this._video.srcObject = stream;
this._video.play();
Expand Down
3 changes: 3 additions & 0 deletions test/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ default_config:
demo:

browser_mod:
devices:
camdevice:
camera: true

lovelace:
mode: yaml
Expand Down

0 comments on commit 415eb75

Please sign in to comment.