我在我的应用程序中使用twilio可编程视频sdk。我已经使用Twilio可编程视频创建了对等视频聊天。每当我参加会议时。我可以看到并听到对方,但对方却无法听到我或看到我。而且创建房间和创建轨道的工作都很好。
await connect(token, {
audio: true,
name: this.meetingId,
video: { width: 640 }
}).then(room => {
this.meetingRoom = room;
// display the face of you
createLocalVideoTrack().then(track => {
const localMediaContainer = document.getElementById('local-media');
localMediaContainer.appendChild(track.attach());
});
room.on('participantConnected', participant => {
console.log(`Participant "${participant.identity}" connected`);
participant.tracks.forEach(publication => {
if (publication.isSubscribed) {
const track = publication.track;
document.getElementById('remote-media-div').appendChild(track.attach());
localStorage.setItem('status','live');
this.videoStyle('remote-media-div');
}
});
这是我正在使用的代码段。它是离子性的。
答案 0 :(得分:0)
您应该听一听房间中是否已经添加了参加者以进行相反的站点视图。
// Log any Participants already connected to the Room
room.participants.forEach(participant => {
console.log(`Participant "${participant.identity}" is connected to the Room`);
participant.tracks.forEach(publication => {
if (publication.isSubscribed) {
document.getElementById('remote-media-div').appendChild(publication.track.attach());
}
});
participant.on('trackSubscribed', track => {
document.getElementById('remote-media-div').appendChild(track.attach());
});
});