VideoHelper

VideoHelper

A helper class to provide common functionality for working with HTML5 video objects A singleton instance of this class is available as game.video

Constructor

new VideoHelper()

Source:

Members

locked :Boolean

Source:

A flag for whether video playback is currently locked by awaiting a user gesture

Type:
  • Boolean

pending :Set

Source:

A user gesture must be registered before video playback can begin. This Set records the video elements which await such a gesture.

Type:
  • Set

thumbs :Map.<string, string>

Source:

A mapping of base64 video thumbnail images

Type:
  • Map.<string, string>

videos :Object

Source:

A collection of HTML5 video objects which are currently active within the FVTT page

Type:
  • Object

Methods

_onFirstGesture(event)

Source:

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.

Parameters:
Name Type Description
event Event

The mouse-move event which enables playback

awaitFirstGesture()

Source:

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.

(async) createThumbnail(src, options) → {Promise.<string>}

Source:

Create and cache a static thumbnail to use for the video. The thumbnail is cached using the video file path or URL.

Parameters:
Name Type Description
src string

The source video URL

options object

Thumbnail creation options, including width and height

Returns:

The created and cached base64 thumbnail image

Type
Promise.<string>

play(video)

Source:

Play a single video source If playback is not yet enabled, add the video to the pending queue

Parameters:
Name Type Description
video HTMLElement

The VIDEO element to play