DEV Community

Yizack Rangel
Yizack Rangel

Posted on • Edited on

5 3

Embeddable Music Player

Embed a simple HTML music player from local audio on your website using MediaElement.js and Color Thief. Inspired by Spotify's embed player.

(Fullscreen Live Demo)

Recommended requeriments

  • Mp3 audio source.
  • Square image.

Configuration

  • Clone or download my repository (Yizack/embeddable-music-player).
  • Edit the file /player/song.html

    • Paste your song name in {SONG-NAME} for the title of your page.
    • Paste your audio file URL in {MP3-SOURCE} for the audio that will be played when you press the play button.
    • Paste your image URL in {ARTWORK} for the image that will be displayed.
    • You can also rename or create a new html file to have different players, for example for the live demo I have /player/just-stay.html.
  • Color Thief will detect automatically the dominant color of your song image for your player.

  • Use the code below, replace {YOUR-HTML-PLAYER} with your HTML filename inside the folder /player and paste it on your site where you want your audio player to appear.

  <iframe src="/player/{YOUR-HTML-PLAYER}.html" width="300" height="385"></iframe>
Enter fullscreen mode Exit fullscreen mode

(Example of use on a website using iframes: Dimatis Website)
Live Demo

  • Thanks to the responsiveness you can play with the width and height as you want.
  <iframe src="/player/{YOUR-HTML-PLAYER}.html" width="100%" height="450"></iframe>
Enter fullscreen mode Exit fullscreen mode

(Another example of use on a website using iframes: Dimatis - Fly Again)
Live Demo

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more