Skip to content

Add a player view tap event - #1020

Open
jorisfluyt wants to merge 8 commits into
developfrom
feature/OPTI-4010-player-view-tap-event
Open

jorisfluyt wants to merge 8 commits into
developfrom
feature/OPTI-4010-player-view-tap-event

Conversation

@jorisfluyt

@jorisfluyt jorisfluyt commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Android: React Native delivers no JS touch events for touches on the native player view, so ReactTHEOplayerView detects 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.
  • iOS: a tap recognizer on the player view (THEOplayerRCTViewTapHandler) that doesn't cancel touches and recognizes simultaneously, so the overlay's own recognizer still opens the clickthrough. Not added on tvOS.
  • Web: pointerup with the primary button on the player container.
  • Poster: it now lets taps through to the player view.

Notes for review

Testing

  • Unit, after merging develop: Node tests in src/__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 on develop without 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:

    Platform Overlay opens its clickthrough Video tap toggles the UI Fullscreen Double-box break L-shape (content) break
    Web (Chrome, Safari) Yes Yes Yes (Safari) Yes Yes
    Android (emulator, moto g75) Yes Yes Yes Yes Yes
    iOS (iPhone XR) Yes Yes Not tested Not tested Not tested
  • 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.

jorisfluyt and others added 7 commits November 18, 2026 13:54
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

No deployments
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.

1 participant