Skip to content

Commit

Permalink
fix(RemoteVideo): .oncanplay -> addEventListener
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hristoterezov committed Apr 24, 2020
1 parent 57bb2ea commit 851976e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/UI/videolayout/RemoteVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 851976e

Please sign in to comment.