Skip to content

Commit db18db2

Browse files
committed
Merge pull request #83 from ulaharbmg/JS-372
JS-372 [Full-screen mode] Left and right side of image visible while video player is loading
2 parents 9f00644 + e73d46a commit db18db2

File tree

7 files changed

+93
-114
lines changed

7 files changed

+93
-114
lines changed

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

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ define([
9797
},
9898

9999
PV: 'product-video', // [CONST]
100+
PVLOADED: 'fotorama__product-video--loaded', // [CONST]
100101
VID: 'video', // [CONST]
101102
VI: 'vimeo', // [CONST]
102103
FTVC: 'fotorama__video-close',
@@ -127,7 +128,7 @@ define([
127128
* @private
128129
*/
129130
_checkFullscreen: function () {
130-
if ($(this.element).find('.fotorama__fullscreen-icon')) {
131+
if (this.element.data('fotorama').fullScreen || false) {
131132
this.isFullscreen = true;
132133
}
133134
},
@@ -226,11 +227,9 @@ define([
226227
* @private
227228
*/
228229
_hideCloseVideo: function () {
229-
$(this.element).find('.' + this.FTVC).css({
230-
opacity: 0,
231-
transform: 'translate3d(95px, -95px, 0)',
232-
display: 'none'
233-
});
230+
$(this.element)
231+
.find('.' + this.FTVC)
232+
.removeClass('fotorama-show-control');
234233
$('.' + this.FTAR).removeClass('hidden-video');
235234
},
236235

@@ -239,11 +238,9 @@ define([
239238
* @private
240239
*/
241240
_showCloseVideo: function () {
242-
$(this.element).find('.' + this.FTVC).css({
243-
opacity: 1,
244-
transform: 'translate3d(0px, 0px, 0)',
245-
display: 'block'
246-
});
241+
$(this.element)
242+
.find('.' + this.FTVC)
243+
.addClass('fotorama-show-control');
247244
$('.' + this.FTAR).addClass('hidden-video');
248245
},
249246

@@ -597,23 +594,18 @@ define([
597594
*/
598595
_unloadVideoPlayer: function ($wrapper, current, close) {
599596
var self = this;
600-
597+
$wrapper.find('.' + this.PVLOADED).not('.fotorama__active').removeClass(this.PVLOADED);
601598
$wrapper.find('.' + this.PV).each(function () {
602599
var $item = $(this).parent(),
603600
cloneVideoDiv,
604601
iframeElement = $(this).find('iframe'),
605602
currentIndex,
606-
itemIndex,
607-
videoPreview = $item.find('img').not('.fotorama__img--full');
603+
itemIndex;
608604

609605
if (iframeElement.length === 0) {
610606
return;
611607
}
612608

613-
if (!videoPreview.is(':visible')) {
614-
videoPreview.show();
615-
}
616-
617609
currentIndex = current.activeFrame.$stageFrame.index();
618610
itemIndex = $item.index();
619611

app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ define(['jquery', 'jquery/ui'], function ($) {
189189
*/
190190
'onReady': function onPlayerReady() {
191191
self._player.getDuration();
192-
self.element.closest('.fotorama-video-container').find('img').hide();
192+
self.element.closest('.fotorama__stage__frame').addClass('fotorama__product-video--loaded');
193193
},
194194

195195
/**
@@ -336,7 +336,7 @@ define(['jquery', 'jquery/ui'], function ($) {
336336

337337
// Froogaloop throws error without a registered ready event
338338
this._player.addEvent('ready', function (id) {
339-
$('#' + id).closest('.fotorama-video-container').find('img').hide();
339+
$('#' + id).closest('.fotorama__stage__frame').addClass('fotorama__product-video--loaded');
340340
});
341341
},
342342

app/design/frontend/Magento/blank/Magento_ProductVideo/web/css/source/_module.less

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ and (orientation : landscape) {
8080
z-index: -1 !important;
8181
}
8282

83-
.fotorama__video-close {
84-
bottom: 89%;
85-
top: auto;
86-
}
87-
8883
.fotorama__stage__shaft:focus .fotorama__stage__frame.fotorama__active:after {
8984
bottom: 0;
9085
content: '';

0 commit comments

Comments
 (0)