Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video demos on the website can't run #375

Open
fantasticit opened this issue Aug 8, 2019 · 1 comment
Open

video demos on the website can't run #375

fantasticit opened this issue Aug 8, 2019 · 1 comment

Comments

@fantasticit
Copy link

First, thanks for the awesome lib!

In my device, any demo on the website which use video tag can't run correctly.

device info: macOs/10.14.6 Chrome/76.0.3809.87

And, I found some info in MDN. According to it, I rewrite tracking.initUserMedia_.

tracking.initUserMedia_ = function(element, opt_options) {
  // window.navigator.getUserMedia(
  //   {
  //     video: true,
  //     audio: !!(opt_options && opt_options.audio)
  //   },
  //   function(stream) {
  //     try {
  //       element.src = window.URL.createObjectURL(stream);
  //     } catch (err) {
  //       element.src = stream;
  //     }
  //   },
  //   function() {
  //     throw Error("Cannot capture user camera.");
  //   }
  // );

  window.navigator.mediaDevices
    .getUserMedia({
      video: true,
      audio: !!(opt_options && opt_options.audio)
    })
    .then(stream => {
      element.srcObject = stream;
      video.onloadedmetadata = function(e) {
        element.play();
      };
    })
    .catch(err => {
      throw Error("Cannot capture user camera.", err);
    });
};

Then, the demos works!

@qsenn35
Copy link

qsenn35 commented Apr 12, 2020

Running into same issue, seems like bower is changing element.srcObject to element.src. Digging to find a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants