Skip to content

Crash when screen sharing is enabled and any touch occurs (IndexOutOfBoundsException) #875

@palmtown

Description

@palmtown

Description:
When enabling screen sharing, the session starts successfully. However, as soon as the user taps anywhere on the screen (button press or general touch), the app crashes with an IndexOutOfBoundsException.

This seems related to [issue #710](#710), but in my case the crash is reproducible on any touch interaction while screen sharing is active.

Steps to Reproduce:

  1. Start an OpenTok session in a React Native app.
  2. Enable screen sharing (videoSource: 'screen').
  3. Tap on any button or touch anywhere on the screen.
  4. App crashes immediately.

Expected Behavior:
The app should continue running while interacting with the UI during screen sharing.

Actual Behavior:
The app crashes with an IndexOutOfBoundsException.

Error Log:
From logcat:

java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 0
    at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
    at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
    at java.util.ArrayList.get(ArrayList.java:434)
    at android.view.ViewGroup.getAndVerifyPreorderedView(ViewGroup.java:4019)
    ...
    at com.opentokreactnative.OTScreenCapturer$1.run(OTScreenCapturer.java:52)
    at android.os.Handler.handleCallback(Handler.java:995)
    at android.os.Handler.dispatchMessage(Handler.java:103)
    at android.os.Looper.loop(Looper.java:363)

Full log excerpt attached from reproduction .

Environment:

  • opentok-react-native version: 2.30.2
  • React Native version: 0.79.4
  • Android version: Android 16
  • Device: Samsung S25

Notes:

  • The crash only happens when screen sharing is enabled.
  • Without screen sharing, UI interactions work fine.
  • This may be related to how OTScreenCapturer interacts with the view hierarchy during touches.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions