[FIX] bus: crashmanager popup if beep can't be played
According to MDN, HTMLMediaElement returns > A Promise which is resolved when playback has been started, or is > rejected if for any reason playback cannot be started. > > Note: Older browsers may not return a value from play(). Since un-resolved un-handled promises re-raise and trigger the crash manager, this is extremely noticeable if the browser doesn't support the media type or is not currently allowed to play medias (e.g. configured to prevent auto-play). This just avoids the error, but eventually it might be useful to display a toast noting the user could allow sounds iff the rejection reason is NotAllowedError. This fix would probably be implementable / implemented on older revisions (which might have the issue, just not as prominent as unhandledrejection is not hooked into the crash manager). closes odoo/odoo#33260 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
@@ -68,7 +68,7 @@ var BusService = CrossTab.extend(ServicesMixin, {
|
||||
var session = this.getSession();
|
||||
this._audio.src = session.url("/mail/static/src/audio/ting" + ext);
|
||||
}
|
||||
this._audio.play();
|
||||
Promise.resolve(this._audio.play()).catch(_.noop);
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user