Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DOMException: Requested device not found GetUserMedia

Trying to access IP Camera that is connected to a wifi.

I am connected to that wifi but I am getting error. If I try open using vlc I am able to connect but not getUserMedia has null.

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
})
export class HomeComponent {
  @ViewChild('video') video: any; 
  constructor() {
  }
  hasGetUserMedia() {
  return !!(navigator.mediaDevices &&
    navigator.mediaDevices.getUserMedia);
}


ngAfterViewInit() {
  if (this.hasGetUserMedia()) {
    // Good to go!
    console.log("Gooddd................");
  } else {
    alert('getUserMedia() is not supported by your browser');
  }
  let _video = this.video.nativeElement;
  if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
    navigator.mediaDevices.getUserMedia({ video: true, audio: true })
      .then(function (stream) {
        _video.src = window.URL.createObjectURL(stream);
        _video.play();
      }).catch(function (err) {
        console.log(err);
      });
    }
  }
}

<video #video width="640" height="480" autoplay></video>
like image 537
UI_Dev Avatar asked Mar 24 '26 06:03

UI_Dev


2 Answers

This happens when you dont have any device to capture video or capture audio

try checking if your webcam and your microphone are working fine

like image 143
buster95 Avatar answered Mar 25 '26 20:03

buster95


Try without "audio: true". Its help for my. (Microphone are not work). And check webcam on other sites. Maybe need check permissions for this page.

like image 30
Александр Катаев Avatar answered Mar 25 '26 21:03

Александр Катаев



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!