ngx-sounds
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ngx-sounds

Angular howler.js wrapper service.

Demo

Getting Started

1. Install packages

npm i howler ngx-sounds

2. Import Module

import { NgxSoundsModule } from 'ngx-sounds';
 
@NgModule({
  declarations: [AppComponent],
  imports: [
    NgxSoundsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}

3. Include the service

 
import { SoundsService } from 'ngx-sounds';
 
export class AppComponent {
 
  constructor(
    private sounds: SoundsService
  ){}
 
  ngOnInit() {
    // Shortcut methods
    this.sounds.play('assets/my-sound.mp3')
      .subscribe(
        () => console.log('sound played!')
      );
 
    this.sounds.volume(0.5)
 
    this.sounds.mute();
 
    // Static accessor
    this.sounds.howler;
 
    // Howl factory
    const howl = this.sounds.howl({
      src: ['assets/my-sound.mp3']
    });
 
    howl.play();
  }
 
}
 

Readme

Keywords

none

Package Sidebar

Install

npm i ngx-sounds

Weekly Downloads

22

Version

1.0.0

License

MIT

Unpacked Size

75.7 kB

Total Files

23

Last publish

Collaborators

  • aitorllj93