Skip to content

Refactor event handling in amp-slikeplayer #40355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SlikeTech
Copy link
Contributor

  • Renamed SlEvent to CleoEvent and added new ad-related events.
  • Implemented viewportCallback to play/pause based on visibility.
  • Updated redispatch logic to handle new events appropriately.

- Renamed SlEvent to CleoEvent and added new ad-related events.
- Implemented viewportCallback to play/pause based on visibility.
- Updated redispatch logic to handle new events appropriately.
@erwinmombay erwinmombay requested a review from Copilot July 15, 2025 18:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the event handling in amp-slikeplayer by renaming the event mapping constant, adding visibility-based playback control, and updating the redispatch logic to accommodate new events.

  • Renamed SlEvent to CleoEvent and added seek and ad-related event mappings.
  • Implemented viewportCallback to automatically play/pause based on element visibility.
  • Updated calls to redispatch and expanded the event switch to include the new mappings.
Comments suppressed due to low confidence (3)

extensions/amp-slikeplayer/0.1/amp-slikeplayer.js:33

  • [nitpick] Consider adding unit tests for the newly introduced event mappings (seeked, seeking, ad* events) to ensure redispatch correctly handles each case.
const CleoEvent = {

extensions/amp-slikeplayer/0.1/amp-slikeplayer.js:46

  • Mapping adComplete to the same enum value as adEnd (AD_END) may be confusing or redundant; consider using a distinct AD_COMPLETE enum or removing the duplicate mapping.
  'adComplete': VideoEvents_Enum.AD_END,

extensions/amp-slikeplayer/0.1/amp-slikeplayer.js:180

  • viewportCallback should return a boolean (e.g., return true;) to indicate it wants to continue receiving visibility callbacks; otherwise observation stops after the first call.
  }

@erwinmombay erwinmombay self-requested a review July 15, 2025 18:52
@erwinmombay
Copy link
Member

is this related to the changes in #40350 ?

@SlikeTech
Copy link
Contributor Author

SlikeTech commented Jul 22, 2025

@erwinmombay I just merged main into our branch to update it. The 'All Unit Tests' check is failing, but it's unrelated to our changes. Could you please re-run the unit tests?

Screenshot 2025-07-22 at 2 48 57 PM

@erwinmombay
Copy link
Member

re-running

@SlikeTech
Copy link
Contributor Author

SlikeTech commented Jul 24, 2025

The unit tests are failing for a different component (amp-video). I believe the issue is that the URL is not accessible. Please let me know if any changes are needed from my end.
Screenshot 2025-07-24 at 1 09 13 PM

@erwinmombay
Copy link
Member

@SlikeTech can you try rebasing and force pushing to trigger a re-run of the tests. if it fails again ill investigate when possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants