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

self-censor

v1.0.2

Published

A JavaScript library that provides a simple solution for censoring segments of video in the browser. Define different censor tracks based on categories and switch them on-the-fly.

Downloads

1

Readme

SelfCensor.JS

Example | Playground

SelfCensor is a JavaScript library that provides a simple solution for censoring segments of video in the browser. It enables us to define different censor tracks based on age ratings or genres or any other category, and then automatically skip the specified intervals in the video according to the selected track.

With SelfCensor, you can easily add censoring functionality to your video player without the need for any additional plugin or server-side processing. The censoring is performed entirely in the browser, while providing a smooth and uninterrupted viewing experience for the user.

Use Cases

  • Parental Controls: SelfCensor can be used to enable parental controls for video content, allowing parents to restrict their children's access to certain categories of content based on age rating, genre, or other criteria.

  • Online Streaming Platform: SelfCensor can be used by online streaming platforms to provide a more customizable and personalized viewing experience for their users. By providing different censor tracks for a movie, like with subtitles, users get the option to watch different censor versions of the same movie, based on their preference. They can even add their own custom-censored version.

Installation

In Browser:

<script type="module">
  import SelfCensor from "https://cdn.jsdelivr.net/npm/[email protected]/+esm";
</script>

In Node.js environment using NPM:

npm i self-censor

Usage

Link the JSON file with censor data:

<video id="my-video" data-censor="url-of-my-censor-data.json" controls>
  <source src="url-of-my-video.mp4" type="video/mp4" />
</video>

Import the class:

// ESM
import SelfCensor from "self-censor";

// CommonJS
const SelfCensor = require("self-censor");

Instantiate with the id of the target(HTML Video) element:

const censor = new SelfCensor("my-video");

Subscribe to ready event to get the censor track details:

censor.on("ready", ({ detail: { censorTracks, currentTrack } }) =>
  console.dir({ censorTracks, currentTrack })
);

Subscribe to error event to catch and handle the errors thrown from the service:

censor.on("error", ({ detail }) => console.error(detail));

Start the censoring service:

censor.start();

Temporarily pause the censoring:

censor.pause();

Resume a paused service

censor.resume();

Switch censor track if service is active:

censor.switchTrack("track-name");

Stop the censoring service:

censor.stop();

See Example: Source | Playground

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT License