Class MediaModule

This class processes sound data from HTMLMediaElement. Namely, this class enables to create audio player that has higher features from HTMLMediaElement. But, this class is disadvantage to play many one shot audios. In that case, developer should use OneshotModule.

Hierarchy (view full)

Constructors

Properties

analyser: Analyser
autopanner: Autopanner
bitcrusher: BitCrusher
chorus: Chorus
compressor: Compressor
context: AudioContext
delay: Delay
envelopegenerator: EnvelopeGenerator
equalizer: Equalizer
filter: Filter
flanger: Flanger
fuzz: Fuzz
listener: Listener
mastervolume: GainNode
mixed: boolean = false
modules: Connectable[] = []
noisegate: NoiseGate
noisesuppressor: NoiseSuppressor
overdrive: OverDrive
panner: Panner
phaser: Phaser
pitchshifter: PitchShifter
preamp: Preamp
processor: AudioWorkletNode
recorder: Recorder
reverb: Reverb
ringmodulator: Ringmodulator
runningAnalyser: boolean = false
stereo: Stereo
tremolo: Tremolo
vocalcanceler: VocalCanceler
wah: Wah
NUMBER_OF_INPUTS = 2
NUMBER_OF_OUTPUTS = 2

Accessors

Methods

  • This method exits from Picture In Picture (PIP).

    Returns Promise<void>

    Return value is Promise.

  • This method gets or sets fade-in time.

    Parameters

    • Optionaltime: number

      This argument is fade-in time. If this argument is omitted, this method is getter.

    Returns number | MediaModule

    Return value is fade-in time. Otherwise, return value is for method chain.

  • This method gets or sets fade-out time.

    Parameters

    • Optionaltime: number

      This argument is fade-out time. If this argument is omitted, this method is getter.

    Returns number | MediaModule

    Return value is fade-out time. Otherwise, return value is for method chain.

  • This method gets instance of MediaElementAudioSourceNode.

    Returns null | MediaElementAudioSourceNode

  • This method determines whether instance of HTMLMediaElement exists.

    Returns boolean

    If instance of HTMLMediaElement already exists, this value is true. Otherwise, this value is false.

  • This method determines whether instance of MediaElementAudioSourceNode exists.

    Returns boolean

    If instance of MediaElementAudioSourceNode already exists, this value is true. Otherwise, this value is false.

  • This method re-initials modules.

    Parameters

    • context: AudioContext

      This argument is in order to use Web Audio API.

    Returns void

  • This method determines whether media is paused.

    Returns boolean

    If media is paused, this value is true. Otherwise, this value is false.

  • This method prepares for playing media anytime after loading media resource.

    Parameters

    • src: string

      This argument is Object URL or file name for media resource.

    • OptionalmimeType: string

      This argument is required in case of audio streaming.

    Returns MediaModule

    Return value is for method chain.

  • This method requests Picture In Picture (PIP).

    Returns Promise<PictureInPictureWindow>

    Return value is Promise.

  • This method gets HTMLMediaElement and selects media format. In addition, this method adds event listeners that are defined by HTMLMediaElement.

    Parameters

    • params: {
          autoplay?: boolean;
          formats?: string[];
          listeners?: {
              [eventType: string]: ((event: Event | Error) => void);
          };
          media: HTMLAudioElement | HTMLVideoElement;
      }
      • Optionalautoplay?: boolean
      • Optionalformats?: string[]
      • Optionallisteners?: {
            [eventType: string]: ((event: Event | Error) => void);
        }
        • [eventType: string]: ((event: Event | Error) => void)
            • (event): void
            • Parameters

              • event: Event | Error

              Returns void

      • media: HTMLAudioElement | HTMLVideoElement

    Returns MediaModule

    Return value is for method chain.

  • This method starts media from designated time.

    Parameters

    • Optionalposition: number

      This argument is time that media is started at. The default value is 0.

    • OptionalerrorCallback: ((error: Error) => void)

      This argument is invoked on failure.

        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns MediaModule

    Return value is for method chain.

  • This method stops media.

    Parameters

    • OptionalsuccessCallback: (() => void)

      This argument is invoked on success.

        • (): void
        • Returns void

    • OptionalerrorCallback: ((error: Error) => void)

      This argument is invoked on failure.

        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns MediaModule

    Return value is for method chain.