@theracerx/custom-radio-component

0.0.9 • Public • Published

CUSTOM-RADIO-COMPONENT

This component was made to be an offline radio player with randomize play. Create your own radio station with commercials, blurbs, and talks.

BASIC SETUP

add "radio-player" element in your HTML

ready your audio files array in this format:

    
        audArray = [
            {
                intro:string | string[]
                music:string | string[]
                sequence?:string | any[]
                outro?:string | string[]
            }
        ]
    

load the audios

    
        let radio = document.getElementsByTagName("radio-player")[0]
        radio.loadStations(stations)
    

SETUP w/ EVENTS

ready your events array in this format:

    
        radioEvents = {
            onready:()=>{},
            onwait:()=>{},
            onpause:()=>{},
            onend:()=>{},
            onplay:(e)=>{},
            ontimeupdate:(e)=>{},
        }
    

load the audios and events

    
        let radio = document.getElementsByTagName("radio-player")[0]
        radio.loadStations(stations,events)
    

SETUP w/ audio to play only with specific filter

let's say you only want "sample.mp3" to play with filter "christmas"

you may use "sample.mp3?cond=christmas"

and add "christmas" to filter array:

    
        let radio = document.getElementsByTagName("radio-player")[0]
        radio.filter = ["christmas"]
    

SETUP w/ audio with adjusted gain

you may use sample.mp3?gain=3.232

you may use a built in normalizeFinder index.html in @theracerx/custom-audionormalizer-module located in your node_modules

SETUP Custom Buttons

you may add custom buttons by using elements with the following className inside the radio-player element

  • "nextStation" (input recommended)
  • "prevStation" (input recommended)
  • "stationName" (h3 or p recommended)
  • "stationVolume" (input type="range" recommended)
  • "muteStation" (input recommended)

Readme

Keywords

none

Package Sidebar

Install

npm i @theracerx/custom-radio-component

Weekly Downloads

474

Version

0.0.9

License

none

Unpacked Size

96.8 kB

Total Files

7

Last publish

Collaborators

  • theracerx