Skip to content

Commit 94822ca

Browse files
ENGCOM-8934: Fix missing video when advanced js bundling used #32499
2 parents 0c767f1 + ee08273 commit 94822ca

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,9 @@ define([
138138
* @private
139139
*/
140140
_create: function () {
141-
$(this.element).on('gallery:loaded', $.proxy(function () {
142-
this.fotoramaItem = $(this.element).find('.fotorama-item');
143-
this._initialize();
144-
}, this));
141+
$(this.element).data('gallery') ?
142+
this._onGalleryLoaded() :
143+
$(this.element).on('gallery:loaded', this._onGalleryLoaded.bind(this));
145144
},
146145

147146
/**
@@ -171,6 +170,14 @@ define([
171170
}
172171
},
173172

173+
/**
174+
* Callback which fired after gallery gets initialized.
175+
*/
176+
_onGalleryLoaded: function () {
177+
this.fotoramaItem = $(this.element).find('.fotorama-item');
178+
this._initialize();
179+
},
180+
174181
/**
175182
* Clear gallery events to prevent duplicated calls.
176183
*

0 commit comments

Comments
 (0)