A helper class to provide common functionality for working with HTML5 video objects
A singleton instance of this class is available as
A user gesture must be registered before video playback can begin. This Set records the video elements which await such a gesture.
A mapping of base64 video thumbnail images
A flag for whether video playback is currently locked by awaiting a user gesture
Store a Promise while the YouTube API is initializing.
The YouTube URL regex.
Return the HTML element which provides the source for a loaded texture.
The rendered mesh
The source HTML element
Get the video element source corresponding to a Sprite or SpriteMesh.
The PIXI source
The source video element or null
Clone a video texture so that it can be played independently of the original base texture.
The video element source
An unlinked PIXI.Texture which can be played independently
Play a single video source If playback is not yet enabled, add the video to the pending queue
The VIDEO element to play
Additional options for modifying video playback
Stop a single video source
The VIDEO element to stop
Register an event listener to await the first mousemove gesture and begin playback once observed A user interaction must involve a mouse click or keypress. Listen for any of these events, and handle the first observed gesture.
Handle the first observed user gesture We need a slight delay because unfortunately Chrome is stupid and doesn't always acknowledge the gesture fast enough.
The mouse-move event which enables playback
Create and cache a static thumbnail to use for the video. The thumbnail is cached using the video file path or URL.
The source video URL
Thumbnail creation options, including width and height
The created and cached base64 thumbnail image, or a placeholder image if the canvas is disabled and no thumbnail can be generated.
Lazily-load the YouTube API and retrieve a Player instance for a given iframe.
The iframe ID.
A player config object. See https://developers.google.com/youtube/iframe_api_reference for reference.
Retrieve a YouTube video ID from a URL.
Take a URL to a YouTube video and convert it into a URL suitable for embedding in a YouTube iframe.
The URL to convert.
YouTube player parameters.
The YouTube embed URL.
Test a URL to see if it points to a YouTube video.
The URL to test.
Inject the YouTube API into the page.
A Promise that resolves when the API has initialized.