Skip to content
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

Parent View click events are consumed by PlayerView [2.10.2] #6109

Closed
greyski opened this issue Jun 28, 2019 · 4 comments
Closed

Parent View click events are consumed by PlayerView [2.10.2] #6109

greyski opened this issue Jun 28, 2019 · 4 comments
Assignees
Labels

Comments

@greyski
Copy link

greyski commented Jun 28, 2019

[REQUIRED] Searched documentation and issues

There was no mention of why click handling is being overridden by the PlayerView via onTouchEvent

[REQUIRED] Question

We recently upgraded from exoplayer 2.8 to 2.10.2 and noticed not all of our Views hosting an exoplayer were clickable. Looking at the source shows that in 2.10.2 PlayerView consumes all touch events upon it's surface:

  @Override
  public boolean onTouchEvent(MotionEvent event) {
    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN:
        isTouching = true;
        return true;
      case MotionEvent.ACTION_UP:
        if (isTouching) {
          isTouching = false;
          performClick();
          return true;
        }
        return false;
      default:
        return false;
    }
  }

Whereas in 2.8 it would still allow touch/click events to be propagated to it's parent container unless the controller was present:

  @Override
  public boolean onTouchEvent(MotionEvent ev) {
    if (!useController || player == null || ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
      return false;
    }
    if (!controller.isVisible()) {
      maybeShowController(true);
    } else if (controllerHideOnTouch) {
      controller.hide();
    }
    return true;
  }

Is this intended behavior? It seems like a bug since it prevents any parent view from performing a click event if the tapped surface is within a PlayerView's bounds.

A full bug report captured from the device

n/a

Link to test content

n/a

@google-oss-bot
Copy link
Collaborator

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@greyski greyski changed the title Parent view click events are consumed by exoplayer [2.10.2] Parent View click events are consumed by PlayerView [2.10.2] Jun 28, 2019
@marcbaechinger marcbaechinger self-assigned this Jun 30, 2019
@marcbaechinger
Copy link
Contributor

marcbaechinger commented Jun 30, 2019

I don't see a reason why these touch events should be consumed in case we no-op.

Marking as bug for now.

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Jun 30, 2019

Looking at the change which introduced this, makes me think that we changed to the standard Android behaviour. The touch event is delegated to performClick which triggers OnClickListeners of the given view.

Can you check whether we also consume the click to which performClick() delegate the touch event?

@tonihei tonihei assigned tonihei and unassigned marcbaechinger Jul 1, 2019
@tonihei tonihei added bug and removed question labels Jul 1, 2019
@tonihei
Copy link
Collaborator

tonihei commented Jul 1, 2019

We shouldn't consume the event if no controller is present. That part of the change was unintentional. Marking as bug again to fix that.

ojw28 pushed a commit that referenced this issue Jul 2, 2019
@ojw28 ojw28 closed this as completed Jul 2, 2019
ojw28 pushed a commit that referenced this issue Jul 9, 2019
@google google locked and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants