The TimedMediaHandler extension would benefit from a JavaScript hook that would allow outside gadgets/scripts/extensions/etc. to access the VideoJS player object - so that they can listen for events, access its properties, and even modify it as needed.
Description
Details
| Subject | Author | Repo | Branch | Lines +/- | |
|---|---|---|---|---|---|
| Add JS hook to allow outside access to VideoJS object | Yaron Koren | mediawiki/extensions/TimedMediaHandler | master | +1 -0 |
Related Objects
- Mentioned Here
- T300341: Add mw.hooks for videoJS initialisation
Event Timeline
Change #1176346 had a related patch set uploaded (by Yaron Koren; author: Yaron Koren):
[mediawiki/extensions/TimedMediaHandler@master] Add JS hook to allow outside access to VideoJS object
@TheDJ - wow, it's almost an exact duplicate! Although your patch contains two hooks instead of one. I don't know why that patch stalled - just some vacillation over hook naming? - but I'd be happy if that 2022 patch was checked in, regardless of the hook names. (For the record, I think it makes sense for the hook name(s) to contain both "tmh" and "videoJS".)
There was no direct usecase for it at the time making it low prio. We were still discussing naming and scope and I had other stuff to do for a while.
Oh, okay. Well, there's definitely a specific use case for it now - a project to try to gauge time spent watching videos and audio, ideally on Wikimedia Commons. I hope either one of these patches gets merged in!
@Yaron_Koren The patch will need some cleanup (see the comments by Tim in the review), maybe I have some time later this week.
btw, I think you can already set videojs.options and those options will be fed to the player, assuming that you define them before the videojs module loads. You might want to see if that is something that you can use. I haven't tested this approach in quite a while, so I'm not certain if it works.
I hope you look into it! I assume you're referring to the "configure" hook, rather than the "loaded" hook, in the original patch (https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TimedMediaHandler/+/757764). The patch I created only adds the equivalent of the "loaded" hook, so I have no need for a "configure" hook. (Though it seems harmless.)
Change #1176346 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@master] Add JS hook to allow outside access to VideoJS object