ionorg / ion-sdk-js

ion javascript sdk
MIT License
102 stars 70 forks source link

How to judge the loss of video stream #162

Open aixinaxc opened 3 years ago

aixinaxc commented 3 years ago

How to judge the loss of video stream? When a browser video is closed, how do other browsers know that the video stream is closed?

putrafajarh commented 3 years ago

i hope this can help

stream.onremovetrack = () => {
    try {
        const i = this.streams.findIndex((stm) => stm.id === stream.id)
        if (i !== -1) {
            this.streams.splice(i, 1);
        }
    } catch (error) {
        console.error(error)
    }
}