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

@openhpi/xikolo-video-player

v1.2.4

Published

Xikolo Video Player

Downloads

2,768

Readme

Xikolo Video Player

This video player is designed to provide a better user experience when viewing videos in the Xikolo project. It provides features to control basic video playback functions for playing videos hosted by various video providers.

Beyond that there are more features:

  • Dual Stream mode (teacher view and slides) and the ability to resize streams
  • Event API for analytics
  • Theming
  • Control any other function with a custom button, see Toggle Control

Getting Started

  1. Clone this repository
  2. Install dependencies and run the project
npm install
npm start

A demo page will be available at http://localhost:3333. Here you can manually test both the basic functions and the advanced features. This page is automatically reloaded when you save a file with changes.

To run the tests, run:

npm test

Example usage

A basic markup to get started may look like this:

<xm-player>
  <xm-vimeo src="xxx" name="foo-stream"></xm-vimeo>
  <xm-presentation reference="foo-stream" name="single" label="Lecturer and slides (picture-in-picture)"><xm-presentation>
</xm-player>

Video Providers

There is support for videos hosted on Vimeo and Kaltura. The name property must match a reference property of a xm-presentation.

For more configuration, consult the documentation of the xm-vimeo or xm-kaltura component.

Presentation modes

At least one xm-presentation component is required. The reference property must match the name property of a provider. As of now, only one xm-presentation is supported so make sure to add the default mode first in the DOM.

For more configuration, consult the documentation of the xm-presentation component.

Public API

The available methods and events can be found in the player component documentation.

Theming

The video player is designed to support customization for key components. You can override the following variables with your favorite colors or numbers:

  --vp-slider-color
  --vp-gutter-color
  --vp-gutter-width
  --vp-main-color
  --vp-bg-color
  --vp-bg-color-rgb
  --vp-menu-color-rgb
  --vp-control-slider-height

Toggle Control

The video player is capable to control components outside of itself.

To add a toggle you need to add a <xm-toggle-control></xm-toggle-control>-tag.

The <xm-toggle-control> must have a name: string as identifier. The name must be unique.

Important here is, that the markup also contains a slot-Attribute with the same name. A title: string is used for displaying a hover tooltip specified. You also need a nested <svg> working as a symbol displayed in the controls on the bottom of the player.

On click the toggle control will emit an control:changeToggleControlActiveState-Event containing

interface ToggleControlProps {
  name: string;
  title: string;
  active: boolean;
}

Example markup

<xm-player id="player-with-custom-control">
  <xm-toggle-control
    slot="toggleControl"
    name="toggleControl"
    title="Custom Control"
    active
  >
    <svg slot="icon" viewBox="0 0 32 32" role="presentation" focusable="false">
      <path
        d="M0 2h32v4h-32zM0 8h20v4h-20zM0 20h20v4h-20zM0 14h32v4h-32zM0 26h32v4h-32z"
      ></path>
    </svg>
  </xm-toggle-control>
</xm-player>

Example control hook

videoPlayerWithCustomControl.addEventListener(
  'control:changeToggleControlActiveState',
  (event) => {
    if (event.detail.name === 'toggleControl') {
      customControlledText.innerHTML = `The feature is ${
        event.detail.active ? ' active' : ' not active'
      }`;
    }
  },
);

Development

The Xikolo Video Player is built with Stencil JS.

Stencil is a compiler for building Web Components. Think of it as an compile-time tool. At run-time, the video player can be used like any standards-based Web Components.

Naming Components

Components are prefixed with xm-.

Event Naming Conventions

Internal events are prefixed depending on where they are emitted from. E.g. the controls component emits a control:play, the settings-menu a setting:changePlaybackRate. They are intended for internal use, but are also used outside, e.g. for analytics tracking.

Events from the player component itself do not have a name prefix. They are supposed to be only used externally. E.g. cueListChange.