Skip to content

VERTIGOJACK/vertigo-audioplayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vertigo-audioplayer

this is a small, reusable, audio player for javascript, which supports several players in one window.

Audioplayer image

interactive example: https://codepen.io/Sebastian-Nilsson/pen/LYJxPxY

How to use

Download locally and import getAudioPlayerAsync from vertigo-audioplayer.js :

import { getAudioPlayerAsync } from "YOUR_FILEPATH/dist/vertigo-audioplayer.js";

getAudioPlayerAsync takes an audio object as input parameter, and returns a HTML node with prepared functionality:

//create new audio object
let audio = new Audio("myfile.mp3");

//construct audioplayer using new audio object
const audioplayer = await getAudioPlayerAsync(audio);

We can then append the player to view:

//get div from html
const div = document.querySelector("div");

//append player to view
div.appendChild(audioplayer);