twilio / video-quickstart-js

A quickstart and code samples for Twilio Video JavaScript SDK. https://www.twilio.com/docs/video
Other
389 stars 337 forks source link

when i try to detach track and remove elements but element array is empty #220

Closed dinuone closed 1 year ago

dinuone commented 1 year ago

changeFront(){

  this.activeRoom.localParticipant.tracks.forEach( (publication)=>{
    console.log('change cam-----------')
    console.log(publication.track)
    publication.track.stop()
    const attachments = publication.track.detach()
    console.log(attachments)
    attachments.forEach(element => element.remove())
    publication.unpublish()
  })
  this.activeRoom.disconnect();

  // const track = [this.activeRoom.localParticipant.videoTracks.values()][0].track;
  // track.detach().forEach(element => element.remove());
  // this.activeRoom.localParticipant.unpublishTrack(track);
},
**console log---------------------------**
change cam-----------
Video.vue?b6f3:181 LocalAudioTrack {kind: 'audio', name: '99d3ff4f-af8f-4ee6-9fe1-eec31bc4f387', processedTrack: null, …}
Video.vue?b6f3:184 []
Video.vue?b6f3:180 change cam-----------
Video.vue?b6f3:181 LocalVideoTrack {kind: 'video', name: 'a02cbb89-65f6-4d4a-ae3a-17328ad21636', processedTrack: null, …}
Video.vue?b6f3:184 []