diff --git a/addons/mail/static/src/components/call_participant_video/call_participant_video.xml b/addons/mail/static/src/components/call_participant_video/call_participant_video.xml index fabac5088ae..86be94b7172 100644 --- a/addons/mail/static/src/components/call_participant_video/call_participant_video.xml +++ b/addons/mail/static/src/components/call_participant_video/call_participant_video.xml @@ -8,7 +8,7 @@ playsinline="true" autoplay="true" muted="true" - t-on-loadedmetadata="callParticipantVideoView.rtcSession.onVideoLoadedMetaData" + t-on-loadedmetadata="callParticipantVideoView.onVideoLoadedMetaData" t-ref="root" /> diff --git a/addons/mail/static/src/models/call_participant_video_view.js b/addons/mail/static/src/models/call_participant_video_view.js index 8909bad2c57..de552158e3e 100644 --- a/addons/mail/static/src/models/call_participant_video_view.js +++ b/addons/mail/static/src/models/call_participant_video_view.js @@ -8,6 +8,23 @@ registerModel({ name: 'CallParticipantVideoView', identifyingFields: ['callParticipantCardOwner'], recordMethods: { + /** + * Plays the video as some browsers may not support or block autoplay. + * + * @param {Event} ev + */ + async onVideoLoadedMetaData(ev) { + try { + await ev.target.play(); + } catch (error) { + if (typeof error === 'object' && error.name === 'NotAllowedError') { + // Ignored as some browsers may reject play() calls that do not + // originate from a user input. + return; + } + throw error; + } + }, /** * @private * @returns {FieldCommand} diff --git a/addons/mail/static/src/models/rtc_session.js b/addons/mail/static/src/models/rtc_session.js index e7b311b57e5..a9d770a7e9d 100644 --- a/addons/mail/static/src/models/rtc_session.js +++ b/addons/mail/static/src/models/rtc_session.js @@ -13,23 +13,6 @@ registerModel({ }, }, recordMethods: { - /** - * Plays the video as some browsers may not support or block autoplay. - * - * @param {Event} ev - */ - async onVideoLoadedMetaData(ev) { - try { - await ev.target.play(); - } catch (error) { - if (typeof error === 'object' && error.name === 'NotAllowedError') { - // Ignored as some browsers may reject play() calls that do not - // originate from a user input. - return; - } - throw error; - } - }, /** * restores the session to its default values */