Giter Site home page Giter Site logo

picobel's Introduction

Picobel.js

v3.0.2

Node.js CI

Picobel.js (pronounced peek-o-bell, as in decibel) is a lightweight dependency-free JavaScript tool that converts html audio tags into styleable markup.

Documentation can be found at picobel.tomhazledine.com.

Quick Start

JavaScript

Picobel is a JavaScript utility, so you'll need to include the script somehow. The recommended method is to install from npm but you can also download the script bundle and include it directly.

Install JS from npm

yarn add picobel (or npm install picobel) will install Picobel in your project and add Picobel into the dependencies section of your package.json file.

// Include Picobel in your project:
import picobel from 'picobel';

// Initialise picobel:
picobel();

// ...or initialise picobel with your chosen options:
picobel({ theme: 'default' });

Install JS manually

If you prefer not to use npm, you can include the Picobel build file directly.

<!-- Load Picobel -->
<script type='text/javascript' src='picobel.min.js'></script>
<script type='text/javascript'>
    picobel();
</script>

CSS (optional)

Picobel's primary aim is to provide structured markup for styling audio players. If you're commited to writing all your own CSS then you do not need to include any of the Picobel stylesheets (although feel free to use the pre-made themes as inspiration or as a jumping-off point for writing your own styles).

But you don't have to write your own CSS. Picobel comes with several "pre made" themes that you can include.

Adding a theme is a two-step process:

  1. Declare the theme option when initialising Picobel.
  2. Be sure to inclde the relevant stylesheet in your project.
picobel({ theme: 'default' });

You can find the CSS files for each theme in the /src/css directory of the GitHub repo, along with minified production-ready versions here. The filename convention is picobel.THEME_NAME.css.

picobel's People

Contributors

bramchi avatar rdancer avatar tomhazledine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

picobel's Issues

Browser-style themes

Create themes that emulate the default browser styles. So if you want to see Chrome's default player on all other browsers, you can!

Mute Button

Add a discrete "mute" button to the players. Also, add volume-status class to player-wrapper.

CSS file naming & X-Content-Type-Options: nosniff

Including the CSS files like "player.default.css" can cause a HTTP header error by the X-Content-Type-Options directive.

The parameter Nosniff prevents CSS files from loading if the MIME type is not "text/css". Some servers might interpret for the file "player.default.css" as file extension "default", not "css".

My workaround was to rename the CSS file (e.g. into "player_default.css")

Make available on NPM

It would be helpful if this was available on NPM so it can be managed like other dependencies.

License

Add MIT license (or similar) to confirm that this is open source.

Song duration text is cut off for track lengths longer than an hour

If you load an audio stream for a track that's longer than an hour, for example a podcast that is 1:37:14 long, then the duration is cut off from the song duration field and the current progress field. I'm using the "soundcloud" theme, here's is a screenshot of the issue:
screen shot 2018-03-17 at 7 48 25 pm

Options

Make features like "duration" and "progress" optional. Their absence should not make the code fail.

Demos

Add demos to show this thing in action and prove that it works.

Docs for title/artist

Describe how to include "artist" and "track title" information.
title="track title" data-artist="artist"

Is <source> in <audio> not supported?

Hello.

I am trying out this plugin. I have HTML like this:

<audio>
	<source src="foo/bar.ogg" type="audio/ogg" />
	<source src="foo/bar.mp3" type="audio/mpeg" />
</audio>

When I press play the console says:
Uncaught (in promise) DOMException: The element has no supported sources.

Seems that I can only use <audio src="...">? It would be nice if <source> in <audio> is supported.

songPaused class

Currently not handling the songPaused class. Don't forget the _addClass(this,'songPaused'); and _removeClass(this,'songPaused'); in _playPauseAudio().

Does adding this cause a play/pause icon issue when songs don't load?

Demo Files

Source some free-to-use audio files to use as demos.

Options

Customisable options to be included when function is initialised.

  • class prefix
  • theme class

dB VU Meter

Test feasibility of adding a dBFS volume meter to the player.

  • Will this adversely affect performance (or file size)?
  • Would it be hard to maintain?
  • Would it be hard to style for all the players?
  • Could it be an optional extra (declared in the options)?
  • If effective, this would open the door for an optional EQ visualisation...

Picobel stuck in loading state before pressing Play on mobile devices

This is demonstrable from the Codepen theme demos. When a page using Picobel first loads on an iPhone (possibly also on Android?) the Picobel UI stays in the Loading state (and displays "File 1" as the title, depending on the theme) until the user taps the Play button. Everything works great after that.

CoC

Write a Code of Conduct for contributors. (or copy a good one from someone else...)

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.