mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Support dist/alt/video.core.js import (#43981)
* Support dist/alt/video.core.js import * Run prettier on video.js package
This commit is contained in:
parent
1e0f80d01a
commit
8fdb26dec1
@ -1 +1,2 @@
|
||||
dist/alt/video.core.novtt.d.ts
|
||||
dist/alt/video.core.novtt.d.ts
|
||||
dist/alt/video.core.d.ts
|
||||
|
||||
6
types/video.js/dist/alt/video.core.d.ts
vendored
Normal file
6
types/video.js/dist/alt/video.core.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* This provides `video.core.js` alternative distribution typings :
|
||||
* `import videojs from 'video.js/dist/alt/video.core';`
|
||||
*/
|
||||
import videojs from '../../index';
|
||||
export default videojs;
|
||||
@ -2,5 +2,5 @@
|
||||
* This provides `video.core.novtt.js` alternative distribution typings :
|
||||
* `import videojs from 'video.js/dist/alt/video.core.novtt';`
|
||||
*/
|
||||
import videojs from "../../index";
|
||||
import videojs from '../../index';
|
||||
export default videojs;
|
||||
|
||||
155
types/video.js/index.d.ts
vendored
155
types/video.js/index.d.ts
vendored
@ -68,7 +68,7 @@ declare namespace videojs {
|
||||
*
|
||||
* @return The new function that will be bound into the context given
|
||||
*/
|
||||
function bind<F extends (() => any)>(context: any, fn: F, uid?: number): F;
|
||||
function bind<F extends () => any>(context: any, fn: F, uid?: number): F;
|
||||
|
||||
/**
|
||||
* Should create a fake `TimeRange` object which mimics an HTML5 time range instance.
|
||||
@ -232,7 +232,7 @@ declare namespace videojs {
|
||||
* An Object that contains lifecycle hooks as keys which point to an array
|
||||
* of functions that are run when a lifecycle is triggered
|
||||
*/
|
||||
const hooks_: { [type: string]: (() => any) };
|
||||
const hooks_: { [type: string]: () => any };
|
||||
|
||||
/**
|
||||
* Log messages
|
||||
@ -250,7 +250,14 @@ declare namespace videojs {
|
||||
*
|
||||
* @return A new object that is the merged result of all sources.
|
||||
*/
|
||||
function mergeOptions<A, B, C, D, E, F>(option: A, option2?: B, option3?: C, option4?: D, option5?: E, option6?: F): A & B & C & D & E & F;
|
||||
function mergeOptions<A, B, C, D, E, F>(
|
||||
option: A,
|
||||
option2?: B,
|
||||
option3?: C,
|
||||
option4?: D,
|
||||
option5?: E,
|
||||
option6?: F,
|
||||
): A & B & C & D & E & F;
|
||||
|
||||
/**
|
||||
* Resolve and parse the elements of a URL.
|
||||
@ -404,7 +411,7 @@ declare namespace videojs {
|
||||
*
|
||||
* @return The function that was removed or undef
|
||||
*/
|
||||
function removeHook(type: string, fn: (() => any)): boolean;
|
||||
function removeHook(type: string, fn: () => any): boolean;
|
||||
|
||||
/**
|
||||
* Trigger an event for an element
|
||||
@ -495,7 +502,7 @@ declare namespace videojs {
|
||||
* If this track is the one that is currently playing. If this track is part of
|
||||
* an {@link AudioTrackList}, only one {@link AudioTrack} will be enabled.
|
||||
*/
|
||||
new(options?: AudioTrackOptions): Track;
|
||||
new (options?: AudioTrackOptions): Track;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -575,7 +582,7 @@ declare namespace videojs {
|
||||
* @param [options={}]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: TrackButtonOptions): AudioTrackButton;
|
||||
new (player: Player, options?: TrackButtonOptions): AudioTrackButton;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -605,7 +612,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: AudioTrackMenuItemOptions): AudioTrackMenuItem;
|
||||
new (player: Player, options?: AudioTrackMenuItemOptions): AudioTrackMenuItem;
|
||||
};
|
||||
|
||||
interface VideojsAudioTrack {
|
||||
@ -680,7 +687,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions): BigPlayButton;
|
||||
new (player: Player, options?: ComponentOptions): BigPlayButton;
|
||||
};
|
||||
|
||||
interface Browser {
|
||||
@ -781,7 +788,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions): Button;
|
||||
new (player: Player, options?: ComponentOptions): Button;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -825,7 +832,7 @@ declare namespace videojs {
|
||||
* @param [ready]
|
||||
* The function to call when this function is ready.
|
||||
*/
|
||||
new(player: Player, options?: TrackButtonOptions, ready?: Component.ReadyCallback): CaptionsButton;
|
||||
new (player: Player, options?: TrackButtonOptions, ready?: Component.ReadyCallback): CaptionsButton;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -858,7 +865,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: CaptionSettingsMenuItemOptions): CaptionSettingsMenuItem;
|
||||
new (player: Player, options?: CaptionSettingsMenuItemOptions): CaptionSettingsMenuItem;
|
||||
};
|
||||
|
||||
interface CaptionSettingsMenuItemOptions extends TextTrackMenuItemOptions {
|
||||
@ -951,7 +958,7 @@ declare namespace videojs {
|
||||
* @param [ready]
|
||||
* The function to call when this function is ready.
|
||||
*/
|
||||
new(player: Player, options?: TrackButtonOptions, ready?: Component.ReadyCallback): ChaptersButton;
|
||||
new (player: Player, options?: TrackButtonOptions, ready?: Component.ReadyCallback): ChaptersButton;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -998,7 +1005,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ChaptersTrackMenuItemOptions): ChaptersTrackMenuItem;
|
||||
new (player: Player, options?: ChaptersTrackMenuItemOptions): ChaptersTrackMenuItem;
|
||||
};
|
||||
|
||||
interface ChaptersTrackMenuItemOptions extends MenuItemOptions {
|
||||
@ -1006,10 +1013,12 @@ declare namespace videojs {
|
||||
cue: TextTrackCueList.TextTrackCue;
|
||||
}
|
||||
|
||||
type Child = string | {
|
||||
name: string,
|
||||
children?: Child[]
|
||||
};
|
||||
type Child =
|
||||
| string
|
||||
| {
|
||||
name: string;
|
||||
children?: Child[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Clickable Component which is clickable or keyboard actionable,
|
||||
@ -1149,7 +1158,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions): ClickableComponent;
|
||||
new (player: Player, options?: ComponentOptions): ClickableComponent;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1194,7 +1203,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: CloseButtonOptions): CloseButton;
|
||||
new (player: Player, options?: CloseButtonOptions): CloseButton;
|
||||
};
|
||||
|
||||
interface CloseButtonOptions extends ComponentOptions {
|
||||
@ -1868,7 +1877,7 @@ declare namespace videojs {
|
||||
* @param [ready]
|
||||
* Function that gets called when the `Component` is ready.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions, ready?: Component.ReadyCallback): Component;
|
||||
new (player: Player, options?: ComponentOptions, ready?: Component.ReadyCallback): Component;
|
||||
|
||||
/**
|
||||
* Get a `Component` based on the name it was registered with.
|
||||
@ -1942,7 +1951,7 @@ declare namespace videojs {
|
||||
}
|
||||
}
|
||||
|
||||
type Content = string | Element | Node | (() => (string | Element | Node));
|
||||
type Content = string | Element | Node | (() => string | Element | Node);
|
||||
|
||||
/**
|
||||
* Container of main controls.
|
||||
@ -1970,7 +1979,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ControlBarOptions): ControlBar;
|
||||
new (player: Player, options?: ControlBarOptions): ControlBar;
|
||||
};
|
||||
|
||||
interface ControlBarOptions extends ComponentOptions {
|
||||
@ -2024,7 +2033,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options: ComponentOptions): CurrentTimeDisplay;
|
||||
new (player: Player, options: ComponentOptions): CurrentTimeDisplay;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2061,7 +2070,7 @@ declare namespace videojs {
|
||||
* @param [ready]
|
||||
* Function that gets called when the `Component` is ready.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions, ready?: Component.ReadyCallback): CustomControlSpacer;
|
||||
new (player: Player, options?: ComponentOptions, ready?: Component.ReadyCallback): CustomControlSpacer;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2108,7 +2117,7 @@ declare namespace videojs {
|
||||
* @param [ready]
|
||||
* The function to call when this component is ready.
|
||||
*/
|
||||
new(player: Player, options?: TrackButtonOptions, ready?: Component.ReadyCallback): DescriptionsButton;
|
||||
new (player: Player, options?: TrackButtonOptions, ready?: Component.ReadyCallback): DescriptionsButton;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2148,7 +2157,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options: ComponentOptions): DurationDisplay;
|
||||
new (player: Player, options: ComponentOptions): DurationDisplay;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2185,7 +2194,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ModalDialogOptions): ErrorDisplay;
|
||||
new (player: Player, options?: ModalDialogOptions): ErrorDisplay;
|
||||
};
|
||||
|
||||
interface Dom {
|
||||
@ -2818,7 +2827,7 @@ declare namespace videojs {
|
||||
const EventTarget: {
|
||||
prototype: EventTarget;
|
||||
|
||||
new(): EventTarget;
|
||||
new (): EventTarget;
|
||||
};
|
||||
|
||||
namespace EventTarget {
|
||||
@ -2839,7 +2848,7 @@ declare namespace videojs {
|
||||
* @param [hash]
|
||||
* hash of data sent during the event
|
||||
*/
|
||||
type EventListener = ((e: Event, data?: any) => void);
|
||||
type EventListener = (e: Event, data?: any) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2879,7 +2888,7 @@ declare namespace videojs {
|
||||
}
|
||||
|
||||
const FullscreenToggle: {
|
||||
prototype: FullscreenToggle
|
||||
prototype: FullscreenToggle;
|
||||
|
||||
/**
|
||||
* Creates an instance of this class.
|
||||
@ -2890,7 +2899,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions): FullscreenToggle;
|
||||
new (player: Player, options?: ComponentOptions): FullscreenToggle;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2914,7 +2923,7 @@ declare namespace videojs {
|
||||
* @param [tracks=[]]
|
||||
* A list of `HtmlTrackElement` to instantiate the list with.
|
||||
*/
|
||||
new(tracks?: HTMLTrackElement[]): HTMLTrackElementList;
|
||||
new (tracks?: HTMLTrackElement[]): HTMLTrackElementList;
|
||||
};
|
||||
|
||||
interface LanguageTranslations {
|
||||
@ -3105,13 +3114,13 @@ declare namespace videojs {
|
||||
*
|
||||
*/
|
||||
levels: {
|
||||
all: string,
|
||||
off: string,
|
||||
debug: string,
|
||||
info: string,
|
||||
warn: string,
|
||||
error: string,
|
||||
DEFAULT: string
|
||||
all: string;
|
||||
off: string;
|
||||
debug: string;
|
||||
info: string;
|
||||
warn: string;
|
||||
error: string;
|
||||
DEFAULT: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -3206,7 +3215,7 @@ declare namespace videojs {
|
||||
* - `MediaError` (video.js): will return itself if it's already a
|
||||
* video.js `MediaError` object.
|
||||
*/
|
||||
new(value: number | string | { [key: string]: any } | MediaError): MediaError;
|
||||
new (value: number | string | { [key: string]: any } | MediaError): MediaError;
|
||||
|
||||
/**
|
||||
* The default `MediaError` messages based on the {@link MediaError.errorTypes}.
|
||||
@ -3332,7 +3341,7 @@ declare namespace videojs {
|
||||
* Object of option names and values
|
||||
*
|
||||
*/
|
||||
new(player: Player, options?: MenuOptions): Menu;
|
||||
new (player: Player, options?: MenuOptions): Menu;
|
||||
};
|
||||
|
||||
interface MenuOptions extends ComponentOptions {
|
||||
@ -3503,7 +3512,7 @@ declare namespace videojs {
|
||||
* @param [options={}]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: MenuButtonOptions): MenuButton;
|
||||
new (player: Player, options?: MenuButtonOptions): MenuButton;
|
||||
};
|
||||
|
||||
interface MenuButtonOptions extends ComponentOptions {
|
||||
@ -3568,7 +3577,7 @@ declare namespace videojs {
|
||||
* The key/value store of player options.
|
||||
*
|
||||
*/
|
||||
new(player: Player, options?: MenuItemOptions): MenuItem;
|
||||
new (player: Player, options?: MenuItemOptions): MenuItem;
|
||||
};
|
||||
|
||||
interface MenuItemOptions extends ComponentOptions {
|
||||
@ -3740,7 +3749,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ModalDialogOptions): ModalDialog;
|
||||
new (player: Player, options?: ModalDialogOptions): ModalDialog;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -3818,7 +3827,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions): MouseTimeDisplay
|
||||
new (player: Player, options?: ComponentOptions): MouseTimeDisplay;
|
||||
};
|
||||
|
||||
enum ReadyState {
|
||||
@ -3826,14 +3835,14 @@ declare namespace videojs {
|
||||
HaveMetadata = 1,
|
||||
HaveCurrentData = 2,
|
||||
HaveFutureData = 3,
|
||||
HaveEnoughData = 4
|
||||
HaveEnoughData = 4,
|
||||
}
|
||||
|
||||
enum NetworkState {
|
||||
Empty = 0,
|
||||
Idle = 1,
|
||||
Loading = 2,
|
||||
NoSource = 3
|
||||
NoSource = 3,
|
||||
}
|
||||
|
||||
type Player = VideoJsPlayer;
|
||||
@ -3849,7 +3858,7 @@ declare namespace videojs {
|
||||
* 1. By calling `videojs('example_video_1');`
|
||||
* 2. By using it directly via `videojs.players.example_video_1;`
|
||||
*/
|
||||
new(player: Player, options?: PlayerOptions): Player;
|
||||
new (player: Player, options?: PlayerOptions): Player;
|
||||
|
||||
/**
|
||||
* Gets tag settings
|
||||
@ -3872,12 +3881,12 @@ declare namespace videojs {
|
||||
/**
|
||||
* Unused, except if this object is passed to the MediaSession API.
|
||||
*/
|
||||
album?: string;
|
||||
album?: string;
|
||||
|
||||
/**
|
||||
* Unused, except if this object is passed to the MediaSession API.
|
||||
*/
|
||||
artist?: string;
|
||||
artist?: string;
|
||||
|
||||
/**
|
||||
* Unused, except if this object is passed to the MediaSession API. If not specified, will be populated via the poster, if available.
|
||||
@ -4046,7 +4055,7 @@ declare namespace videojs {
|
||||
*
|
||||
* @check returning type
|
||||
*/
|
||||
getPlugins(names?: string[]): { [name: string]: Plugin }
|
||||
getPlugins(names?: string[]): { [name: string]: Plugin };
|
||||
|
||||
/**
|
||||
* Determines if a plugin is a basic plugin (i.e. not a sub-class of `Plugin`).
|
||||
@ -4057,7 +4066,7 @@ declare namespace videojs {
|
||||
*
|
||||
* @return Whether or not a plugin is a basic plugin.
|
||||
*/
|
||||
isBasic(plugin: string | (() => any)): boolean
|
||||
isBasic(plugin: string | (() => any)): boolean;
|
||||
/**
|
||||
* Register a Video.js plugin.
|
||||
*
|
||||
@ -4177,7 +4186,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions): ProgressControl;
|
||||
new (player: Player, options?: ComponentOptions): ProgressControl;
|
||||
};
|
||||
|
||||
interface Representation {
|
||||
@ -4314,7 +4323,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: SliderOptions): SeekBar;
|
||||
new (player: Player, options?: SliderOptions): SeekBar;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -4473,7 +4482,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: SliderOptions): Slider;
|
||||
new (player: Player, options?: SliderOptions): Slider;
|
||||
};
|
||||
|
||||
interface SliderOptions extends ComponentOptions {
|
||||
@ -4523,7 +4532,7 @@ declare namespace videojs {
|
||||
* @param [ready]
|
||||
* Function that gets called when the `Component` is ready.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions, ready?: Component.ReadyCallback): Spacer;
|
||||
new (player: Player, options?: ComponentOptions, ready?: Component.ReadyCallback): Spacer;
|
||||
};
|
||||
|
||||
interface Tech extends Component {
|
||||
@ -4943,7 +4952,7 @@ declare namespace videojs {
|
||||
* @param ready
|
||||
* Callback function to call when the `HTML5` Tech is ready.
|
||||
*/
|
||||
new(options?: any, ready?: Component.ReadyCallback): Tech;
|
||||
new (options?: any, ready?: Component.ReadyCallback): Tech;
|
||||
|
||||
/**
|
||||
* Check if the tech can support the given source
|
||||
@ -4988,7 +4997,7 @@ declare namespace videojs {
|
||||
* - True if it is a tech
|
||||
* - False if it is not
|
||||
*/
|
||||
isTech(component: any): boolean
|
||||
isTech(component: any): boolean;
|
||||
|
||||
/**
|
||||
* Registers a `Tech` into a shared list for videojs.
|
||||
@ -5065,7 +5074,7 @@ declare namespace videojs {
|
||||
* @param [options={}]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: TrackButtonOptions): TextTrackButton;
|
||||
new (player: Player, options?: TrackButtonOptions): TextTrackButton;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5106,7 +5115,7 @@ declare namespace videojs {
|
||||
* @param cues
|
||||
* A list of cues to be initialized with
|
||||
*/
|
||||
new(cues: TextTrackCueList.TextTrackCue[]): TextTrackCueList;
|
||||
new (cues: TextTrackCueList.TextTrackCue[]): TextTrackCueList;
|
||||
};
|
||||
|
||||
namespace TextTrackCueList {
|
||||
@ -5189,7 +5198,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: TextTrackMenuItemOptions): TextTrackMenuItem;
|
||||
new (player: Player, options?: TextTrackMenuItemOptions): TextTrackMenuItem;
|
||||
};
|
||||
|
||||
interface TextTrackMenuItemOptions extends MenuItemOptions {
|
||||
@ -5281,7 +5290,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options: TextTrackSettingsOptions): TextTrackSettings
|
||||
new (player: Player, options: TextTrackSettingsOptions): TextTrackSettings;
|
||||
};
|
||||
|
||||
interface TextTrackSettingsOptions extends ModalDialogOptions {
|
||||
@ -5399,7 +5408,7 @@ declare namespace videojs {
|
||||
* @param [options.default]
|
||||
* If this track should default to on or off.
|
||||
*/
|
||||
new(options: TextTrackOptions): TextTrack;
|
||||
new (options: TextTrackOptions): TextTrack;
|
||||
};
|
||||
|
||||
interface TextTrackOptions extends TrackOptions {
|
||||
@ -5445,7 +5454,7 @@ declare namespace videojs {
|
||||
* @param tracks
|
||||
* A list of tracks to initialize the list with.
|
||||
*/
|
||||
new(tracks?: TextTrack[]): TextTrackList;
|
||||
new (tracks?: TextTrack[]): TextTrackList;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5521,7 +5530,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions): TimeDisplay;
|
||||
new (player: Player, options?: ComponentOptions): TimeDisplay;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5562,7 +5571,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions): TimeToolTip;
|
||||
new (player: Player, options?: ComponentOptions): TimeToolTip;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5616,7 +5625,7 @@ declare namespace videojs {
|
||||
* @param [options.language='']
|
||||
* A valid two character language code.
|
||||
*/
|
||||
new(options?: TrackOptions): Track;
|
||||
new (options?: TrackOptions): Track;
|
||||
};
|
||||
|
||||
interface TrackOptions {
|
||||
@ -5641,7 +5650,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: TrackButtonOptions): MenuButton;
|
||||
new (player: Player, options?: TrackButtonOptions): MenuButton;
|
||||
};
|
||||
|
||||
interface TrackButtonOptions extends MenuButtonOptions {
|
||||
@ -5690,7 +5699,7 @@ declare namespace videojs {
|
||||
* @param tracks
|
||||
* A list of tracks to initialize the list with.
|
||||
*/
|
||||
new(tracks?: Track[]): TrackList;
|
||||
new (tracks?: Track[]): TrackList;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5759,7 +5768,7 @@ declare namespace videojs {
|
||||
* @param [options]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: SliderOptions): VolumeBar;
|
||||
new (player: Player, options?: SliderOptions): VolumeBar;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5819,7 +5828,7 @@ declare namespace videojs {
|
||||
* @param [options={}]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: VolumeControlOptions): VolumeControl;
|
||||
new (player: Player, options?: VolumeControlOptions): VolumeControl;
|
||||
};
|
||||
|
||||
interface VolumeControlOptions extends ComponentOptions {
|
||||
@ -5859,7 +5868,7 @@ declare namespace videojs {
|
||||
* @param [ready]
|
||||
* Function that gets called when the `Component` is ready.
|
||||
*/
|
||||
new(player: Player, options?: ComponentOptions, ready?: Component.ReadyCallback): VolumeLevel;
|
||||
new (player: Player, options?: ComponentOptions, ready?: Component.ReadyCallback): VolumeLevel;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5887,7 +5896,7 @@ declare namespace videojs {
|
||||
* @param [options={}]
|
||||
* The key/value store of player options.
|
||||
*/
|
||||
new(player: Player, options?: VolumePanel): VolumePanel;
|
||||
new (player: Player, options?: VolumePanel): VolumePanel;
|
||||
};
|
||||
|
||||
interface VolumePanelOptions extends ComponentOptions {
|
||||
|
||||
@ -1,128 +1,140 @@
|
||||
import videojs from 'video.js/dist/alt/video.core.novtt.js';
|
||||
import { default as videojsnovtt } from 'video.js/dist/alt/video.core.novtt.js';
|
||||
import { default as videojscore } from 'video.js/dist/alt/video.core.js';
|
||||
|
||||
videojs("example_video_1").ready(function() {
|
||||
// EXAMPLE: Start playing the video.
|
||||
const playPromise = this.play();
|
||||
test(videojsnovtt);
|
||||
test(videojscore);
|
||||
|
||||
if (playPromise) {
|
||||
playPromise.then(() => {});
|
||||
}
|
||||
function test(videojs: typeof videojsnovtt | typeof videojscore) {
|
||||
videojs('example_video_1').ready(function() {
|
||||
// EXAMPLE: Start playing the video.
|
||||
const playPromise = this.play();
|
||||
|
||||
this.pause();
|
||||
if (playPromise) {
|
||||
playPromise.then(() => {});
|
||||
}
|
||||
|
||||
const isPaused: boolean = this.paused();
|
||||
const isPlaying: boolean = !this.paused();
|
||||
this.pause();
|
||||
|
||||
this.src("http://www.example.com/path/to/video.mp4");
|
||||
const isPaused: boolean = this.paused();
|
||||
const isPlaying: boolean = !this.paused();
|
||||
|
||||
this.src({ type: "video/mp4", src: "http://www.example.com/path/to/video.mp4" });
|
||||
this.src('http://www.example.com/path/to/video.mp4');
|
||||
|
||||
this.src([
|
||||
{ type: "video/mp4", src: "http://www.example.com/path/to/video.mp4" },
|
||||
{ type: "video/webm", src: "http://www.example.com/path/to/video.webm" },
|
||||
{ type: "video/ogg", src: "http://www.example.com/path/to/video.ogv" }
|
||||
]);
|
||||
this.src({ type: 'video/mp4', src: 'http://www.example.com/path/to/video.mp4' });
|
||||
|
||||
const whereYouAt: number = this.currentTime();
|
||||
this.src([
|
||||
{ type: 'video/mp4', src: 'http://www.example.com/path/to/video.mp4' },
|
||||
{ type: 'video/webm', src: 'http://www.example.com/path/to/video.webm' },
|
||||
{ type: 'video/ogg', src: 'http://www.example.com/path/to/video.ogv' },
|
||||
]);
|
||||
|
||||
this.currentTime(120); // 2 minutes into the video
|
||||
const whereYouAt: number = this.currentTime();
|
||||
|
||||
const howLongIsThis: number = this.duration();
|
||||
this.currentTime(120); // 2 minutes into the video
|
||||
|
||||
const bufferedTimeRange: TimeRanges = this.buffered();
|
||||
const howLongIsThis: number = this.duration();
|
||||
|
||||
// Number of different ranges of time have been buffered. Usually 1.
|
||||
const numberOfRanges: number = bufferedTimeRange.length;
|
||||
const bufferedTimeRange: TimeRanges = this.buffered();
|
||||
|
||||
// Time in seconds when the first range starts. Usually 0.
|
||||
const firstRangeStart: number = bufferedTimeRange.start(0);
|
||||
// Number of different ranges of time have been buffered. Usually 1.
|
||||
const numberOfRanges: number = bufferedTimeRange.length;
|
||||
|
||||
// Time in seconds when the first range ends
|
||||
const firstRangeEnd: number = bufferedTimeRange.end(0);
|
||||
// Time in seconds when the first range starts. Usually 0.
|
||||
const firstRangeStart: number = bufferedTimeRange.start(0);
|
||||
|
||||
// Length in seconds of the first time range
|
||||
const firstRangeLength: number = firstRangeEnd - firstRangeStart;
|
||||
// Time in seconds when the first range ends
|
||||
const firstRangeEnd: number = bufferedTimeRange.end(0);
|
||||
|
||||
const howMuchIsDownloaded: number = this.bufferedPercent();
|
||||
// Length in seconds of the first time range
|
||||
const firstRangeLength: number = firstRangeEnd - firstRangeStart;
|
||||
|
||||
const howLoudIsIt: number = this.volume();
|
||||
const howMuchIsDownloaded: number = this.bufferedPercent();
|
||||
|
||||
this.volume(0.5); // Set volume to half
|
||||
const howLoudIsIt: number = this.volume();
|
||||
|
||||
const howWideIsIt: number = this.width();
|
||||
this.volume(0.5); // Set volume to half
|
||||
|
||||
this.width(640);
|
||||
const howWideIsIt: number = this.width();
|
||||
|
||||
const howTallIsIt: number = this.height();
|
||||
this.width(640);
|
||||
|
||||
this.height(480);
|
||||
const howTallIsIt: number = this.height();
|
||||
|
||||
const readyState: videojs.ReadyState = this.readyState();
|
||||
this.height(480);
|
||||
|
||||
this.requestFullscreen();
|
||||
const readyState: videojsnovtt.ReadyState = this.readyState();
|
||||
const readyState2: videojscore.ReadyState = this.readyState();
|
||||
|
||||
const networkState: videojs.NetworkState = this.networkState();
|
||||
this.requestFullscreen();
|
||||
|
||||
testEvents(this);
|
||||
const networkState: videojsnovtt.NetworkState = this.networkState();
|
||||
const networkState2: videojscore.NetworkState = this.networkState();
|
||||
|
||||
testComponents(this);
|
||||
testEvents(this);
|
||||
|
||||
testPlugin(this, {});
|
||||
testComponents(this);
|
||||
|
||||
testLogger();
|
||||
});
|
||||
testPlugin(this, {});
|
||||
|
||||
function testEvents(player: videojs.Player) {
|
||||
const myFunc = function(this: videojs.Player) {
|
||||
// Do something when the event is fired
|
||||
};
|
||||
player.on("error", myFunc);
|
||||
// Removes the specified listener only.
|
||||
player.off("error", myFunc);
|
||||
testLogger();
|
||||
});
|
||||
|
||||
const myFuncWithArg = function(this: videojs.Player, e: Event) {
|
||||
// Do something when the event is fired
|
||||
};
|
||||
player.on("volumechange", myFuncWithArg);
|
||||
// Removes all listeners for the given event type.
|
||||
player.off("volumechange");
|
||||
function testEvents(player: videojsnovtt.Player | videojscore.Player) {
|
||||
const myFunc = function(this: videojscore.Player) {
|
||||
// Do something when the event is fired
|
||||
};
|
||||
player.on('error', myFunc);
|
||||
// Removes the specified listener only.
|
||||
player.off('error', myFunc);
|
||||
|
||||
player.on("loadeddata", () => { /* Some handler. */ });
|
||||
// Removes all listeners.
|
||||
player.off();
|
||||
}
|
||||
|
||||
function testComponents(player: videojs.Player) {
|
||||
class MyWindow extends videojs.getComponent('ModalDialog') {
|
||||
myFunction() {
|
||||
this.player().play();
|
||||
}
|
||||
}
|
||||
|
||||
const myWindow = new MyWindow(player, {});
|
||||
myWindow.controlText('My text');
|
||||
myWindow.open();
|
||||
myWindow.close();
|
||||
myWindow.myFunction();
|
||||
}
|
||||
|
||||
function testPlugin(player: videojs.Player, options: {}) {
|
||||
if (player.usingPlugin('uloztoExample')) { return; }
|
||||
|
||||
videojs.registerPlugin('uloztoExample', function({}: typeof options) {
|
||||
this.play();
|
||||
this.one('ended', () => {
|
||||
// do something
|
||||
});
|
||||
});
|
||||
(player as any).uloztoExample(options);
|
||||
}
|
||||
|
||||
function testLogger() {
|
||||
const mylogger = videojs.log.createLogger('mylogger');
|
||||
const anotherlogger = mylogger.createLogger('anotherlogger');
|
||||
|
||||
videojs.log('hello');
|
||||
mylogger('how are you');
|
||||
anotherlogger('today');
|
||||
const myFuncWithArg = function(this: videojscore.Player, e: Event) {
|
||||
// Do something when the event is fired
|
||||
};
|
||||
player.on('volumechange', myFuncWithArg);
|
||||
// Removes all listeners for the given event type.
|
||||
player.off('volumechange');
|
||||
|
||||
player.on('loadeddata', () => {
|
||||
/* Some handler. */
|
||||
});
|
||||
// Removes all listeners.
|
||||
player.off();
|
||||
}
|
||||
|
||||
function testComponents(player: videojscore.Player) {
|
||||
class MyWindow extends videojs.getComponent('ModalDialog') {
|
||||
myFunction() {
|
||||
this.player().play();
|
||||
}
|
||||
}
|
||||
|
||||
const myWindow = new MyWindow(player, {});
|
||||
myWindow.controlText('My text');
|
||||
myWindow.open();
|
||||
myWindow.close();
|
||||
myWindow.myFunction();
|
||||
}
|
||||
|
||||
function testPlugin(player: videojscore.Player, options: {}) {
|
||||
if (player.usingPlugin('uloztoExample')) {
|
||||
return;
|
||||
}
|
||||
|
||||
videojs.registerPlugin('uloztoExample', function({}: typeof options) {
|
||||
this.play();
|
||||
this.one('ended', () => {
|
||||
// do something
|
||||
});
|
||||
});
|
||||
(player as any).uloztoExample(options);
|
||||
}
|
||||
|
||||
function testLogger() {
|
||||
const mylogger = videojs.log.createLogger('mylogger');
|
||||
const anotherlogger = mylogger.createLogger('anotherlogger');
|
||||
|
||||
videojs.log('hello');
|
||||
mylogger('how are you');
|
||||
anotherlogger('today');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
import videojs, { VideoJsPlayer } from 'video.js';
|
||||
|
||||
videojs("example_video_1").ready(function() {
|
||||
// EXAMPLE: Start playing the video.
|
||||
const playPromise = this.play();
|
||||
videojs('example_video_1').ready(function() {
|
||||
// EXAMPLE: Start playing the video.
|
||||
const playPromise = this.play();
|
||||
|
||||
if (playPromise) {
|
||||
playPromise.then(() => {});
|
||||
}
|
||||
if (playPromise) {
|
||||
playPromise.then(() => {});
|
||||
}
|
||||
|
||||
this.pause();
|
||||
this.pause();
|
||||
|
||||
const isPaused: boolean = this.paused();
|
||||
const isPlaying: boolean = !this.paused();
|
||||
const isPaused: boolean = this.paused();
|
||||
const isPlaying: boolean = !this.paused();
|
||||
|
||||
this.src("http://www.example.com/path/to/video.mp4");
|
||||
this.src('http://www.example.com/path/to/video.mp4');
|
||||
|
||||
this.src({ type: "video/mp4", src: "http://www.example.com/path/to/video.mp4" });
|
||||
this.src({ type: 'video/mp4', src: 'http://www.example.com/path/to/video.mp4' });
|
||||
|
||||
this.src([
|
||||
{ type: "video/mp4", src: "http://www.example.com/path/to/video.mp4" },
|
||||
{ type: "video/webm", src: "http://www.example.com/path/to/video.webm" },
|
||||
{ type: "video/ogg", src: "http://www.example.com/path/to/video.ogv" }
|
||||
]);
|
||||
this.src([
|
||||
{ type: 'video/mp4', src: 'http://www.example.com/path/to/video.mp4' },
|
||||
{ type: 'video/webm', src: 'http://www.example.com/path/to/video.webm' },
|
||||
{ type: 'video/ogg', src: 'http://www.example.com/path/to/video.ogv' },
|
||||
]);
|
||||
|
||||
const liveTracker = this.liveTracker;
|
||||
liveTracker.on('seekableendchange', () => {});
|
||||
@ -42,95 +42,99 @@ videojs("example_video_1").ready(function() {
|
||||
|
||||
const whereYouAt: number = this.currentTime();
|
||||
|
||||
const howLongIsThis: number = this.duration();
|
||||
const howLongIsThis: number = this.duration();
|
||||
|
||||
const bufferedTimeRange: TimeRanges = this.buffered();
|
||||
const bufferedTimeRange: TimeRanges = this.buffered();
|
||||
|
||||
// Number of different ranges of time have been buffered. Usually 1.
|
||||
const numberOfRanges: number = bufferedTimeRange.length;
|
||||
// Number of different ranges of time have been buffered. Usually 1.
|
||||
const numberOfRanges: number = bufferedTimeRange.length;
|
||||
|
||||
// Time in seconds when the first range starts. Usually 0.
|
||||
const firstRangeStart: number = bufferedTimeRange.start(0);
|
||||
// Time in seconds when the first range starts. Usually 0.
|
||||
const firstRangeStart: number = bufferedTimeRange.start(0);
|
||||
|
||||
// Time in seconds when the first range ends
|
||||
const firstRangeEnd: number = bufferedTimeRange.end(0);
|
||||
// Time in seconds when the first range ends
|
||||
const firstRangeEnd: number = bufferedTimeRange.end(0);
|
||||
|
||||
// Length in seconds of the first time range
|
||||
const firstRangeLength: number = firstRangeEnd - firstRangeStart;
|
||||
// Length in seconds of the first time range
|
||||
const firstRangeLength: number = firstRangeEnd - firstRangeStart;
|
||||
|
||||
const howMuchIsDownloaded: number = this.bufferedPercent();
|
||||
const howMuchIsDownloaded: number = this.bufferedPercent();
|
||||
|
||||
const howLoudIsIt: number = this.volume();
|
||||
const howLoudIsIt: number = this.volume();
|
||||
|
||||
this.volume(0.5); // Set volume to half
|
||||
this.volume(0.5); // Set volume to half
|
||||
|
||||
const howWideIsIt: number = this.width();
|
||||
const howWideIsIt: number = this.width();
|
||||
|
||||
this.width(640);
|
||||
this.width(640);
|
||||
|
||||
const howTallIsIt: number = this.height();
|
||||
const howTallIsIt: number = this.height();
|
||||
|
||||
this.height(480);
|
||||
this.height(480);
|
||||
|
||||
const readyState: videojs.ReadyState = this.readyState();
|
||||
const readyState: videojs.ReadyState = this.readyState();
|
||||
|
||||
this.requestFullscreen();
|
||||
this.requestFullscreen();
|
||||
|
||||
const networkState: videojs.NetworkState = this.networkState();
|
||||
const networkState: videojs.NetworkState = this.networkState();
|
||||
|
||||
testEvents(this);
|
||||
testEvents(this);
|
||||
|
||||
testComponents(this);
|
||||
testComponents(this);
|
||||
|
||||
testPlugin(this, {});
|
||||
testPlugin(this, {});
|
||||
|
||||
testLogger();
|
||||
testLogger();
|
||||
});
|
||||
|
||||
function testEvents(player: videojs.Player) {
|
||||
const myFunc = function(this: videojs.Player) {
|
||||
// Do something when the event is fired
|
||||
};
|
||||
player.on("error", myFunc);
|
||||
// Removes the specified listener only.
|
||||
player.off("error", myFunc);
|
||||
const myFunc = function(this: videojs.Player) {
|
||||
// Do something when the event is fired
|
||||
};
|
||||
player.on('error', myFunc);
|
||||
// Removes the specified listener only.
|
||||
player.off('error', myFunc);
|
||||
|
||||
const myFuncWithArg = function(this: videojs.Player, e: Event) {
|
||||
// Do something when the event is fired
|
||||
};
|
||||
player.on("volumechange", myFuncWithArg);
|
||||
// Removes all listeners for the given event type.
|
||||
player.off("volumechange");
|
||||
const myFuncWithArg = function(this: videojs.Player, e: Event) {
|
||||
// Do something when the event is fired
|
||||
};
|
||||
player.on('volumechange', myFuncWithArg);
|
||||
// Removes all listeners for the given event type.
|
||||
player.off('volumechange');
|
||||
|
||||
player.on("loadeddata", () => { /* Some handler. */ });
|
||||
// Removes all listeners.
|
||||
player.off();
|
||||
player.on('loadeddata', () => {
|
||||
/* Some handler. */
|
||||
});
|
||||
// Removes all listeners.
|
||||
player.off();
|
||||
}
|
||||
|
||||
function testComponents(player: videojs.Player) {
|
||||
class MyWindow extends videojs.getComponent('ModalDialog') {
|
||||
myFunction() {
|
||||
this.player().play();
|
||||
}
|
||||
}
|
||||
class MyWindow extends videojs.getComponent('ModalDialog') {
|
||||
myFunction() {
|
||||
this.player().play();
|
||||
}
|
||||
}
|
||||
|
||||
const myWindow = new MyWindow(player, {});
|
||||
myWindow.controlText('My text');
|
||||
myWindow.open();
|
||||
myWindow.close();
|
||||
myWindow.myFunction();
|
||||
const myWindow = new MyWindow(player, {});
|
||||
myWindow.controlText('My text');
|
||||
myWindow.open();
|
||||
myWindow.close();
|
||||
myWindow.myFunction();
|
||||
}
|
||||
|
||||
function testPlugin(player: videojs.Player, options: {}) {
|
||||
if (player.usingPlugin('uloztoExample')) { return; }
|
||||
if (player.usingPlugin('uloztoExample')) {
|
||||
return;
|
||||
}
|
||||
|
||||
videojs.registerPlugin('uloztoExample', function({}: typeof options) {
|
||||
this.play();
|
||||
this.one('ended', () => {
|
||||
// do something
|
||||
});
|
||||
});
|
||||
(player as any).uloztoExample(options);
|
||||
videojs.registerPlugin('uloztoExample', function({}: typeof options) {
|
||||
this.play();
|
||||
this.one('ended', () => {
|
||||
// do something
|
||||
});
|
||||
});
|
||||
(player as any).uloztoExample(options);
|
||||
|
||||
const Plugin = videojs.getPlugin('plugin');
|
||||
|
||||
@ -148,20 +152,23 @@ function testPlugin(player: videojs.Player, options: {}) {
|
||||
|
||||
player.on('playing', () => {
|
||||
videojs.log('playback began!');
|
||||
});
|
||||
|
||||
this.player.on('pause', () => {
|
||||
videojs.log('playback ended');
|
||||
});
|
||||
|
||||
const media = this.player.getMedia();
|
||||
|
||||
this.player.loadMedia({
|
||||
src: "http://www.example.com/path/to/video.mp4",
|
||||
poster: "http://www.example.com/path/to/image.jpg",
|
||||
}, () => {
|
||||
videojs.log('loadMedia ready!');
|
||||
});
|
||||
|
||||
this.player.on('pause', () => {
|
||||
videojs.log('playback ended');
|
||||
});
|
||||
|
||||
const media = this.player.getMedia();
|
||||
|
||||
this.player.loadMedia(
|
||||
{
|
||||
src: 'http://www.example.com/path/to/video.mp4',
|
||||
poster: 'http://www.example.com/path/to/image.jpg',
|
||||
},
|
||||
() => {
|
||||
videojs.log('loadMedia ready!');
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,10 +176,10 @@ function testPlugin(player: videojs.Player, options: {}) {
|
||||
}
|
||||
|
||||
function testLogger() {
|
||||
const mylogger = videojs.log.createLogger('mylogger');
|
||||
const anotherlogger = mylogger.createLogger('anotherlogger');
|
||||
const mylogger = videojs.log.createLogger('mylogger');
|
||||
const anotherlogger = mylogger.createLogger('anotherlogger');
|
||||
|
||||
videojs.log('hello');
|
||||
mylogger('how are you');
|
||||
anotherlogger('today');
|
||||
videojs.log('hello');
|
||||
mylogger('how are you');
|
||||
anotherlogger('today');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user