0

I have a problem with online connecting between 2 users.

I am trying to create a video call with, Laravel, React and Pusher.com in local host when two different user enter their home page in the same moment, the second can't get his media (allow permissions were sent but no video show), and I get this error in console:

Uncaught (in promise) Error: unable to fetch stream ${err}

For the second user. This is my MediaHandler.js:

export default class MediaHandler{
    getPermissions(){
        return new Promise((res,rej) => {
            navigator.mediaDevices.getUserMedia({video: true, audio: true})
            .then((stream)=> {
                res(stream);
            })
            .catch(err=> {
                throw new Error('unable to fetch stream ${err}');
            })
        );
    }
}
N'Bayramberdiyev
  • 5,936
  • 7
  • 27
  • 47
kiana.ka
  • 509
  • 2
  • 5
  • 13

1 Answers1

1

You need to write:

throw new Error(`Unable to fetch stream ${err}`);  

and not:

throw new Error('unable to fetch stream ${err}');   
DuDa
  • 3,718
  • 4
  • 16
  • 36