Skip to content

Issue with Dynamic Media video player #16398

Closed

Description

@mvuk27

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

Hello,

My name is Matija, and I’m a frontend developer working on an Adobe Experience Manager project. We are building websites for multiple brands and plan to use Sentry as our primary monitoring tool. However, we have encountered an issue where enabling Sentry on the page causes the video playback to behave unexpectedly—specifically, the play/pause function seems to be triggered twice.

You can see this behavior on the following page containing the video component with Sentry enabled:
https://docs-int.assaabloy.com/components/hero-ssr

Try starting the video, then click the play/pause button in the bottom left corner to observe the issue.

Thank you for your help!

Expected Result

Play/pause button function is called 2x

Actual Result

Play/pause button function is called 1x

Product Area

Issues

Link

No response

DSN

No response

Version

No response

Activity

  1. getsantry commented on May 23, 2025

    @getsantry

    Auto-routing to @getsentry/product-owners-issues for triage ⏲️

  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 23, 2025
  3. scttcper commented on May 27, 2025

    @scttcper
    Member

    I'm assuming you're talking about the sentry javascript sdk. You will need to include more details of your implementation in order for them to help you quickly. How is sentry being initialized, what kind of project is it, what version are you using.

  4. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 27, 2025
  5. transferred this issue fromgetsentry/sentryon May 27, 2025
  6. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 27, 2025
  7. Lms24 commented on May 28, 2025

    @Lms24
    Member

    Hey, thanks for reporting! I've been talking about this based on your support ticket with @rodolfoBee and could fix the issue by moving the script that injects the Sentry loader directly to the <head> section. Not sure if you're comfortable with me sharing your minimal repro publicly (please let me know!). For now, you should get the updated version via the Zendesk ticket.

    Also, as @scttcper said, the more information you share about your SDK setup, version, options, app (e.g. framework used), etc. the better we can help you!

  8. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 28, 2025
  9. mvuk27 commented on May 28, 2025

    @mvuk27
    Author

    Hi @Lms24 @scttcper ,

    Unfortunately I can't share the full repository, only thing I can share is the HTML code snippet that I've sent already to @rodolfoBee. Also, unfortunately it's not an option to inject SDK directly into the head, it needs to be injected and loaded after the video has been loaded and initialised.

    We are using Adobe Experience Manager as a Cloud Service, video is loaded through their Dynamic Media Scene7 JS file (also available in the HTML snippet that I've sent before). Since we are just testing the Sentry integration with the current project, we are using trial version, with version 9.xx. Options for initialising Sentry are also provided in the HTML snippet.

    Here's the HTML code snippet.

    html.txt

  10. 14 remaining items

  11. Lms24 commented on May 28, 2025

    @Lms24
    Member

    I found the issue and this is indeed related to the Adobe player mocking with event listeners in a very weird way. This is because the script registers the click handler of the playPauseButton multiple times. Once initially and then another time (or actually multiple times) when users first hover over the play/pause button. This is generally fine because if you register the same handler twice, it only gets executed once.

    Example:

    const myHandler = () => {
      console.log('clicked');
    }
    
    myButton.addEventListener('click', myHandler);
    myButton.addEventListener('click', myHandler);
    // Console result:
    // 'click' <-- only once

    However, the problem here is that our SDK interjects itself in the middle and on the second call, it makes sure that a patched version of the handler is registered. Since the patched handler no longer has the same identitfy as the original handler, it is added another time. So basically this:

    const myHandler = () => {
      console.log('clicked');
    }
    
    myButton.addEventListener('click', myHandler);
    
    const patchedhandler = () => {
      console.log('observed a click');
      return myHandler();
    }
    
    myButton.addEventListener('click', myHandler);
    // Console result:
    // 'click'
    // 'observed a click'
    // 'click'

    So now, the handler is registered twice, meaning on one click, both handlers get executed and hence it appears like a double click, starting and pausing the vide.

    This also explains why initializing the SDK before the video script solves this issue: At this point, the SDK comes in early enough to already patch the first handler. At this point, it returns the patched handler but marks the original handler as patched. When addEventListener is called for the second time, we don't return another patched handler, but we already see that the original handler was patched, so we return the first patched handler (i.e. same identitiy).

    I don't think we can necessarily fix this on the SDK side but you'd rather have to keep this integration disabled. I tried replacing the monkey patch with a Proxy but even proxied functions have a different identity, so no luck.

    Note that you shouldn't loose any errors with this integration being disabled. They should still be caught by our globalHandlersIntegration.

  12. mvuk27 commented on May 28, 2025

    @mvuk27
    Author

    Thank you for your response. This seems to solve our issue, at least temporarily. I'll take this with me to Adobe support.

  13. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 28, 2025
  14. Lms24 commented on May 28, 2025

    @Lms24
    Member

    @mvuk27 I opened #16412 to add an option to browserApiErrorsIntegration to ensure we don't cause this double invocation. I tried this on your reproduction and can confirm it also fixes the double button click. So once this is released, you can safely use browserApiErrorsIntegration again if you set the option in your Sentry.init call:

    Sentry.init({
      // ...
      integrations: [
        Sentry.browserApiErrorsIntegration({
          unregisterOriginalCallbacks: true,
        }),
      ],
    });

    Will also update our docs in a bit to document this option.

  15. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 28, 2025
  16. github-actions commented on May 30, 2025

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #16412, which was included in the 9.24.0 release.

  17. ghost added on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions