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

Fix/ VR360 player's behavior different to standar player on mobile devices #190

Merged
merged 2 commits into from
Nov 15, 2019

Conversation

marcodeltorob
Copy link
Contributor

Fix different behavior between standard and vr360 player in iOS/Android devices

}

onMove(e) {
// its hard to tap without a touchmove, if there have been less
// than one, we should still toggle play
if (e.type === 'touchmove' && this.touchMoveCount_ < 1) {
Copy link
Member

Choose a reason for hiding this comment

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

why not just increase the limit here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want to check when the movement has finished in the touchend event if it was a "touch for a click" or it was to move the camera in the canvas.

Copy link
Member

Choose a reason for hiding this comment

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

It sounds like this is more or less what the shouldTogglePlay was supposed to do. Set a flag if there was enough touchmoves to exclude it this touch interaction from being a tap. I'd be interested to know if that will work as it'll be a much smaller change and won't require toggling user activity manually.

Copy link
Contributor Author

@marcodeltorob marcodeltorob Nov 8, 2019

Choose a reason for hiding this comment

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

The problem here is we need the change since we want to have the play/pause logic for desktop/mouse and the userActive logic for mobile devices/touch screen when the screen is touched. The current behavior that we have with my changes are:

360°/VR Player iOS/Android
Click/touch - Toggle userActive() - Show and hide control bar.

360°/VR Player Desktop
Click/mouse -- Toggle play/pause since you have the userActive() in mouseover

These ones are in the Standard player:

Standard Player iOS/Android
Click/touch - Toggle userActive() - Show and hide control bar.

** Standard Player Desktop**
Click/mouse -- Toggle play/pause since you have the userActive() in mouseover

// We want to have the same behavior in VR360 Player and standar player.
// in touchend we want to know if was a touch click, for a click we show the bar,
// otherwise continue with the mouse logic.
if (e.type === 'touchend' && this.touchMoveCount_ < 7) {
Copy link
Member

Choose a reason for hiding this comment

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

why 7?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commonly when you touch the screen on and android device looking for "touch for a click" not "move touch" you get between 1 - 6 touchmove

Copy link
Member

Choose a reason for hiding this comment

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

Looks like Video.js uses 10 as the threshold, might be better to just use that: https://github.com/videojs/video.js/blob/master/src/js/component.js#L1147-L1150.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

In addition to the previous test, I wonder if we can just rely on Video.js's tap events rather than re-implementing it here https://github.com/videojs/video.js/blob/master/src/js/component.js#L1142
This might require doing something like

Component.prototype.emitTapEvents.call(this)

in the constructor.

// We want to have the same behavior in VR360 Player and standar player.
// in touchend we want to know if was a touch click, for a click we show the bar,
// otherwise continue with the mouse logic.
if (e.type === 'touchend' && this.touchMoveCount_ < 7) {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like Video.js uses 10 as the threshold, might be better to just use that: https://github.com/videojs/video.js/blob/master/src/js/component.js#L1147-L1150.

@gkatsev gkatsev merged commit 4e92c33 into videojs:master Nov 15, 2019
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