Class: Video

Video


<async> new Video()

Represents a Video. Constructor is private. Use module:@pdftron/webviewer-video~getVideo to retrieve the instance.

Methods


<static> getTimeFromFrame(frame)

Returns the conversion of a frame number to a time stamp (in milliseconds).
Parameters:
Name Type Description
frame number The frame number to convert.
Returns:
The resulting time.
Type
number

<inner> getAllAnnotations()

Returns all annotations for all frames in the video.
Returns:
An array of all annotations.
Type
Array

<async, inner> getAnnotationCanvasesWithIntervals()

Retrieves intervals and images for annotations on video canvas
Returns:
Type
Array.<CanvasWithInterval>

<inner> getDuration()

Returns the duration of the video. Guaranteed to be correct when the readyState of the video is greater than 0. https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState
Returns:
Type
number

<inner> getElement()

Returns the underlying HTML5 video element https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
Returns:
Type
object

<inner> getFormattedAndTrimmedTime(seconds [, format])

Returns a string representing the passed in seconds. Trims unnecessary data
Parameters:
Name Type Argument Default Description
seconds number
format string <optional>
null Time format to return
Returns:
An object containing the trimmed time and the format
Type
FormattedTime

<inner> getFormattedCurrentTime()

Returns a string representing the current seeked to time. Formatted as hh:mm:ss.
Returns:
A string representing the curretn seeked to time. Formatted as hh:mm:ss.
Type
string

<inner> getFormattedTime(seconds)

Returns a string representing the passed in seconds. Formatted as hh:mm:ss.
Parameters:
Name Type Description
seconds number
Returns:
A string representing the time passed in seconds. Formatted as hh:mm:ss.
Type
string

<inner> getFPS()

Returns the fps of the video video.
Returns:
The fps of the video
Type
number

<inner> getFrameFromTime(time)

Returns the conversion of a time stamp to a frame number.
Parameters:
Name Type Description
time number A number representing a specific time in the video. The value must be in milliseconds.
Returns:
The resulting frame number.
Type
number

<inner> getReadyState()

Returns the video readystate https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState
Returns:
Type
number

<inner> getSubtitleTrackElement()

Returns the underlying HTML track element https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track
Returns:
Type
object

<inner> getTimeFromFrame(frame)

Returns the conversion of a frame number to a time stamp (in milliseconds).
Parameters:
Name Type Description
frame number The frame number to convert.
Returns:
The resulting time.
Type
number

<inner> getTotalFrames()

Returns the total number of frames in the video.
Returns:
The total number of frames in the video.
Type
number

<inner> getVerifiedStatus()

Returns the verified status of license key
Returns:
Type
boolean

<inner> hasAnnotation(frameNumber)

Returns true if the frame number passed in has at least one annotation associated with it. Returns false otherwise.
Parameters:
Name Type Description
frameNumber number The frame number to check that annotations are associated with
Returns:
Type
boolean

<inner> loadSubtitles(file)

Loads subtitles in the HTML video element.
Parameters:
Name Type Description
file File The subtitles file. Can be an srt file or vtt file. https://developer.mozilla.org/en-US/docs/Web/API/File
Example
WebViewer(...)
        .then(function(instance) {
          ...
          const {
            getVideo,
            loadVideo,
          } = await initializeVideoViewer(
            instance,
            { license },
          );
          ....
          docViewer.addEventListener('documentLoaded', () => {
            const video = getVideo();
            ...
            video.loadSubtitles(file);
            ...
          });
        });

<async, inner> setElement()

Sets the underlying HTML5 video element https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
Returns:
Type
object

<inner> setMuted(mutedStatus)

Sets video muted status https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
Parameters:
Name Type Description
mutedStatus boolean the new muted status of video
Returns:
Type
void

<inner> setUnmuted()

Sets video to be unmuted https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
Returns:
Type
void

<inner> updateAnnotationsToTime(newTime)

Renders the saved annotations on the annotation canvas at the passed in time
Parameters:
Name Type Description
newTime number A number representing a specific time in the video. The value must be in milliseconds.
Returns:
Type
void