Skip to content

Commit 06af7b9

Browse files
committed
Fixed base video issue for fotorama bug
1 parent 6737341 commit 06af7b9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

app/code/Magento/ProductVideo/view/frontend/web/js/fotorama-add-video-events.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ define([
1111
], function ($) {
1212
'use strict';
1313

14+
var allowBase = true; //global var is needed because fotorama always fully reloads events in case of fullscreen
15+
1416
/**
1517
* @private
1618
*/
@@ -309,13 +311,16 @@ define([
309311

310312
if (
311313
videoItem.mediaType === this.VID && videoItem.isBase &&
312-
this.options.VideoSettings[0].playIfBase
314+
this.options.VideoSettings[0].playIfBase && allowBase
313315
) {
314316
this.Base = true;
317+
allowBase = false;
315318
}
316319
}
317320

318-
this._createCloseVideo($(this.element).data('fotorama'), this.Base);
321+
if (!this.isFullscreen) {
322+
this._createCloseVideo($(this.element).data('fotorama'), this.Base);
323+
}
319324
},
320325

321326
/**
@@ -523,9 +528,11 @@ define([
523528
this.Base = false;
524529
}
525530
}, this), 50);
526-
} else { //if not a vimeo - play it immediately
527-
$(this.element).data('fotorama').activeFrame.$stageFrame[0].click();
528-
this.Base = false;
531+
} else { //if not a vimeo - play it immediately with a little lag in case for fotorama fullscreen
532+
setTimeout($.proxy(function(){
533+
$(this.element).data('fotorama').activeFrame.$stageFrame[0].click();
534+
this.Base = false;
535+
}, this), 50);
529536
}
530537
}
531538
},

0 commit comments

Comments
 (0)