muxinc / media-chrome

Custom elements (web components) for making audio and video player controls that look great in your website or app.
https://media-chrome.org
MIT License
1.83k stars 76 forks source link

handle video tag click event #1016

Closed EssLi closed 1 month ago

EssLi commented 1 month ago

i wanna capture the event of hls-video tag and prevent default of click operation, for example video.addEventListener('click', (event) => { event.preventDefault(); })

my target is that avoid pause when click the video area but have no effect on media-control-bar. and i hope that double-click to full-screen or exit full-screen too. but it seems to be hard to trigger this event and capture it. can you give me advice? thanks.

btw, the media-controller click event is ok.

luwes commented 1 month ago

could you try setting this CSS var --media-gesture-receiver-display to none. I think that should do what you're looking for.

this element handles the click events on the video surface: https://github.com/muxinc/media-chrome/blob/main/src/js/media-gesture-receiver.ts

EssLi commented 1 month ago

You are right, it perfectly solved my problem. Thank you again!