Ali Kazemkhanloo
Ali Kazemkhanloo

Reputation: 1159

How to handle touchpad force click in macos/chrome?

Update:

Youtube is using a timeout to fast forward (as mentioned in the answers), It is not using force click.


In youtube when you force click on a video while playing in a chrome browser, the video would be played at 2x.

Packages like Pressure.js cannot detect force click in chrome browser. How does youtube handle it?

Upvotes: 3

Views: 183

Answers (1)

Monke
Monke

Reputation: 176

YouTube could just be using a timer on the mousedown event. The timer just sees for how long you've held down on your mouse to validate if you're force clicking/holding.

document.body.addEventListener('mousedown',function() { 
  setTimeout(function(){
    console.log("Holding!");
  }, 500);
});

Upvotes: 4

Related Questions