npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ipodjs

v1.0.3

Published

A javascript iPod player

Downloads

1

Readme

iPodJS

alt text

A Javascript iPod with no dependencies, have fun with it!

Demo

See the iPod in action here: http://demos.duhnnie.net/ipod/

Usage

Requirements

Either for running the demo on your machine or generate the distributable files (for use iPodJS on your own project) you will need:

  • A modern mobile/desktop web browser. iPodJS also runs on older browsers, but in some cases it will be necessary some polyfills (the ones that were excluded from the project in order to keep the code clean). More info in the Compatibility and Known Issues sections below.

  • Node.JS and NPM must be installed on the machine that will build the demo (or the distributable files).

Installation

$ npm install --save ipodjs

Using iPodJS as a module:

You can use iPodJS as an ES6, CommonJS or AMD module.

import iPodJS from 'ipodjs'; // or: const iPodJS = require('ipodjs');
import 'ipodjs/dist/ipodjs.css';

const ipod = iPodJS.create({
  skipTrackOnError: true,
  timeBeforeSkip: 5000,
  playlists: [
    {
      name: "Playlist #1",
      tracks: [
        {
          artist: "Autolux",
          title: "Change My Head",
          album: "PUSSY'S DEAD",
          artwork: "img/autolux.jpg",
          audio: "audio/change_my_head.mp3"
        },
        {
          artist: "Grouplove",
          title: "Borderlines and Aliens",
          album: "Spreading Rumors",
          artwork: "img/grouplove.jpg",
          audio: "audio/borderlines.mp3"
        }
      ]
    },
    {
      name: "Playlist #2",
      tracks: [
        {
          artist: "NOFX",
          title: "Linoleum",
          album: "Punk in Drublic",
          artwork: "img/nofx.jpg",
          audio: "audio/linoleum.mp3"
        },
        {
          artist: "Radiohead",
          title: "Airbag",
          album: "OK Computer",
          artwork: "img/radiohead.jpg",
          audio: "audio/airbag.mp3"
        }
      ]
    }
  ]
});

document.body.appendChild(ipod.getHTML());

Using iPodJS directly in HTML

There are some issues in some browsers due the lack of some browser ES6 implemented functions (like Array.from()). For more info about it read the Compatibility and Known Issues sections below.

Usage Example:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <link rel="stylesheet" href="css/ipodjs.css"/>
    <script src="js/ipod.js"></script>
    <script>
      document.addEventListener('DOMContentLoaded', () => {

        const ipod = iPodJS.create({
          skipTrackOnError: true,
          timeBeforeSkip: 5000,
          playlists: [
            {
              name: "Playlist #1",
              tracks: [
                {
                  artist: "Autolux",
                  title: "Change My Head",
                  album: "PUSSY'S DEAD",
                  artwork: "img/autolux.jpg",
                  audio: "audio/change_my_head.mp3"
                },
                {
                  artist: "Grouplove",
                  title: "Borderlines and Aliens",
                  album: "Spreading Rumors",
                  artwork: "img/grouplove.jpg",
                  audio: "audio/borderlines.mp3"
                }
              ]
            },
            {
              name: "Playlist #2",
              tracks: [
                {
                  artist: "NOFX",
                  title: "Linoleum",
                  album: "Punk in Drublic",
                  artwork: "img/nofx.jpg",
                  audio: "audio/linoleum.mp3"
                },
                {
                  artist: "Radiohead",
                  title: "Airbag",
                  album: "OK Computer",
                  artwork: "img/radiohead.jpg",
                  audio: "audio/airbag.mp3"
                }
              ]
            }
          ]
        });

        document.body.appendChild(ipod.getHTML());
      });
    </script>
    <title>My iPod</title>
  </head>
  <body></body>
</html>

Compatibility

Since iPodJS is built using Babel, it is compatible with modern browsers and older ones. However, to keep the project code clean, some browser-core function polyfills were not included on the distributable files. So, in production polyfills for some unimplemented browser functions must be applied (Babel).

Known issues

For Microsoft IE11/Edge it is necessary to apply some polyfills to solve some issues:

  • Edge doesn't have a promise-like implementation of the Audio.play() method. A dirty polyfill is being used ONLY for the demo using the npm run start command. For production the polyfill must be applied manually or by using some tool (Babel), since the distribuitable code doesn't include the browser-function polyfills.
// This is a polyfill to allow a good demo in IE/non-Chromium Edge, since they not have a promise-like implementation
//on Audio object, in production use some pollyfill package. Different versions for this polyfill can be used.
Audio.prototype.play =  (function () {
    const originalFn = Audio.prototype.play;

    return function () {
        let resp,
            error;

        try {
            resp = originalFn.apply(this, arguments);
        } catch (e) {
            error = true;
        }
        
        if (resp && resp.catch) {
            return resp;
        } else {
            return {
                catch: function (fn) {
                    if (error) {
                        fn(error || {});    
                    }
                }
            };
        }
    };
}) ();
  • IE11 has issues with Array.from() method, it needs to be polyfilled to make the iPodJS work.

Happy listening!