[FIX] mail: load audio/video elements after changing the srcObject

Before this commit, there could be tracebacks after changing the
srcObject of the audioElement of the rtcSession, this commit
fixes this issue by calling `load` on the element after changing
the srcObject.

closes odoo/odoo#76422

X-original-commit: ec3aa0ef713cc0f048dbf6f5a36c86448a411baa
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Thanh Dodeur
2021-09-13 18:31:16 +00:00
parent 85dfd3e180
commit 53ea6f8024
2 changed files with 4 additions and 2 deletions
@@ -50,9 +50,10 @@ export class RtcVideo extends Component {
}
if (!this.rtcSession || !this.rtcSession.videoStream) {
this._videoRef.el.srcObject = undefined;
return;
} else {
this._videoRef.el.srcObject = this.rtcSession.videoStream;
}
this._videoRef.el.srcObject = this.rtcSession.videoStream;
this._videoRef.el.load();
}
//--------------------------------------------------------------------------
@@ -108,6 +108,7 @@ function factory(dependencies) {
this._removeAudio();
const audioElement = this.audioElement || new window.Audio();
audioElement.srcObject = audioStream;
audioElement.load();
audioElement.volume = this.partner && this.partner.volumeSetting ? this.partner.volumeSetting.volume : this.volume;
audioElement.muted = this.messaging.mailRtc.currentRtcSession.isDeaf;
// Using both autoplay and play() as safari may prevent play() outside of user interactions