AmplitudeJS

repository·master·Indexed 26 days ago

https://github.com/serversideup/amplitudejs

A lightweight, zero-dependency JavaScript library for creating highly customizable HTML5 media players. AmplitudeJS allows developers to design their own media controls using CSS and HTML attributes instead of relying on default browser interfaces. Key features include playlist management (next, previous, shuffle), waveform generation via the Web Audio API, live streaming support, and automatic mobile device detection for touch events.

Tokens
15.6K
Snippets
53
Records
117
Agent score
88%

What's inside amplitudejs

  1. Overview of AmplitudeJS

    master
    AmplitudeJS is a lightweight, zero-dependency JavaScript library used to control the design of media controls directly within your webpage rather than relying on default browser controls. It allows for 100% customizable player elements, supports multiple playlists, autogenerates waveforms/visualizations via the Web Audio API, and supports live streaming.
  2. Overview of Amplitude.js

    master

    Amplitude.js is a library that allows designers to fully control the look and feel of an HTML5 audio player using CSS and HTML attributes, bypassing the browser's default playback interface.

    Key capabilities include:

    • Custom Styling: Control player design by applying specific classes and/or attributes to any page elements.
    • Playlist Management: Built-in support for playlist features such as next, previous, and shuffle.
    • Enhanced Metadata: Support for song metadata and audio visualizations.
    • Mobile Support: Automatically detects mobile devices and applies touchstart event listeners instead of click for better responsiveness.
  3. Understand Amplitude FX elements

    master

    Amplitude FX elements are specialized components used to create audio waveforms and visualizations. These elements leverage the Web Audio API to provide advanced fine-tuning capabilities and visual feedback for audio players.

    Browser Support Requirements: Because FX elements rely on the Web Audio API, the user's browser must support it. Most modern browsers support this API. If the browser does not support the Web Audio API, Amplitudejs will gracefully degrade by simply not using the FX features in your player.

  4. Configure volume increment and decrement values

    master

    When using volume increment and decrement buttons, you can specify how much the volume changes per click by using the volume_increment and volume_decrement keys in your Amplitude.init() configuration. These values are treated as percentage adjustments. The default value for both is 5.

    Amplitude.init({
        "songs": [...],
        "volume_increment": 10,
        "volume_decrement": 10
    });
  5. Use AmplitudeJS elements to build your player

    master

    AmplitudeJS uses elements identified by classes prefixed with amplitude- to handle audio playback controls and metadata display.

    • Interactive elements: Elements that trigger events (e.g., play, next).
    • Metadata elements: Elements that are automatically populated with information about the active audio (e.g., album art, song titles).

    Styling Note: Most elements can be any HTML tag and can be styled via their class or specific IDs. However, the album art element must be an <img> tag.