Skip to content

Latest commit

 

History

History
779 lines (443 loc) · 13 KB

API.md

File metadata and controls

779 lines (443 loc) · 13 KB

Table of Contents

API

A static class that interfaces with the server-side Vimeo API

path

A util method to modify the endpoint to and return a full API request url

Parameters

  • endpoint string The endpoint you would like to add the full request URL (e.g /videos/video-id)

Returns string

getVideo

A method for requesting Vimeo videos by video id

Parameters

  • videoId number The Vimeo video id you would like to query (e.g 296928206)

Returns Promise

getAlbumVideos

A method for requesting Vimeo albums by album id

Parameters

  • albumId number The Vimeo album id you would like to query (e.g 5528679)

Returns Promise

sendResponse

A utility method for unpacking and resolving the Vimeo API response from the server

Parameters

  • res Object Vimeo API response
  • resolve function (any) Promise resolve method
  • reject function (any) Promise reject method

Player

Extends EventEmitter

A class that represents a Vimeo video player

Parameters

  • videoId number A Vimeo video ID (e.g 296928206)
  • args Object An object that holds the Vimeo video properties (optional, default {})

bindEvents

Bind all player event emitters, used internally

parseVideoId

Parse and clean a valid Vimeo video ID from string or integer

Parameters

  • id number The Vimeo video ID

Returns number

getVideoId

Get the current player's Vimeo video ID

Returns number

getMetadata

Get the JSON metadata object stored in the Vimeo video description

Returns object The metadata JSON object parsed from the Vimeo video description

getDescription

Get the Vimeo video description

Returns string The video description

mute

Mute the video

unmute

Unmute the video

load

Load the current video

setQuality

Set the video quality based on one of the options in the VideoQuality enum

Parameters

getQuality

Get the current selected video quality

Returns number

getWidth

Get the current video's width in pixels

Returns number

getHeight

Get the current video's height in pixels

Returns number

isPlaying

Query wheter the current video is playing

Returns bool

isPaused

Query wheter a video is paused

Returns bool

isStopped

Query wheter a video is stopped

Returns bool

getTime

Query the video current time

Returns number

setTime

Set the video current time

Parameters

  • time number the time to set the current video to

play

Play the video

pause

Pause the video

stop

Stop the video

setVolume

Set the video volume

Parameters

  • volume number A number for the new volume you would like to set between 0.0 and 1.0

loadPlayersByAlbum

Load a Vimeo album and create multipule Vimeo Players

Parameters

  • albumId number A Vimeo album ID (e.g 5528679)
  • args Object An object that holds the Vimeo video properties (optional, default {})
    • args.quality number args.quality - The video quality represented by the VideoQuality enum (optional, default VideoQuality.auto)
    • args.muted bool A boolean for loading a video and playing it back muted (optional, default false)
    • args.autoplay bool A boolean for loading the video and automatically playing it once it has loaded (optional, default true)
    • args.loop bool A boolean for looping the video playback when it reaches the end (optional, default true)

Util

A class for static utility methods

checkWebGL

Check wheter WebGL is supported or not

Returns bool

isiOS

Check wheter the platform is iOS

Returns bool

isMobile

Check wheter the current device is a mobile device

Returns bool

VideoElement

Extends EventEmitter

Class representing a DOM video element

Parameters

  • vimeoVideo VimeoVideo A VimeoVideo object representing the video resource

getElement

Get the

Returns HTMLElement

play

Play the video

pause

Pause the video

stop

Stop the video

setVolume

Set the video volume

Parameters

  • volume number A number for the new volume you would like to set between 0.0 and 1.0

getVolume

Gets the video volume

Returns number

isPlaying

Query wheter a video is playing

Returns bool

isPaused

Query wheter a video is paused

Returns bool

isStopped

Query wheter a video is stopped

Returns bool

setTime

Set the current video time

Parameters

  • time number The time to set the video

getTime

Query the current video time

Returns number

createElement

Create the

Parameters

  • vimeoVideo VimeoVideo A VimeoVideo object representing the video resource

Returns HTMLElement

createAdaptivePlayer

Creates a new DOM element with either Dash, HLS or progressive video playback based on the platform support

Parameters

  • vimeoVideo VimeoVideo A VimeoVideo object representing the video resource

Returns HTMLElement

setiOSPlayerAttributes

Adds iOS attributes to be able to play

Parameters

VideoQuality

An enum that represents the video quality coming from Vimeo, auto will default to adaptive an fallback to highest progressive file

VimeoVideo

Extends EventEmitter

Class representing a Vimeo video resource

Parameters

  • videoId number A Vimeo video ID (e.g 296928206)
  • args Object An object that holds the Vimeo video properties (optional, default {})

onClickAutoplayFix

An internal method that removes that hits play for autoplay fix event listener, should not be used from outside the class

loadFromVideoId

Load a specific video by providing a Vimeo video ID

Parameters

  • videoId number A Vimeo video ID (e.g 296928206)

load

Load a specific video based on the Vimeo video ID provided to the constructor, for internal class use

getJSONFromVideoDescription

Parses the Vimeo video description and returns a JSON object if it exists Useful for when storing metadata in video description (e.g volumetric video)

Returns Object

isLoaded

Query wheter the current video is loaded

Returns bool

isPlaying

Query wheter the current video is playing

Returns bool

isPaused

Query wheter a video is paused

Returns bool

isStopped

Query wheter a video is stopped

Returns bool

getTime

Query the video current time

Returns number

setTime

Set the video current time

Parameters

  • time number the time to set the current video to

play

Play the video

pause

Pause the video

stop

Stop the video

setVolume

Set the video volume

Parameters

  • volume number A number for the new volume you would like to set between 0.0 and 1.0

mute

Muted the video

unmute

Unmute the video

setupTexture

Create a three.js video texture

getWidth

Get the video's width in pixels

Returns number

getHeight

Get the video's height in pixels

Returns number

getFileURL

Get the current Vimeo video file URL

Returns string

getAdaptiveURL

Get the current Vimeo video adaptive stream manifrest file URL

Returns string

getProgressiveFileURL

Get the current Vimeo video progressive file URL by specific video quality

Parameters

  • quality VideoQuality Specific quality to query the possible video resolutions

Returns string

isLive

Query wheter the current video is a livestream

Returns bool

isAdaptivePlayback

Query wheter the current video is playing back an adaptive stream

Returns bool

isDashPlayback

Query wheter the current video is playing back an adaptive DASH stream

Returns bool