我正在使用 Twilio 视频会议与 Cordova 一起开发视频直播应用程序。我正在尝试从设备前置摄像头流式传输视频。它在 Android 上运行良好,但我在 iOS 上遇到了一些问题。
我正在使用 cordova-plugin-iosrtc 插件来公开 navigator.mediaDevices API
在连接方法上我收到此错误
TypeError: track must be a LocalAudioTrack, LocalVideoTrack, LocalDataTrack, orMediaStreamTrack
我将代码更改为所需的轨道类型
const { LocalAudioTrack, LocalVideoTrack, connect } = require('twilio-video');
constmediaStream = awaitnavigator.mediaDevices.getUserMedia(constraints);
const tracks = mediaStream.getTracks().map(track => track.kind === 'audio' ? newLocalAudioTrack(track) :newLocalVideoTrack(track)); const room = awaitconnect('token', { tracks });
更改后出现此错误
TypeError: Argument 1 ('track') to mediaStream.addTrack must be an instance of MediaStreamTrack and sometimes this one => typeError undefined isn't an object (evaluating 'tracks.id')
在此先感谢我感谢任何帮助