twilio / twilio-video.js

Twilio’s Programmable Video JavaScript SDK
https://www.twilio.com/docs/video/javascript
Other
571 stars 217 forks source link

TypeError: track must be a LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack #352

Closed JunusErgin closed 4 years ago

JunusErgin commented 6 years ago

Code to reproduce the issue: Hello, i'm trying to get my local video with the following code:

    private E_VIDEO_SETTINGS = {
        logLevel: 'debug',
        video: true,
        width: 1920,
        height: 1080
    };

    Twilio.Video
             .createLocalVideoTrack(this.E_VIDEO_SETTINGS)
             .then((localVideoTrack: any) => {
                 this._logger.debug('[VideoService] Created local video track', localVideoTrack);
              // ...

Expected behavior:

I should get a LocalVideoTrack.

Actual behavior: I'm getting the following error:

TypeError: track must be a LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack

This error occurs only in the Chrome browser and only on one of my computers (Medion Akoya S3409, ~ 2 years old, Latest Windows 10 Home). I debuged the twilio-video-min.js file (v1.11.1) in order to reproduce the error. First, twilio tries to get the user media: image This works successfully: image In the next step, Twilio-video tries to convert the MediaStreamTrack into a local track with the function:

                        return asLocalTrack(mediaStreamTrack, Object.assign(localTrackNameOptions[mediaStreamTrack.kind], 

Twilios function asLocalTrack(track, options) now throws my error that is mentioned above: TypeError: track must be a LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack

i tried to debug the function as well: image My console gave out: image

For some reason, your line if (track instanceof options.MediaStreamTrack) {... returns ´false´for some reason. Even if a MediaStreamTrack is provided in the first parameter it seems to differ from the one that is provided in the options.

Ad mentioned, my code works on all other computers. It also works on Opera, Vivaldi, Firefox and Edge on the current computer. Software versions:

Thanks for your help in advance, Junus

manjeshbhargav commented 6 years ago

Hi @JunusErgin ,

Thank you for your question. So, to sum up, are you saying that the code snippet you posted works on all other OSs except for Windows 10 Home? Please let me know if that is indeed the case.

Thanks,

Manjesh Malavalli JSDK Team

mertkokusen commented 3 years ago

We are experiencing the same issue. @JunusErgin were you able to resolve this. The error occurs intermitantly. User can't connect to the room but after refreshing the page a couple of times, they can connect.

koistya commented 3 years ago

Same issue here — track is not an instance of options.MediaStreamTrack:

image

Artfloriani commented 2 years ago

@mertkokusen @JunusErgin were you guys able to workaround this issue?