Skip to content

feat/pause video on click#562

Closed
ZemyCode wants to merge 3 commits into
SevenTV:masterfrom
ZemyCode:feat/pauseOnPlayerClick
Closed

feat/pause video on click#562
ZemyCode wants to merge 3 commits into
SevenTV:masterfrom
ZemyCode:feat/pauseOnPlayerClick

Conversation

@ZemyCode
Copy link
Copy Markdown
Contributor

@ZemyCode ZemyCode commented May 2, 2023

Feature

Reference: #484

This PR adds a "VideoPlayerModule" and with this module the feature to pause the video player on click is added.
Event listener is added on page load or when the setting is enabled, and the event listener is removed when setting is disabled.
Setting is false by default.

image

Added a sub category to "Channel" called "Video Player" for this setting. Would like feedback on if I should move to a different category or change the name at all. Possibly "General" instead of "Channel"?

@ZemyCode ZemyCode changed the title Feat: Pause Video on Click feat/pause video on click May 2, 2023

const pauseOnClickEnabled = useConfig<boolean>("channel.video_player.pause_on_click");

const videoPlayerClickHandler = document.querySelector('div[data-a-target="player-overlay-click-handler"]');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please don't use DOM operations. We have built an array of React utilities capable of hooking Twitch's components, you can see those under common/ReactHooks.ts and common/Reflection.ts.

In order to hook to hook the relevant component, a predicate such as this might work (untested, only visually found this scrolling through the react tree)

(n) => n.props && n.props.mediaPlayerInstance && n.props.videoContainer

@ZemyCode ZemyCode marked this pull request as draft May 7, 2023 21:33
@chipsTM chipsTM mentioned this pull request May 16, 2023
@AnatoleAM
Copy link
Copy Markdown
Contributor

Superseded by #727

@AnatoleAM AnatoleAM closed this Jun 26, 2023
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