Options
All
  • Public
  • Public/Protected
  • All
Menu

VideoPool

A MediaPool designed to handle playback of video files. Though this class will handle the timing, loading, and element creation for you, you still need to add the generated video element to the DOM. Do this by subscribing to play$.

Hierarchy

Index

Constructors

constructor

  • new VideoPool(__namedParameters: object): VideoPool
  • Parameters

    • __namedParameters: object
      • assets: Asset[]

        A list of Assets handled by this Pool.

      • dropCount: number | function
      • dropDistributionWeight: number | function
      • duration: number | function
      • loop: boolean
      • ordered: boolean

        Whether to consume the assets in the provided order (default: false).

    Returns VideoPool

Properties

assets

assets: Asset[]

List of media sources used by this Pool.

destroy$

destroy$: Observable<void>

Fires when the Pool stops and is not looping.

drop$

drop$: Observable<number>

Fires for each drop in the Pool. Callback is passed the drop index.

dropCount

dropCount: number

The number of times the present run will drop.

dropDistributionWeight

dropDistributionWeight: number = 1

The distribution weighting for drops in the Pool * (1 = neutral, lower = later, higher = earlier). Uses weightedRandom under the hood.

NB: This will be changed to use a distribution function in future versions.

duration

duration: number

Total duration of the current iteration of the pool (ms).

loop

loop: boolean = false

Whether the Pool should restart when it ends.

ordered

ordered: boolean = false

Determines whether the Assets will be played in order or at random. (To weight the randomness, add duplicate Assets.)

pause$

pause$: Observable<void>

Fires when the Pool is paused.

play$

play$: Observable<Video>

Fires when a sound begins to play. Use this instead of Pool.drop$ to gain access to the Video.

queue

queue: Video[] = []

resume$

resume$: Observable<void>

Fires when the Pool is resumed.

start$

start$: Observable<void>

Fires at the start of a Pool cycle.

stop$

stop$: Observable<void>

Fires at the end of a Pool cycle.

Methods

destroyVideo

  • destroyVideo(v: Video): void
  • Removes Video from internal lists and calls Video.destroy. Use this to remove the video from the DOM so that PoolTime can remove its references to the DOM element.

    Parameters

    Returns void

pause

  • pause(): void
  • Pauses the Pool.

    Returns void

preloadAll

  • preloadAll(): Observable<void>
  • Preloads all Assets in the list. Returned observable fires when each video's canplaythrough event fires.

    Returns Observable<void>

resume

  • resume(): void
  • Resumes the Pool.

    Returns void

start

  • start(): void
  • Starts the pool.

    Returns void

stop

  • stop(): void

Static getVideo

  • Get a Video for a source.

    Parameters

    Returns Video

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc