I would like to fire an event on ctrl+click of the video and NOT have it toggle play/pause #7447
-
I am trying to work on a feature that will reset the playback rate on a ctrl+click. I have tried a couple of approaches but it seems that no matter what I do, I cannot seem to fire a click event and prevent the play/pause toggle from firing when the ctrl key is pressed. TestingFirst Attempt - adding an event handler in JShttps://codepen.io/codysechelski/pen/KKqGdGE?editors=1111 So I don't think it's possible to use this approach. Second Attempt - adding an inline
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You could disable the click handler on the tech with |
Beta Was this translation helpful? Give feedback.
-
Cool. Thanks, @mister-ben! That was super helpful. If possible, would you mind looking over my solution at https://codepen.io/codysechelski/pen/KKqGdGE and let me know if I am missing anything? I'm afraid that I might inadvertently be removing functionality that's not immediately apparent disabling the out-of-the-box click handler. |
Beta Was this translation helpful? Give feedback.
You could disable the click handler on the tech with
player.tech(true).off('click')
. You'd need to play/pause the video when ctrl is not pressed in your event handler to restore the functionality.As an aside you probably want to check
event.metaKey
too for the Maccmd
key. ctrl+click on Mac is a right click.