From 80fa8058674f897d992efdc86ec9f3f148107170 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Wed, 20 Jul 2022 13:43:39 +0000 Subject: [PATCH] [IMP] web_editor: add "hide controls" option to vimeo video Only youtube and dailymotion were able to add this property to their video. Maybe it was not supported by vimeo back then, but it seems to be supported now. It improves the vimeo youtube in two ways: 1. For background video, the controls are now hidden. There were visible for a few seconds before this PR which is not ideal 2. For non background video, there were no way to hide the controls which might be problematic to some users as in mobile there is the controls display but also an ugly "Tap to unmute" in the middle of the video. Step to reproduce (background video): - Drag & drop a "Text - Image" snippet and add it the biggest possible padding, also add padding to the image (so you see the full video and not just part of it) - Double click on the image, then on the video tab insert a vimeo url - Save, you will see the controls for a few seconds (progress bar, video title, link to vimeo, etc) Step to reproduce (non background video): - Drag & drop a "Text - Image" snippet and double click on the image - On the video tab, insert a vimeo url - Select "Auto Play" - Save and go to mobile, you will see the controls and an ugly "Tap to mute" in the middle of the video. The "Tap to mute" is a browser feature, not a vimeo feature. Browsers are muting video by default when auto play. Still, some people want to have a nice auto play video shown to users without sounds and don't want that overlay/controls. opw-2901256 closes odoo/odoo#96804 X-original-commit: 7128e4080511b5f224da3dce6d88ba8bcf9a0d47 Signed-off-by: Quentin Smetz (qsm) Signed-off-by: Romain Derie (rde) --- .../static/src/components/media_dialog/video_selector.js | 2 +- addons/web_editor/tools.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/components/media_dialog/video_selector.js b/addons/web_editor/static/src/components/media_dialog/video_selector.js index 0b6e771cf3b..30dca19a6c5 100644 --- a/addons/web_editor/static/src/components/media_dialog/video_selector.js +++ b/addons/web_editor/static/src/components/media_dialog/video_selector.js @@ -35,7 +35,7 @@ export class VideoSelector extends Component { }, hide_controls: { label: this.env._t("Hide player controls"), - platforms: [this.PLATFORMS.youtube, this.PLATFORMS.dailymotion], + platforms: [this.PLATFORMS.youtube, this.PLATFORMS.dailymotion, this.PLATFORMS.vimeo], urlParameter: 'controls=0', }, hide_fullscreen: { diff --git a/addons/web_editor/tools.py b/addons/web_editor/tools.py index 2f3b1a63b4a..857ca380212 100644 --- a/addons/web_editor/tools.py +++ b/addons/web_editor/tools.py @@ -89,6 +89,8 @@ def get_video_url_data(video_url, autoplay=False, loop=False, hide_controls=Fals params['autoplay'] = autoplay and 1 or 0 if autoplay: params['muted'] = 1 + if hide_controls: + params['controls'] = 0 if loop: params['loop'] = 1 embed_url = f'//player.vimeo.com/video/{video_id}'