"TypeError: track.attach is not a function" in React-Twilio Video Application

"TypeError: track.attach is not a function" in React-Twilio Video Application

我的 Twilio React-Video 应用程序适用于通过 Web(和移动浏览器)的本地和远程参与者

当我尝试连接到同一个“房间”以及来自 Twilio Android-SDK-Flutter 插件的所有必要详细信息时,我收到此错误

track.attach() is not a function

componentDidMount() {
        const { track } = this.props;
        track.attach(this.media.current);
    }
// Error : track.attach() is not a function

我可以console.log( )加入房间的远程参与者,但我无法查看远程参与者。

In Mobile Application,it is working fine and "both" the participants are visible.

此处为 Twilio 开发人员布道师。

出现这种情况的正常原因是您正在使用 participant.tracks 获取曲目。然而,participant.tracks is actually a Map of <Track.SID, TrackPublication> and a TrackPublication does not have an attach method.

相反,您应该检查 TrackPublication#isSubscribed. If it is, you can then use trackPublication.track.attach. If the track is not yet subscribed you should listen for the "subscribed" event 是否告诉您曲目现在可用。

在订阅曲目之前,您可能不想呈现试图附加曲目的组件。

如果有帮助请告诉我。