SoundPlayer service for playing a sound from a provided URL.

SoundPlayer

const soundUrl = 'https://example.com/sound.mp3';
const soundPlayer = new SoundPlayer();
soundPlayer.playSound({ soundUrl });
  • soundUrl: URL to the sound file that will be played.
  • playSound: Initiates the audio playback.
  • ngOnInit: Automatically triggers sound playback if soundUrl is set.

Contains the URL of the sound to play.

  • No return; sound is played asynchronously.

Implements

  • OnInit

Constructors

Methods

Properties

Constructors

Methods

  • A callback method that is invoked immediately after the default change detector has checked the directive's data-bound properties for the first time, and before any of the view or content children have been checked. It is invoked only once when the directive is instantiated.

    Returns void

Properties

soundUrl: undefined | string