Angular Audio Player
A library for loading playing audio using HTML 5 audio specifically for Angular 7.
(https://vmudigal.github.io/ngx-audio-player/)
Table of contents
Demo
Basic Player
A simple, clean, responsive player for playing single audio with or without title.
Advanced Player
A simple, clean, responsive player for playing multiple audios with playlist support.
Working Demo
Installation
ngx-audio-player
is available via npm and yarn
Using npm:
$ npm install ngx-audio-player --save
Using yarn:
$ yarn add ngx-audio-player
Getting Started
NgxAudioPlayerModule needs Angular Material and FontAwesome 5+.
Make sure you have installed below dependencies with same or higher version than mentioned.
"@angular/material": "^7.2.0"
"@fortawesome/angular-fontawesome": "^0.3.0"
"@fortawesome/fontawesome-svg-core": "^1.2.12"
"@fortawesome/free-solid-svg-icons": "^5.6.3"
Import NgxAudioPlayerModule
in in the root module(AppModule
):
import { NgxAudioPlayerModule } from 'ngx-audio-player';
@NgModule({
imports: [
NgxAudioPlayerModule
]
})
export class AppModule { }
Usage
Material Style Basic Audio Player
HTML
<mat-basic-audio-player [audioUrl]="msbapAudioUrl" [title]="msbapTitle" [displayTitle]="msbapDisplayTitle"></mat-basic-audio-player>
TS
msbapTitle = 'Audio Title';
msbapAudioUrl = 'Link to audio URL';
msbapDisplayTitle = false;
Properties
Name | Description | Type | Default Value |
---|
@Input() title: string; | title to be displayed | optional | none |
@Input() audioUrl: string; | url of the audio | mandatory | none |
@Input() displayTitle = false; | true - if the audio title needs to be displayed | optional | false |
Material Style Advanced Audio Player
HTML
<mat-advanced-audio-player [playlist]="msaapPlaylist" [displayTitle]="msaapDisplayTitle" [displayPlaylist]="msaapDisplayPlayList"></mat-advanced-audio-player>
TS
import { Track } from 'ngx-audio-player';
.
.
msaapDisplayTitle = true;
msaapDisplayPlayList = true;
msaapPlaylist: Track[] = [
{
title: 'Audio One Title',
link: 'Link to Audio One URL'
},
{
title: 'Audio Two Title',
link: 'Link to Audio Two URL'
},
{
title: 'Audio Three Title',
link: 'Link to Audio Three URL'
},
];
Properties
Name | Description | Type | Default Value |
---|
@Input() playlist: Track[]; | playlist containing array of title and link | mandatory | None |
@Input() displayTitle: true; | false - if the audio title needs to be hidden | optional | true |
@Input() displayPlaylist: true; | false - if the playlist needs to be hidden | optional | true |
Versioning
ngx-audio-player will be maintained under the Semantic Versioning guidelines.
Releases will be numbered with the following format:
<major>.<minor>.<patch>
For more information on SemVer, please visit http://semver.org.
Developer
License
The MIT License (MIT)
Donate
If you like my work you can buy me a :beer: or :pizza: