[REF] mail: move DOM function to view model
Since the addition of the CallParticipantVideoView model, it makes more sense to have this view(DOM) related function in it. closes odoo/odoo#93260 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
playsinline="true"
|
||||
autoplay="true"
|
||||
muted="true"
|
||||
t-on-loadedmetadata="callParticipantVideoView.rtcSession.onVideoLoadedMetaData"
|
||||
t-on-loadedmetadata="callParticipantVideoView.onVideoLoadedMetaData"
|
||||
t-ref="root"
|
||||
/>
|
||||
</t>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user