fix(RemoteVideo): .oncanplay -> addEventListener

Replaces the .oncanplay listener with addEventListener('canplay', ...).
This is needed because third party libraries (for example callstats)
are brutally overriding the .oncanplay property and replacing our
listener.
This commit is contained in:
Hristo Terezov 2020-04-24 15:38:17 -05:00
parent 57bb2ead36
commit 851976ebdf
1 changed files with 4 additions and 2 deletions

View File

@ -456,14 +456,16 @@ export default class RemoteVideo extends SmallVideo {
return;
}
streamElement.oncanplay = () => {
const listener = () => {
this._canPlayEventReceived = true;
this.VideoLayout.remoteVideoActive(streamElement, this.id);
streamElement.oncanplay = undefined;
streamElement.removeEventListener('canplay', listener);
// Refresh to show the video
this.updateView();
};
streamElement.addEventListener('canplay', listener);
}
/**