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

dacast-player

v0.0.8

Published

Unofficial dacast player based on video.js@8

Downloads

21

Readme

dacast-player

A lightweight, up to date and npm available Dacast player.

Why?

Dacast's current SDK doesn't provide many of the tools we're used to when working with modern SDKs, such as:

  • TypeScript typings
  • npm package
  • version pinning

Apart from that, the official sdk is bloated, unzipped (it's +600kB in size), has outdated video player versions (video.js 5) and defaults to theo player (which requires a license to work correctly). The developer experience with their SDK was really bad, and our console was filled with debugging and error logs from them (in production!!!!), so we decided to develop this, a simple and developer-friendly way to implement a Dacast player.

Installation

yarn
yarn add dacast-player

npm
npm install --save dacast-player

Usage

<video controls id="dacastplayer"></video>
import { DacastPlayer } from 'dacast-player'
import 'video.js/dist/video-js.css'
const player = new DacastPlayer({
  id: 'dacastplayer',
  dacastOptions: {
    contentId: 'your-dacast-content-id',
    live: false,
  },
  videoJsOptions: {},
  verbose: false,
  on: {
    error(err) {
      console.log('error: ', err)
    },
    canplay() {
      console.log('can play')
    },
    play() {
      console.log('playing')
    },
    pause() {
      console.log('paused')
    },
    ended() {
      console.log('ended')
    },
  },
})
await player.mount()

API Docs

interface PlayerEvents {
  canplay?: () => unknown // Triggered when the content is loaded and ready to play
  play?: () => unknown // Triggers when playing
  pause?: () => unknown // Triggers when paused
  ended?: () => unknown // Triggers on video end
}

interface DacastPlayerEvents extends PlayerEvents {
  error?: (err: MediaError) => unknown // Triggers on error
}

/**
 * This is the options object you'll pass to the DacastPlayer constructor.
 */
interface DacastPlayerOptions {
  id: string | Element // Element or element id to mount videojs
  videoJsOptions?: any // Video.js options
  dacastOptions?: {
    contentId?: string // Content id to play
    live?: boolean // Whether you want to force the live ui or not
  }
  verbose?: boolean // Activates logging for debugging purposes
  on?: DacastPlayerEvents
}

Methods

| Method | Description | | -------------------------- | -------------------------------------------------- | | mount(): Promise<void> | Mounts the player | | dispose(): void | Disposes the player | | isRebroadcast(): boolean | Returns whether the stream is a rebroadcast or not |

Properties

| Property | Description | | ------------------------ | ------------------------------------------------------------------------------------------ | | player: videojs.Player | Video.js instance you can use to manipulate the player or listen to native video.js events |