I have a local-type Moodle plugin that loads on course pages and "page" modules that have Youtube links in their content. Moodle is configured (by default) to transform those links into embedded Video.js players. That's all working.
I'd like for my plugin code to be able to check the current time of the player and pause playback. The Video.js API enables this, but I'm having trouble setting up the JavaScript correctly.
define(["media_videojs/loader"], function(loader) { // triggered with $PAGE->requires->js_call_amd in my plugin's lib.php file function init() { loader.setUp(function(videojs) { var idOfPlayerEmbeddedFromYouTubeLink = 'IDONTKNOW'; // help? var myPlayer = videojs(idOfPlayerEmbeddedFromYouTubeLink); console.log("current time:", myPlayer.currentTime()); // https://docs.videojs.com/tutorial-player-workflows.html#using-playback-information-functions }); } return { init: init }; });
How do I reference a video that has already been loaded into Video.js by Moodle? Thanks in advance.