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

[PLAYER-19] keybinding (post refacto dialog) #82

Merged
merged 18 commits into from
Jul 25, 2024

Conversation

jparez
Copy link
Contributor

@jparez jparez commented Jun 14, 2024

Description

Adding keymapping feature. Somes refacto over the store, handle events, ... was recommended or necessery.
I have left some comments to helping to review.

Gesture handle

  • d-pad
  • swipe
  • tap
  • mouse

Config

You can find some json config example at the top of keymapping plugin file. Cooordonate are always in percent

Api added

  • setConfig to change the config, supply a valid json config.
  • activeKeyMappingDebug with 2 boolean in parameter
    • if first parameter is true, click on <video> will display a square with x / y coordonate
    • the second display a grid over <video> slice by 10%

v1

  • the d-pad isn't well handle on every games (fps could be nonfunctionnal)
  • mouse event not handle

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I've read & comply with the contributing guidelines
  • I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • I have made corresponding changes to the documentation (README.md).
  • I've checked my modifications for any breaking changes.

@jparez jparez marked this pull request as draft June 14, 2024 12:12
@jparez jparez force-pushed the dev/PLAYER-19-keybinding-post-refacto-dialog branch from 7c18672 to 6a5b918 Compare June 14, 2024 12:41
@jparez jparez marked this pull request as ready for review June 25, 2024 16:17
@jparez jparez force-pushed the dev/PLAYER-19-keybinding-post-refacto-dialog branch from 61e4dd6 to 1cb706b Compare June 25, 2024 16:27
@jparez jparez force-pushed the dev/PLAYER-19-keybinding-post-refacto-dialog branch from 7c82442 to ca11d54 Compare June 26, 2024 08:13
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a category for API manager exposed fn => window.player.media.mute()

@@ -88,17 +87,6 @@ module.exports = class DeviceRenderer {
// last accessed x/y position
this.x = 0;
this.y = 0;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Click handler handle has been move to overlayplugin class (decoupling)

@@ -486,10 +475,6 @@ module.exports = class DeviceRenderer {
this.mouseEvents.addMouseCallbacks();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

decoupling see above

@@ -127,7 +127,7 @@ module.exports = class FingerPrint extends OverlayPlugin {

// register callback
this.instance.registerEventCallback('fingerprint', (message) => this.handleFingerprintEvent(message));
if (this.instance.store.getState().isWebRTCConnectionReady) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

getState was unecessary for a little store,

@@ -20,6 +20,18 @@ module.exports = class Fullscreen {
this.instance.addListener(document, 'fullscreenchange', this.onFullscreenEvent.bind(this), false);
}

this.instance.apiManager.registerFunction({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Requested from socis

this.isListenerAdded = false;
this.currentlyPressedKeys = new Map();

this.instance.store.subscribe(({isKeyboardEventsEnabled}) => {
this.transmitKeys = isKeyboardEventsEnabled;
if (isKeyboardEventsEnabled) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

little refact to decoupling keyboard handle events of deviceRenderer js

this.instance.video.isMuted = true;
this.instance.video.muted = true;
this.instance.apiManager.registerFunction({
name: 'mute',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added category

@@ -20,6 +20,7 @@ module.exports = class MouseEvents {

this.leftButtonPressed = false;
this.boundEventListener = this.releaseAtPreviousPositionEvent.bind(this);
this.removeMouseUpListener = () => {};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removeMouseUplistener will never be undefined

@@ -26,6 +26,13 @@ module.exports = class OverlayPlugin {
this.closeOverlay();
}
});

// Attach listener for first object created only
if (!OverlayPlugin.hasBeenCalled) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a kind of static method for a Class, this way we attach the listener only once

@jparez jparez requested review from pgivel and JulienBolard June 26, 2024 09:10
@jparez jparez force-pushed the dev/PLAYER-19-keybinding-post-refacto-dialog branch from 4f8f8a9 to 97c8341 Compare June 28, 2024 14:50
@jparez jparez force-pushed the dev/PLAYER-19-keybinding-post-refacto-dialog branch from cfb37ab to 3e80de7 Compare July 4, 2024 12:00
Copy link
Contributor

@pgivel pgivel left a comment

Choose a reason for hiding this comment

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

This is looking great. Most of my comments are about documentation, since this feature is a bit complicated to understand, I think it benefits from being as documented as possible.

I didn't much review the debug stuff (grid and trace), since I trust you that it works well enough.

src/APIManager.js Show resolved Hide resolved
src/scss/components/_toolbar.scss Show resolved Hide resolved
src/store/index.js Outdated Show resolved Hide resolved
src/plugins/KeyboardMapping.js Outdated Show resolved Hide resolved
src/plugins/KeyboardMapping.js Outdated Show resolved Hide resolved
src/plugins/KeyboardMapping.js Outdated Show resolved Hide resolved
src/plugins/KeyboardMapping.js Show resolved Hide resolved
src/plugins/KeyboardMapping.js Outdated Show resolved Hide resolved
src/plugins/KeyboardMapping.js Show resolved Hide resolved
src/plugins/KeyboardMapping.js Outdated Show resolved Hide resolved
@jparez jparez force-pushed the dev/PLAYER-19-keybinding-post-refacto-dialog branch from 1a73030 to f9f7af6 Compare July 10, 2024 14:43
@jparez jparez force-pushed the dev/PLAYER-19-keybinding-post-refacto-dialog branch from a0e1503 to 9cc3cb4 Compare July 17, 2024 07:20
@jparez jparez merged commit 28e8b50 into main Jul 25, 2024
1 check passed
@jparez jparez deleted the dev/PLAYER-19-keybinding-post-refacto-dialog branch July 25, 2024 12:28
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