Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
Autoplay video-stream onload in webview

I want to create webview app that captures photo from video element. It works just fine in browser, but I can't start video in webview after page is loaded

function initCamera(front = true) {
  cameraFrontStatus = front;
  var video = document.getElementsByClassName('camera')[0];


  if (navigator.mediaDevices.getUserMedia) {
    if(front == true) {
      var vgaConstraints = {
        video: {
              width: { ideal: 1080 },
              height: { ideal: 1080 },
              facingMode: 'environment'
          },
      };
    } else {
      var vgaConstraints = {
        video: {
              width: { ideal: 1080 },
              height: { ideal: 1080 },
          },
      };
    }

    navigator.mediaDevices.getUserMedia(vgaConstraints).then((stream) => {
      video.srcObject = stream;
    }).catch(function (err0r) {
        console.log("Something went wrong!");
      });
  }
}

codepen example: https://codepen.io/IGentlich/pen/KKZKoOY

Is there any possible way, to start video with stream as src onload in webview?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!