npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

naudio-player-ng

v0.1.3

Published

Simple Angular audio player

Downloads

5

Readme

NAudioPlayerNg

Simple audio player for angular 2+

Usage

Install

    npm install naudio-player-ng --save

Dependencies

fontawesome-free

in angular.json

    "projects": {
        ...,
        "architect": {
            "build": {
                "styles": [
                    "node_modules/@fortawesome/fontawesome-free/css/all.css",
                    ...
                    ],
                ...

or in index.html

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css"
      integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
Roboto font

in index.html

<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700" rel="stylesheet">

Load module

in *.module.ts

import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {HttpClientModule} from '@angular/common/http';
import {AppComponent} from './app.component';

// import the module
import {NAudioPlayerNgModule} from 'audio-player-ng';

@NgModule({
    declarations: [
        AppComponent,
    ],
    imports: [
        BrowserModule,
        HttpClientModule,
        NAudioPlayerNgModule
    ],
    bootstrap: [AppComponent]
})
export class AppModule {}

Use in the template

in *.component.html

<app-player [options]="options" [info]="details"></app-player>

Configuration

in *.component.ts

properties
  • options: a OptionsPlayer interface for config the player
  • playlist: a Observable of PlaylistData interface for load the playlist
...
import {HttpClient} from "@angular/common/http";
import { Observable } from 'rxjs';
import { OptionsPlayer } from "audio-player-ng/audio-player-ng/classes/interfaces";

...

export class AppComponent {

  options:OptionsPlayer;

  constructor(private http:HttpClient) {
      this.options = {
            width: 300,
            oscFillStyle: 'hsl(290, 45%, 49%)',
            oscStrokeStyle: 'hsl(110, 100%, 49%)'
        };
     
  }
  details={title:'',url:''}
}
Interfaces
/**
 * Options player
 */
export interface OptionsPlayer {

    // width of the player
    width:number;

    // height of the graphics panel, default: 60px
    graphicsHeight?:number;

    // background-color of the oscilloscope panel
    oscFillStyle:string;

    // front color of the oscilloscope panel
    oscStrokeStyle:string;

    // background-color of the chartbar panel, default: "oscFillStyle"
    freqFillStyle?:string;

    // front color of the chartbar panel, default: "oscStrokeStyle"
    freqStrokeStyle?:string;

    // number of the of the bars of the chartbar panel, default: 32
    freqBars?:number;

    // the values of playlist position are the flex-direction values:
    // column-reverse (top), row (right), column (bottom), row-reverse (left);
    // default: column (bottom)
    playlistPosition?:string;

    // load the song duration from metadata, it makes a request for song, default: true
    loadDuration?:boolean;
}


/**
 * Song data
 */
export interface SongData {

    // title of the song
    title:string;

    // url of the song
    url:string;

    // group of the song if available
    group?:string;

    // disc of the song if available
    disc?:string;

    // duration of the song, if it is not available can be loaded from "options.loadDuration = true"
    duration?:number;
}

/**
 * Playlist data
 */
export interface PlaylistData {

    // title of the playlist or disc
    title:string;

    // group of the playlist if it is a disc
    group?:string;

    // the songs, array de SongData objects
    songs:SongData[];
}

Styling

... in progress

Css classes for styling the audio player, set the properties with !important

/* ControlsComponent */
.controls-container {
    background:

    // button color
    .nav-control {
        color:
    }

    // volume background color
    .bar-volume {
        background:
    }

    // volume bar color
    .progress-volume {
        background:
    }

    // timer color
    .timer {
        background:
        color:
    }

    // tooltip color
    .tooltip {
    background:
    border-color:
    color:
    }

    // active color
    .active {

    }

}
/* GraphicsComponent */

.oscilloscope {
    background:
    color:

    canvas {
        height:
        width:
    }
}

.frequency {
    background:
    color:

    canvas {
        height:
        width:
    }
}

/* PlayerComponent */


.player-header {
  background:
  color:

  p {
  font-family:
  }
}

.player-container {
    border:

    .active {
        color:
    }

    .progress {
        height:
    }

    .progress-expanded {
        height:
    }

    .playlist-cmp {
        height:
        width:
    }

    .minimize {
        i {
            color:
        }
    }
}

/* PlaylistComponent */

.song-box {
    background:
    color:
}

.selected-song {
    background:
    color:
}

.bar-scroll {
    background:
}


/* ProgressComponent */

.bar-progress {
  background: $background-color-progress;
}

.progress-song {
  background:
}

.progress-tooltip {
    background:
    border-color:
    color:
}

License

See the LICENSE file for license rights and limitations (MIT).