reactjshtml5-videovideo.js

Is it possible to remove keycode import in videojs8?


For security request, my project has been scanned by Sonatype Nexus Lifecycle. Which comes out with two issues by keycode:

enter image description here So, may I ask is it possible to remove keycode in videojs8? If yes, may I ask how can I remove then?


Solution

  • Yes, it's possible to remove the KeyCode. Try this:

    const player = videojs('my-video');
    
    player.on('keydown', (event) => {
      if (event.which === 32) { // 32 for Space key
        // Handle space key press
      } else if (event.which === 13) { // 13 for Enter key
        // Handle enter key press
      }
    });
    

    In here, keydown event provided by Video.js to listen for key presses.

    You can also check this: How to listen on keydown event in video tag?