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

@pbjlive/live.js

v0.1.3

Published

PBJ Live Javascript SDK (Currently Docs only)

Downloads

1

Readme

live.js

PBJ Live Javascript SDK (Currently Docs only)

Usage

Import javascript file

<script src="https://js.pbj.live/v1/sdk.js"></script>

This script will expose a global Live class. Initiate the class with your organization api key:

const live = new Live("pk_....")

When the Live class is initiated you will be able to do several things:

  • Render a PBJ Live stream to a HTML element
  • Retrieve information from our APIs

Elements

Embed element

Currently our recommended way to integrate with PBJ Live.

In your html, create a div tag with your preferred naming, we use live-element in these examples.

So in your html, add:

<html>
  <body>
    <!--- Add Live element here ---!>
    <div id="live-element"></div>
    
    <script src="https://js.pbj.live/v1/sdk.js"></script>
    <script type="text/javascript">
      var live = new Live("<Your API Key>");
      
      // Create instance of the iframe embed
      var embedPlayer = live.elements.embed()
       
      // Mount the player to the div#live-element in our html
      embedPlayer.mount("#live-element")
    </script>
  </body>
</html>

In the background, this embed() method will create an iFrame that will injected into your html element, we also offer a lower level solution via the live.elements.video() method.

Video Element

const episode = live.elements.video();

Mount to HTML object

Then mount this element to your HTML element:

const videoElement = live.elements.video({
  episode: id
});

videoElement.mount("#live-video")

Start video

videoElement.start();

Stop video

videoElement.stop();

Remove video element

videoElement.dispose();

Change volume

videoElement.volume(0.5)

A number from 0 to 1

Open full screen programatically

videoElement.openFullscreen()

Close full screen programatically

videoElement.closeFullscreen()

Get episode schedule

live.episodes.schedule()
  .then((episodes) => {
    const = nextEpisode = episodes[0]
 })

Get episodes for show

live.episodes.list({
  show: "..."
})
  .then(...)

Get current organization

live.organizations.current()
live.episodes.schedule()
live.episodes.detail({ id })

live.shows.detail()
live.shows.list()

live.organizations.current()

live.users.login()
live.users.register()

Event changes

live.events.on('episode-status-update', () => ...)

Realtime sockets

Subscribing

Sockets are added to the Live instance through the socket property, subscribing to a specific event can be done by using:

live.sockets.subscribeToEvent(live.sockets.commandTypes.EPISODE_STATUS_UPDATE,(message)=>{
    console.log('EPISODE_STATUS_UPDATE', message)
})

Get Episode Command Types

The different command types that are available can be found here:

 live.sockets.commandTypes