Coder Social home page Coder Social logo

js-mixed-audio-player's Introduction

JavaScript Raw/Mixed (Flat/Mix) audio sample player

A simple implementation of a Play/Pause action for a double-version music samples buttons (raw and mixed, or flat and mix). The main purpose is to let the web client easily play samples and toggle between listening the different versions while the two tracks stay in sync (and stop playing other groups).

Supports multiple track groups out of the box.

Depends on 3rd-party Howler JS library.

Demo

Here you find a live working demo web page with two different title tracks and relative flat/mix versions.

Install

Add:

<script defer src="js/howler.core.min-v2.2.0.js"></script>
<script defer src="js/player.js"></script>

at the end of the HTML <body> tag, your media files in samples/ folder and the js/ folder to your web server (or CDN service).

All the JavaScript files under js/ are transpiled with Babel for better browser support. If you want you can generate new ones with Babel too:

npm install  # installs Babel dependencies
npm run build

Usage

The main JS file when executed will:

  • search the DOM for HTML <button> tags with ids named like ${track-title}-flat and ${track-title}-mix, the titles should match media file names in samples/
  • load /samples/${track-title}-flat.webm and /samples/${track-title}-mix.webm plus /samples/${track-title}-flat.mp3 and ${track-title}-mix.mp3 if available (it will fall back to mp3 for Safari and old browsers like IE that don't support webm format)
  • attach play/pause behavior to onclick events of every <button> tag with id ${track-title}-flat and ${track-title}-mix

Refer to index.html, player.js and samples/ folder for the current demo values.

js-mixed-audio-player's People

Contributors

dependabot[bot] avatar shaftoe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.