video.js icon indicating copy to clipboard operation
video.js copied to clipboard

userAction.click doesn't work with audio players

Open DJ-PD opened this issue 4 years ago • 7 comments

Using VideoJS as an audio player with use of an mp3 live stream source via the

DJ-PD avatar Dec 22 '21 17:12 DJ-PD

That should work, have you a live example where it is not?

mister-ben avatar Dec 23 '21 13:12 mister-ben

Hmm, interesting, I tried again both on local as well on the public server and everything works without the userAction false function. I don't want to share the link public here but if you mail me at [email protected] I will share it with you. We will go live over the Christmas 24 and 25th.

DJ-PD avatar Dec 23 '21 15:12 DJ-PD

Made a new audio test and regardless if I use videoJS version 7.16, 7.17 or 7.18 via a mp3 live stream or just a mp3 file with or without the option userActions: { click: false } it seems like the poster option poster: [ 'img/pd-stream1920x1080.jpg' ] takes over, see below print screen... image

DJ-PD avatar Dec 23 '21 21:12 DJ-PD

Are you using an <audio> element? userActions.click affects clicks on the playback el, but you're clicking on the posterImage component instead.

You can either use a <video> instead (which can play audio), or remove the click handler from the poster with player.posterImage.off('click')

mister-ben avatar Dec 24 '21 07:12 mister-ben

Yes, I use the <audio> element. Made a new test via the <video> element as you mentioned and that works good in combination of the option userActions: { click: false } even with a poster. Downside is that I lose the all time activated control bar which I (users) see as a benefit when just playing audio. Can I trigg the control bar to be activated all the time even with use of the <video> element? I can also see that the control bar icons toggle the pause/play function with use of a mobile device (Android tested right now) which is extremely enjoying i.e tap on the "full screen" or "chromecast" icon pause the audio where the user do need to tap again on the same icon to activate the icon function and thereafter press play again to start the playback. See below print screen. image

DJ-PD avatar Dec 25 '21 18:12 DJ-PD

You'll need this combination for now:

  • <audio>, or <video-js> with a vjs-audio class. This will keep the controls in view
  • .vjs-audio.vjs-has-started .vjs-poster { pointer-events: none; } to inhibit clicks on the poster during playback

We'll need to think about whether userActions.click should be applied to the poster as well as the tech for audio players.

mister-ben avatar Jan 11 '22 13:01 mister-ben

Thanks for opening this and for building with Video.js. For the last year we’ve been hard at work re-building the player from the ground up for the modern web. It’s now available as v10 and we’d love for you to join us by upgrading.

Video.js v8 will now live at videojs/videojs-v8 and continue to be maintained as best as we can with security fixes until October 1, 2028 (see its security policy).

This issue hasn’t had activity since January 2022, so we're closing it rather than moving it to videojs/videojs-v8. If it still applies to Video.js 10, open a new issue or discussion and link back here so we keep the context.

Moving to Video.js 10? Use a migration guide: HTML · React.

Migrating with a coding agent? Paste the prompt from the guide's AI Quickstart section into your agent: HTML · React.

If this is a security vulnerability, don't add details here. Report it privately through private vulnerability reporting.

heff avatar Nov 06 '26 23:11 heff