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

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.

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