mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
video.js: ensure example class-based plugin works (#43558)
* ensure example class-based plugin works * additional test to be sure Plugin has player property
This commit is contained in:
parent
93d70f87d5
commit
8b4734fb5a
2
types/video.js/index.d.ts
vendored
2
types/video.js/index.d.ts
vendored
@ -3954,7 +3954,7 @@ declare namespace videojs {
|
||||
* @param player
|
||||
* A Video.js player instance.
|
||||
*/
|
||||
new(player: Player): Plugin;
|
||||
new (player: Player, options?: any): Plugin;
|
||||
|
||||
/**
|
||||
* De-register a Video.js plugin.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import videojs from 'video.js';
|
||||
import videojs, { VideoJsPlayer } from 'video.js';
|
||||
|
||||
videojs("example_video_1").ready(function() {
|
||||
// EXAMPLE: Start playing the video.
|
||||
@ -131,6 +131,32 @@ function testPlugin(player: videojs.Player, options: {}) {
|
||||
});
|
||||
});
|
||||
(player as any).uloztoExample(options);
|
||||
|
||||
const Plugin = videojs.getPlugin('plugin');
|
||||
|
||||
interface ExamplePluginOptions {
|
||||
customClass: string;
|
||||
}
|
||||
|
||||
class ExamplePlugin extends Plugin {
|
||||
constructor(player: VideoJsPlayer, options: ExamplePluginOptions) {
|
||||
super(player, options);
|
||||
|
||||
if (options.customClass) {
|
||||
player.addClass(options.customClass);
|
||||
}
|
||||
|
||||
player.on('playing', () => {
|
||||
videojs.log('playback began!');
|
||||
});
|
||||
|
||||
this.player.on('pause', () => {
|
||||
videojs.log('playback ended');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
videojs.registerPlugin('ExamplePlugin', ExamplePlugin);
|
||||
}
|
||||
|
||||
function testLogger() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user