An audio player made with the SoundManager2 API for Angular (ngx Angular v6+) to play sound files.
SoundManager 2 brings reliable cross-platform audio to JavaScript.
Requirements: Angular 6.0+
* Simple to use (use of directives)
* Playlist support
* Soundcloud support
* Easy to understand and extend API
$ npm i ngx-soundmanager2 --save
$ npm i soundmanager2 --save
Should work out of the box with webpack, respectively angular-cli. All you need to do is to include NgxSoundmanager2Module
:
Add soundmanager2 to the .angular-cli.json scripts array:
"scripts": [
"../node_modules/soundmanager2/script/soundmanager2-jsmin.js"
],
import { NgxSoundmanager2Module } from 'ngx-soundmanager2';
@NgModule({
imports: [NgxSoundmanager2Module.forRoot()],
...
})
class AppModule {}
// tools/config/project.ts
...
// Add packages (e.g. ngx-soundmanager2)
let additionalPackages: ExtendPackages[] = [{
name: 'ngx-soundmanager2',
path: 'node_modules/ngx-soundmanager2/ngx-soundmanager2.ts'
}];
this.addPackagesBundles(additionalPackages);
// Add `NPM` third-party libraries to be injected/bundled.
this.NPM_DEPENDENCIES = [
...this.NPM_DEPENDENCIES,
{ src: 'soundmanager2/script/soundmanager2-jsmin.js', inject: 'libs' },
];
...
Clone the ngx-soundmanager2 repository.
$ cd ngx-soundmanager2
$ cd demo
$ npm install
$ ng serve
Open demo at http://localhost:4200/
* 100% Flash-free MP3 + MP4/AAC where supported
* Compatible with Apple iPad 3.2, iPhone/iOS 4 and newer
* Fallback to Flash for MP3/MP4 support, as needed
* SM2 API is transparent; HTML5/flash switching handled internally
* HTML5 API support approximates Flash 8 API features
* Some other formats (WAV/OGG) supported via HTML5, depending on browser
* See "useHTML5Audio" property for implementation details
Credit goes to:
Scott Schiller for his excellent SoundManager2.
Parminder Klair for his AngularJS (v1.x) angular-soundmanager2 that this project is based on.
Licensed under the MIT license