Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TwitchPlayer

A TS wrapper for the Twitch interactive media player.

Hierarchy

  • TwitchPlayer

Index

Properties

Private Optional _player

_player: Player

Methods

addEventListener

  • Adds an event listener for the given event.

    Parameters

    • event: TwitchPlayerEvent

      The event type to which the listener should react.

    • callback: () => void

      The logic that should happen when the listener fires.

        • (): void
        • Returns void

    Returns void

disableCaptions

  • disableCaptions(): void
  • Disables the captions for the content that is currently playing.

    deprecated

    Use with caution, not inculded in the official Twitch documentation.

    Returns void

enableCaptions

  • enableCaptions(): void
  • Enables the captions for the content that is currently playing.

    deprecated

    Use with caution, not inculded in the official Twitch documentation.

    Returns void

getChannel

  • getChannel(): string | undefined

getChannelId

  • getChannelId(): string | undefined

getCollection

  • getCollection(): string | undefined

getCurrentTime

  • getCurrentTime(): number | undefined

getDuration

  • getDuration(): number | undefined

getEnded

  • getEnded(): boolean | undefined

getMuted

  • getMuted(): boolean | undefined

getPlaybackStatistics

  • Retrieves the playback statistics for this player. The statistics contain information such as video FPS, resolution, latency and dropped frames.

    deprecated

    Use with caution, not inculded in the official Twitch documentation.

    Returns PlaybackStatistics | undefined

getQualities

  • getQualities(): Quality[] | undefined

getQuality

  • getQuality(): string | undefined

getVideo

  • getVideo(): string | undefined

getVolume

  • getVolume(): number | undefined

isPaused

  • isPaused(): boolean | undefined

pause

  • pause(): void

play

  • play(): void

seek

  • seek(timestamp: number): void
  • Seeks to the specified timestamp (in seconds) in the video and resumes playing if paused. Does not work for live streams.

    Parameters

    • timestamp: number

      The specified timestamp (in seconds).

    Returns void

setChannel

  • setChannel(channel: string): void

setChannelId

  • setChannelId(channelId: string): void

setCollection

  • setCollection(collectionId: string, videoId?: undefined | string): void
  • Sets the collection to be played. Optionally also specifies the video within the collection, from which to start playback. If a video ID is not provided here or the specified video is not part of the collection, playback starts with the first video in the collection.

    Parameters

    • collectionId: string

      The identifier for the collection.

    • Optional videoId: undefined | string

      The identifier for the video.

    Returns void

setMuted

  • setMuted(muted: boolean): void
  • If true, mutes the player; otherwise, unmutes it. This is independent of the volume setting.

    Parameters

    • muted: boolean

      If true, player will be muted. Otherwise, it will be unmuted.

    Returns void

setQuality

  • setQuality(quality: string): void
  • Sets the quality of the video. quality should be a string value returned by getQualities.

    Parameters

    • quality: string

      The quality to be set.

    Returns void

setVideo

  • setVideo(videoID: string, timestamp: number): void
  • Sets the video to be played to be played and starts playback at timestamp (in seconds).

    Parameters

    • videoID: string

      The identifier of the video to be played.

    • timestamp: number

      The spot where the playback will be started (in seconds).

    Returns void

setVolume

  • setVolume(volumeLevel: number): void

Static FromOptions

Static FromPlayer

Generated using TypeDoc