Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a TrackStartError?

I am running audio only sessions using the constraints:

  var constraints = {
    audio: {
      mandatory: {
        echoCancellation: false
      }, optional: [{
        sourceId: audioSource
      }]
    },
    video: false
  };

I am noticing that in a very small number of sessions I am receiving a TrackStartError from the getUserMedia request. I cannot see any correlation between browser/browser version/OS/devices available. Some computers continually get this error, some once and then after a new getUserMedia request no problem and some don't experience this at all.

Is the TrackStartError documented fully as I have seen some issues around mandatory audio flags, but echoCancellation seems not to have this problem?

like image 403
James Christie Avatar asked May 11 '17 15:05

James Christie


1 Answers

TrackStartError is a non-spec Chrome-specific version of NotReadableError:

Although the user granted permission to use the matching devices, a hardware error occurred at the operating system, browser, or Web page level which prevented access to the device.

Seems fitting, given that your constraints are non-spec and Chrome-specific as well. Instead, try:

  var constraints = {
    audio: {
      echoCancellation: { exact: false },
      deviceId: audioSource
    },
  };

I highly recommend the official adapter.js polyfill to deal with such browser differences.

Some systems (like Windows) give exclusive access to hardware devices, which can cause this error if other applications are currently using a mic or camera. It can also be a bug or driver issue.

like image 92
jib Avatar answered Sep 20 '22 13:09

jib