[FIX] website: fix background video widget on mobile
Issue
- Download the customer db: stargue-inc
- Go on the website in mobile mode
Traceback & the second item in the carousel is not displayed.
Cause
Traceback: we use `this.$iframe` without checking if it's defined
Second item not displayed: the first video promise is overriden
by the second video promise.
Solution
Check if this.$iframe is defined and resolve the old promise
instead of overriding it.
OPW-2152690
closes odoo/odoo#42139
X-original-commit: f5f569b4705f37865cb976a4df10a0d9f388fae2
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
This commit is contained in:
@@ -664,8 +664,14 @@ registry.backgroundVideo = publicWidget.Widget.extend({
|
||||
this.videoSrc = this.videoSrc + "&enablejsapi=1";
|
||||
|
||||
if (!window.YT) {
|
||||
var oldOnYoutubeIframeAPIReady = window.onYouTubeIframeAPIReady;
|
||||
proms.push(new Promise(resolve => {
|
||||
window.onYouTubeIframeAPIReady = () => resolve();
|
||||
window.onYouTubeIframeAPIReady = () => {
|
||||
if (oldOnYoutubeIframeAPIReady) {
|
||||
oldOnYoutubeIframeAPIReady();
|
||||
}
|
||||
return resolve();
|
||||
};
|
||||
}));
|
||||
$('<script/>', {
|
||||
src: 'https://www.youtube.com/iframe_api',
|
||||
@@ -713,6 +719,10 @@ registry.backgroundVideo = publicWidget.Widget.extend({
|
||||
* @private
|
||||
*/
|
||||
_adjustIframe: function () {
|
||||
if (!this.$iframe) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$iframe.removeClass('show');
|
||||
|
||||
// Adjust the iframe
|
||||
|
||||
Reference in New Issue
Block a user