magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

The js error when click on video thumbnail in product gallery fullscreen mode #36456

Closed glevhen closed 1 year ago

glevhen commented 2 years ago

Preconditions and environment

Steps to reproduce

1) open on the storefront the product page which has video in product gallery 2) click on the product image to open the gallery fullscreen mode 3) click on the product video thumbnail

Expected result

the product video will autoplay and no errors in browser console

Actual result

the js error will appear in the browser console and video will not autoplay

fotorama-add-video-events.js:605 
Uncaught TypeError: this.fotoramaItem.data(...).activeFrame.$stageFrame[0].trigger is not a function
    at $.<computed>.<computed>._checkForVideo (fotorama-add-video-events.js:605:79)
    at $.<computed>.<computed>._checkForVideo (widget.js:132:25)
    at $.<computed>.<computed>._startPrepareForPlayer (fotorama-add-video-events.js:567:18)
    at $.<computed>.<computed>._startPrepareForPlayer (widget.js:132:25)
    at $.<computed>.<computed>.<anonymous> (fotorama-add-video-events.js:545:22)
    at HTMLDivElement.proxy (jquery.js:10780:23)
    at HTMLDivElement.dispatch (jquery.js:5430:49)
    at elemData.handle (jquery.js:5234:47)
    at Object.trigger (jquery.js:8719:28)
    at HTMLDivElement.<anonymous> (jquery.js:8797:30)

Additional information

image

the issue is caused by changes in the commit https://github.com/magento/magento2/commit/e7a06d34dd47d079081d9f007092e35078e36012#diff-5d428affd814bd350e233104b8fc3b769544ee7e6d04a9b21a8537473876ffadR605

Release note

No response

Triage and priority

m2-assistant[bot] commented 2 years ago

Hi @glevhen. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 2 years ago

Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:


engcom-Dash commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-Dash, here is your Magento Instance: https://fee3132c24b6aab9293178459434c8a6.instances.magento-community.engineering Admin access: https://fee3132c24b6aab9293178459434c8a6.instances.magento-community.engineering/admin_1e8a Login: 125a74cf Password: 8fc32b31069f

engcom-Dash commented 2 years ago

Hi @glevhen ,

we are trying to reproduce the issue in 2.4-develop branch...But we are not able to reproduce the issue. we got some different in console.

Steps we followed: 1.install magento instance 2.select any products 3.open the product page which has video in product gallery 4.click on the product image to open the gallery fullscreen mode 5.click on the product video thumbnail

We got js error in console.we are not able to reproduce the issue.

Screenshots:

Screenshot 2022-11-11 at 2 32 33 PM

Let us know if we missing anything!!!

Thanks!!!

glevhen commented 2 years ago

@engcom-Dash did you upload the correct screenshot? from I see the attached screenshot is for admin product settings and not for product page gallery on the storefront, and there is no opened product video on your screenshot Please, make sure you tested the product gallery on the storefront and followed steps to reproduce

engcom-Dash commented 1 year ago

Hi @glevhen ,

Thanks For your Information....Last time I uploaded wrong screenshot Apologise for that. Again we worked this issue in 2.4-develop branch...The issue is reproducible. So,We are confirming the issue. the js error will appear in the browser console and video will not autoplay as well as screenshots is attached for your reference.

Preconditions: Magento version : 2.4-develop PHP :8.1

Steps we followed:

1.Install fresh 2.4-develop 2.Add product in Magento admin 3.Add Images and videos with respective product 4.Go to front end 5.click the Particular Product 6.Open product image page 7.Click the product image with full screen 8.Click video and check the console 9.The js error is appearing in console as per actual result and video is not autoplay.

Screenshots for your reference:

Screenshot 2022-11-17 at 3 50 06 PM

We are reproduced issue in 2.4-develop instance.So we are confirming the issue.

Let us know if we missing anything!!!

Thanks

github-jira-sync-bot commented 1 year ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 1 year ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 1 year ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 1 year ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-7092 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

rostilos commented 1 year ago

@magento I am working on this

engcom-Bravo commented 1 year ago

Hello,

As I can see this issue got fixed in the scope of the internal Jira ticket AC-7092 by the internal team Related commits: https://github.com/search?q=repo%3Amagento%2Fmagento2+AC-7092&type=commits

Based on the Jira ticket, the target version is 2.4.7-beta1.

Thanks

drinkingsouls commented 1 year ago

What was the fix for this? I am having this issue on Magento 2.4.6 When in mobile resolution and gallery screen is fullsize the video does not play and the console is populated with an error.

fotorama-error

drinkingsouls commented 1 year ago

Was there any solution to this?

YoeriW commented 1 year ago

Was there any solution to this?

@drinkingsouls Copy this file: vendor/magento/module-product-video/view/frontend/web/js/fotorama-add-video-events.js Place the file here: app/design/frontend/[VENDOR]/[THEME]/Magento_ProductVideo/web/js/fotorama-add-video-events.js

Change this on line 560 to line 562:

if (this.isFullscreen && this.fotoramaItem.data('fotorama').activeFrame.i === number) { this.fotoramaItem.data('fotorama').activeFrame.$stageFrame[0].trigger('click'); }

To this:

if (this.isFullscreen && this.fotoramaItem.data('fotorama').activeFrame.i === number) { this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.trigger('click'); }

Now the Product Video will start playing when you click on the thumbnail + the error will not be shown anymore.

If you want the videos to autoplay without being in fullscreen mode, you could change the code to:

if (this.fotoramaItem.data('fotorama').activeFrame.i === number) { this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.trigger('click'); }

You will also need to change on line 703: this.fotoramaItem.data('fotorama').activeFrame[0].$stageFrame.trigger('click');

To this: this.fotoramaItem.data('fotorama').activeFrame.$stageFrame.trigger('click');


To remove the console errors I recommend editing this too: https://github.com/magento/magento2/pull/35017/commits

Copy this file: vendor/magento/magento2-base/lib/web/fotorama/fotorama.js Place the file here: app/design/frontend/[VENDOR]/[THEME]/web/fotorama/fotorama.js

Your addEvent function should look like this:

Change this (Line 1141): function addEvent(el, e, fn, bool) { if (!e) return; el.addEventListener ? el.addEventListener(e, fn, !!bool) : el.attachEvent('on' + e, fn); }

To this:

function addEvent(el, e, fn, bool) { if (!e) return; const options = { get passive() { return e === 'wheel'; } } el.addEventListener ? el.addEventListener(e, fn, options) : el.attachEvent('on' + e, fn); }

And on line 522: addEvent(document, 'touchstart', onOtherStart, true); to addEvent(document, 'touchstart', onOtherStart);

This is tested and working on:

The autoplay function is not working on: