Repository navigation
Add a player view tap event - #1020
Open
jorisfluyt wants to merge 8 commits into
Open
jorisfluyt wants to merge 8 commits into
jorisfluyt wants to merge 8 commits into
Conversation
UIs drawn on top of the player catch every tap to show or hide their controls, which blocks elements the player draws itself, such as THEOads overlays. A tap event on the player view lets UIs pass taps through and still toggle their controls. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
React Native does not deliver JS touch events for touches on the native player view on Android, so a JS onTouchEnd never fired there. The native views now detect taps themselves, after their children such as THEOads overlays have handled them, and report them as onNativeViewTap, which THEOplayerView turns into the view tap event. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The poster is drawn above the native player view, so taps on it never reached the native tap detection and produced no view tap event. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
It is an implementation detail of the Android player view. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a player view tap event
Adds
PlayerEventType.VIEW_TAP, dispatched when the user taps or clicks the player view itself. UIs can use it to let taps through to elements the player draws on top of the video, such as THEOads image overlays with a clickthrough, while still showing and hiding their controls.How each platform detects taps
ReactTHEOplayerViewdetects taps itself (PlayerViewTapDetector). Its children, such as the overlay, handle the touch first. A tap is a down and up within the system touch slop; a second pointer or a cancel aborts it.THEOplayerRCTViewTapHandler) that doesn't cancel touches and recognizes simultaneously, so the overlay's own recognizer still opens the clickthrough. Not added on tvOS.pointerupwith the primary button on the player container.Notes for review
Event<PlayerEventType.VIEW_TAP>type without its own class, likePLAYandPAUSE, because it carries no data.@theoplayer/react-native-uiuses this event (Let taps through to the player react-native-theoplayer-ui#126), so this needs to be released first.Testing
Unit, after merging
develop: Node tests insrc/__tests__54 of 55 pass, including the new tests for the event, the dispatch on native and web, and the poster. The one failure,PlayerFacadeWebAdapter.test.ts"wrapper destruction still closes facade when no-event", fails the same way ondevelopwithout this change. Android JUnit tests for the tap detector plus the existing player facade tests: 39 pass. Typecheck and lint are clean.Manual, with a THEOads stream with image overlays and the updated
@theoplayer/react-native-ui:Known risk: iOS fullscreen wasn't tested on a device. The tap recognizer moves with the player view into fullscreen, the same as on Android, which passed.
During an L-shape (ad) break, the SDK hides the content player and the overlay inside it, so there's no overlay to click. That's existing SDK layout behaviour, unchanged here.