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

solid-plyr-nodash

v1.0.10

Published

A simple HTML5, YouTube and Vimeo player (Plyr) for SolidJS

Downloads

10

Readme

solid-plyr-nodash

(solid-plyr FORK WITHOUT DASHJS DEPENDENCY)

A simple HTML5, YouTube and Vimeo player (Plyr) for SolidJS

NPM npm bundle size (scoped) npm bundle size (scoped version) Libraries.io dependency status for latest release, scoped npm package NPM

Table of Contents

Installation

This library is available through the npm registry.

NPM

$ npm -i solid-plyr

Yarn

$ yarn add solid-plyr

Setup

Start using it by importing the library first.

CommonJS

const SolidPlyr = require('solid-plyr');

or

ES6

import { SolidPlyr } from 'solid-plyr';

The SolidPlyr component requires the following CSS for styling:

Using link tags

<link href="https://unpkg.com/[email protected]/dist/esm/index.css.map" rel="stylesheet">

Using import

import 'solid-plyr/dist/esm/index.css.map';

Usage

Video playback using Solid Plyr Player

import { SolidPlyr } from 'solid-plyr';

const SOURCE = {
  type: 'video',
  sources: [
    {
      src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4',
      type: 'video/mp4',
      size: 720,
    },
    {
      src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1080p.mp4',
      type: 'video/mp4',
      size: 1080,
    }
  ]
}

const OPTIONS = {
  autoplay: true,
  muted: true,
}

export default function Player() {
  return (
    <SolidPlyr source={SOURCE} options={OPTIONS} />
  );
}

Uncontrolled Solid Plyr Player

import { UncontrolledSolidPlyr, createPlyr } from 'solid-plyr';
import { createEffect } from 'solid-js';

const SOURCE = {
  // ...
}

const OPTIONS = {
  // ...
}

export default function Player() {
  const [ref, setRef] = createPlyr({ 
    source: SOURCE,
    options: OPTIONS,
  });

  createEffect(() => {
    const player = ref()?.plyr;

    if (player) {
      player.on('timeupdate', (event) => {
        // Log current time while playing the playback
        console.log(event.detail.plyr.currentTime);
      });
    }
  })

  return (
    <UncontrolledSolidPlyr ref={setRef} />
  );
}

Play YouTube Videos using Solid Plyr

import { SolidPlyr } from 'solid-plyr';

const SOURCE = {
  type: 'video',
  sources: [
    {
      src: 'yWtFb9LJs3o',
      provider: 'youtube'
    }
  ]
}

const OPTIONS = {
  // ...
}

export default function Player() {
  return (
    <SolidPlyr source={SOURCE} options={OPTIONS} />
  );
}

Play Vimeo Videos using Solid Plyr

import { SolidPlyr } from 'solid-plyr';

const SOURCE = {
  type: 'video',
  sources: [
    {
      src: 'https://vimeo.com/533559247',
      provider: 'vimeo'
    }
  ]
}

const OPTIONS = {
  // ...
}

export default function Player() {
  return (
    <SolidPlyr source={SOURCE} options={OPTIONS} />
  );
}

Video Playback with HLS using Solid Plyr

import { SolidHlsPlyr } from 'solid-plyr';

const SOURCE = {
  type: 'video',
  sources: [
    {
      src:
        'https://bitmovin-a.akamaihd.net/content/playhouse-vr/m3u8s/105560.m3u8',
      type: 'application/x-mpegURL'
    }
  ]
}

const OPTIONS = {
  // ...
}

export default function Player() {
  return (
    <SolidHlsPlyr source={SOURCE} options={OPTIONS} />
  );
}

Uncontrolled Video Playback with HLS using Solid Plyr

import { UncontrolledSolidPlyr, createHlsPlyr } from 'solid-plyr';
import { createEffect } from 'solid-js';

const SOURCE = {
  // ...
}

const OPTIONS = {
  // ...
}

export default function Player() {
  const [ref, setRef] = createHlsPlyr({ 
    source: SOURCE,
    options: OPTIONS,
  });

  createEffect(() => {
    const player = ref()?.plyr;

    if (player) {
      player.on('timeupdate', (event) => {
        // Log current time while playing the playback
        console.log(event.detail.plyr.currentTime);
      });
    }
  })

  return (
    <UncontrolledSolidPlyr ref={setRef} />
  );
}

Video Playback with Dash using Solid Plyr

import { SolidDashPlyr } from 'solid-plyr';

const SOURCE = {
  type: 'video',
  sources: [
    {
      src: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
      type: 'application/dash+xml',
    }
  ]
}

const OPTIONS = {
  // ...
}

export default function Player() {
  return (
    <SolidDashPlyr source={SOURCE} options={OPTIONS} />
  );
}

Uncontrolled Video Playback with Dash using Solid Plyr

import { UncontrolledSolidPlyr, createDashPlyr } from 'solid-plyr';
import { createEffect } from 'solid-js';

const SOURCE = {
  // ...
}

const OPTIONS = {
  // ...
}

export default function Player() {
  const [ref, setRef] = createDashPlyr({ 
    source: SOURCE,
    options: OPTIONS,
  });

  createEffect(() => {
    const player = ref()?.plyr;

    if (player) {
      player.on('timeupdate', (event) => {
        // Log current time while playing the playback
        console.log(event.detail.plyr.currentTime);
      });
    }
  })

  return (
    <UncontrolledSolidPlyr ref={setRef} />
  );
}

Authors

See also the list of contributors who participated in this project.

Changelog

Changelog

License

MIT