Options
All
  • Public
  • Public/Protected
  • All
Menu

YouTube Stream Class for playing audio from normal videos.

Hierarchy

  • Stream

Index

Constructors

  • YouTube Stream Class constructor

    Parameters

    • url: string

      Audio Endpoint url.

    • type: StreamType

      Type of Stream

    • duration: number

      Duration of audio playback [ in seconds ]

    • contentLength: number

      Total length of Audio file in bytes.

    • video_url: string

      YouTube video url.

    • options: StreamOptions

      Options provided to stream function.

    Returns Stream

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

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: Readable

Readable 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>

Generated using TypeDoc