Options
All
  • Public
  • Public/Protected
  • All
Menu

YouTube Stream Class for seeking audio to a timeStamp.

Hierarchy

  • SeekStream

Index

Constructors

  • new SeekStream(url: string, duration: number, headerLength: number, contentLength: number, bitrate: number, video_url: string, options: StreamOptions): SeekStream
  • YouTube Stream Class constructor

    Parameters

    • url: string

      Audio Endpoint url.

    • duration: number

      Duration of audio playback [ in seconds ]

    • headerLength: number

      Length of the header in bytes.

    • contentLength: number

      Total length of Audio file in bytes.

    • bitrate: number

      Bitrate provided by YouTube.

    • video_url: string

      YouTube video url.

    • options: StreamOptions

      Options provided to stream function.

    Returns SeekStream

Properties

bytes_count: number

Used to calculate no of bytes data that we have recieved

content_length: number

Total length of audio file in bytes

header_length: number

Length of the header in bytes

per_sec_bytes: number

Calculate per second bytes by using contentLength (Total bytes) / Duration (in seconds)

quality: number

Quality given by user. [ Used only for retrying purposes only. ]

request: null | IncomingMessage

Incoming message that we recieve.

Storing this is essential. This helps to destroy the TCP connection completely if you stopped player in between the stream

stream: WebmSeeker

WebmSeeker Stream through which data passes

timer: Timer

Timer for looping data every 265 seconds.

Type of audio data that we recieved from normal youtube url.

url: string

Audio Endpoint Format Url to get data from.

video_url: string

YouTube video url. [ Used only for retrying purposes only. ]

Methods

  • cleanup(): void
  • This cleans every used variable in class.

    This is used to prevent re-use of this class and helping garbage collector to collect it.

    Returns void

  • loop(): Promise<void>
  • Getting data from audio endpoint url and passing it to stream.

    If 404 or 403 occurs, it will retry again.

    Returns Promise<void>

  • pause(): void
  • resume(): void
  • retry(): Promise<void>
  • seek(): Promise<void>
  • INTERNAL Function

    Uses stream functions to parse Webm Head and gets Offset byte to seek to.

    Returns Promise<void>

    Nothing

Generated using TypeDoc