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

@bayesgg/bayes-web-player-js

v0.1.7

Published

JavaScript library for Bayes Web Player component

Downloads

200

Readme

Bayes Web Player

What is Bayes Web Player?

Bayes Web Player is a lightweight, feature-rich frontend library that is developed in-house specifically to embed video streams from Bayes TV on your site. Offering an effortless integration, the player is written using TypeScript without any frontend framework restrictions and will be made available as an NPM package as well as via CDN. For more information refer to official documentation here.

Features

Playback Features

  • Autoplay ON/OFF as required.
  • Detachable player.
  • Comprehensive API for stream playback control, volume control, UI control etc.

User Interface

  • Fullscreen.
  • Volume controls.
  • Custom error message.
  • Custom styling.
  • Thumbnail.
  • Watermarking.

Integration

Installation

You can install the library and the default stylesheets for the Bayes Web Player via CDN and as an NPM package.

npm i --save @bayesgg/bayes-web-player-js

Usage

The Bayes Web Player offers an easy to integrate interface which can be either imported (NPM) or referred to via the global instance. You can find minimal examples given below.

JS integration via CDN

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <!-- CDN import for the minified JS files of the Bayes Web Player -->
    <script src="bwp.js" crossorigin></script>
    <!-- CDN import for the minified stylesheet of the Bayes Web Player -->
    <link rel="stylesheet" href="css/bwp.css" />
    <script>
      const player = new bwp.Player(
        /**
         *  Playlist URL fetched via Bayes TV
         * */
        "insert-playlist-url-here",
        /**
         *  Container ID where the player will be embedded
         * */
        "root",
        /**
         * Options for the player to be initialized. You can find a comprehensive
         * list of available options provided later in the documentation
         **/
        {
          autoplay: true,
        }
      );
      // Initialise and play the video.
      player.init();
      player.play();
    </script>
    <title>Bayes Web Player Demo! :)</title>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

React Integration via NPM

import { useEffect, useRef } from "react";
import BayesWebPlayer from "@bayesgg/bayes-web-player-js";

/**
 * Import the default stylesheet from Bayes Web Player
 */
import "@bayesgg/bayes-web-player-js/dist/css/bwp.css";

function Stream() {
  const ref = useRef();

  useEffect(() => {
    /**
     * Instantiate player with the container ref
     */
    const player = new BayesWebPlayer(
      /**
       * Playlist URL fetched via Bayes TV
       */
      "insert-playlist-url-here",
      ref.current,
      {
        autoplay: true,
        muted: true,
      }
    );
    player.init();
    player.play();

    /**
     * Make sure the player is destroyed on component unmount
     */
    return () => {
      player.destroy();
    };
  }, []);

  return <div ref={ref} />;
}

export default Stream;