[FIX] mail: prevent traceback when the audio of a peer is loaded

Before this commit, we would reset the audio of a peer before setting a
new one which is not necessary as the track remains the same for the
whole lifetime of the transceiver (and therefore the peerConnection).

Moreover, calling `pause` on the audioElement could lead to a race
condition with the following `play` and lead to a traceback.

closes odoo/odoo#77883

X-original-commit: e0b957cd3cd657ad15168e35fdaaeebccb7be4be
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Thanh Dodeur
2021-10-05 15:42:04 +00:00
parent 7a00f107aa
commit af015814f6
@@ -65,7 +65,6 @@ function factory(dependencies) {
* @param {boolean} param0.isTalking
*/
async setAudio({ audioStream, isMuted, isTalking }) {
this._removeAudio();
const audioElement = this.audioElement || new window.Audio();
try {
audioElement.srcObject = audioStream;