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

quicktube

v3.1.2

Published

A lightweight embed video player, with support for YouTube and Vimeo

Downloads

147

Readme

Quicktube npm Build Status Coverage Status

A lightweight embed video player, with support for YouTube and Vimeo. Check out our online demo!

Usage

npm install --save quicktube

Initial setup

Is really simple. Just add the video ID to data-quicktube='{video-id}' and data-quicktube-play='{video-id}' to the play trigger element.

<div class="quicktube" data-quicktube="k6QanQUaDOo">
    <div class="quicktube__video" data-quicktube-video></div>
    <div data-quicktube-play="k6QanQUaDOo" class="quicktube__poster" data-quicktube-poster>
        <!-- Optional poster frame image -->
        <img class="quicktube__poster-image" src="/path/to/image" />
        <button class="quicktube__play quicktube__btn">
            Play
        </button>
    </div>
</div>

Initialise quicktube.

import quicktube from 'quicktube';

document.addEventListener('DOMContentLoaded', () => {
    quicktube.init();
}, false);

:warning: Don't forget to include the necessary CSS, as well as the required polyfills should your environment require it.

API

You can hook to the play and pause events like this:

window.addEventListener('quicktube:play', () => {
    showingItem.style.display = 'block';
}, false);

window.addEventListener('quicktube:pause', () => {
    showingItem.style.display = 'none';
}, false);

Advanced

Usage with CSP (Content Security Policy) headers

Quicktube's code relies on the YouTube and Vimeo APIs (depending on which provider is used), for which origins need to be whitelisted in order to work with CSP.

For YouTube, whitelist the following:

# As script-src:
https://www.youtube.com
https://s.ytimg.com

# As frame-src:
https://www.youtube.com

And for Vimeo:

# As script-src:
https://player.vimeo.com

# As `frame-src:
https://player.vimeo.com

Note that the following are based on origins of the API scripts, and (undocumented) origins loaded by those scripts, as observed on our online demo.

Development

Install

Clone the project on your computer, and install Node. This project also uses nvm.

nvm install
# Then, install all project dependencies.
npm install

Releases

  • Make a new branch for the release of the new version.
  • Update the CHANGELOG.
  • Update the version number in package.json, following semver.
  • Make a PR and squash merge it.
  • Back on master with the PR merged, follow the instructions below.
npm run dist
# Use irish-pub to check the package content. Install w/ npm install -g first.
irish-pub
npm publish
  • Finally, go to GitHub and create a release and a tag for the new version.
  • Done!

Documentation