[FIX] website(_slides): delete autoplay of all iframes in the iframefallback

Delete the autoplay for all iframes in the iframefallback.
The autoplay was causing issue where the sound of the previous video
was played on the background. Now we delete the autoplay for all iframe
directly.
This happened in media_iframe_video, youtube player and vimeo videos.
We can do this for all iframe source url directly as it impacts other
modules like website_slides or website_event_track_live.

task-3012952

closes odoo/odoo#122392

X-original-commit: 6be8af36726d750065972e122e8f4a0aa0f56a17
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Hennecart Jérémy (jeh) <jeh@odoo.com>
This commit is contained in:
Jérémy Hennecart (jeh)
2023-05-25 16:29:44 +02:00
parent 0872475ab5
commit da38afff6d
3 changed files with 2 additions and 24 deletions
@@ -424,9 +424,9 @@ export class WebsitePreview extends Component {
* the iframefallback content.
*/
_cleanIframeFallback() {
// Remove autoplay in all media video iframes urls so videos are not
// Remove autoplay in all iframes urls so videos are not
// playing in the background
const iframesEl = this.iframefallback.el.contentDocument.querySelectorAll(".media_iframe_video iframe");
const iframesEl = this.iframefallback.el.contentDocument.querySelectorAll("iframe");
for (const iframeEl of iframesEl) {
const url = new URL(iframeEl.src);
url.searchParams.delete('autoplay');
-1
View File
@@ -72,7 +72,6 @@ Featuring
'assets': {
'web.assets_backend': [
'website_slides/static/src/activity/**/*',
'website_slides/static/src/client_actions/website_preview/website_preview.js',
'website_slides/static/src/slide_category_one2many_field.js',
'website_slides/static/src/slide_category_list_renderer.js',
'website_slides/static/src/scss/slide_views.scss',
@@ -1,21 +0,0 @@
/** @odoo-module **/
import { patch } from 'web.utils';
import { WebsitePreview } from '@website/client_actions/website_preview/website_preview';
patch(WebsitePreview.prototype, 'website_slides_website_preview', {
/**
* @override
*/
_cleanIframeFallback() {
// Remove autoplay in all youtube videos urls so videos are not playing
// in the background
const playersEl = this.iframefallback.el.contentDocument.querySelectorAll('[id^=youtube-player]');
for (const playerEl of playersEl) {
const url = new URL(playerEl.src);
url.searchParams.delete('autoplay');
playerEl.src = url.toString();
}
return this._super(...arguments);
}
});