open-index/open-npm huggingface dataset:
npm package: @mistweaverco/cheza.js
Description: Customizable 📦, extensible ⚡ and small **(4kb)** HTML5 Videoplayer 📼.
Latest version: 1.0.3

# cheza.js

Customizable 📦, extensible ⚡ and small **(4kb)** HTML5 Videoplayer 📼.

Cheza is [swahili][cheza-swahili] and means **play**.

## Core features

 - Easily skinnable
 - Support for [DASH][dash] via [dash.js][dashjs] ([example][dashjs-example])
 - Support for [HLS][hls] via [hls.js][hlsjs] ([example][hlsjs-example])
 - Support for [subtitles and captions][subtitles-captions]
 - Support for [Google IMA][google-ima] via [ima plugin](https://github.com/mistweaverco/cheza.js/packages/ima-plugin)
 - Support for video-recommendations via [recommendation plugin](https://github.com/mistweaverco/cheza.js/packages/recommendation-plugin)
 - Support for seek preview via thumbnails or sprites.

[cheza-swahili]: https://en.wikipedia.org/wiki/Swahili_language
[dash]: https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP
[dashjs]: https://github.com/Dash-Industry-Forum/dash.js
[dashjs-example]: https://github.com/mistweaverco/cheza.js/blob/main/packages/cheza.js/src/dev.ts#L12-L16
[hls]: https://en.wikipedia.org/wiki/HTTP_Live_Streaming
[hlsjs]: https://github.com/video-dev/hls.js
[hlsjs-example]: https://github.com/mistweaverco/cheza.js/blob/main/packages/cheza.js/src/dev.ts#L17-L25
[subtitles-captions]: https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Adding_captions_and_subtitles_to_HTML5_video
[google-ima]: https://developers.google.com/interactive-media-ads
npm package: @mistweaverco/cheza.js-ima-plugin
Description: Cheza.js Google IMA Plugin ==========================
Latest version: 1.0.9

Cheza.js Google IMA Plugin
==========================

## Example usage

Install node packages via `npm`

```sh
npm i @mistweaverco/cheza.js @mistweaverco/cheza.js-ima-plugin
```

or `yarn`

```sh
yarn add @mistweaverco/cheza.js @mistweaverco/cheza.js-ima-plugin
```

`index.html`

```html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>cheza.js IMA plugin</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <style>
    body {
      background-color: #1ffe87;
    }
    .container {
      margin: 0 auto;
      width: 100%;
      max-width: 640px;
      height: 100%;
    }
    h1 {
      text-align: center;
      color: #fff;
      font-size: 2em;
      padding: 1em;
      text-shadow: 0 0 10px rgba(0,0,0,0.5);
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>cheza.js Videoplayer IMA plugin</h1>
    <video id="video" crossorigin controls playsinline preload="metadata"
      data-ima-ad-tag-url="https://mwcdn.co/vast-demos/creative-1of3.xml"
      poster="https://mwcdn.co/demo-videos/View_From_A_Blue_Moon_Trailer-HD.jpg"
    >
      <source src="https://mwcdn.co/demo-videos/View_From_A_Blue_Moon_Trailer-576p.mp4" type="video/mp4" />
    </video>
  </div>
  <script src="app.js"></script>
</body>
</html>
```

`app.ts`

```typescript
import { Cheza } from '@mistweaverco/cheza.js'
import '@mistweaverco/cheza.js/dist/style.css'
import { ChezaIMAPlugin } from '@mistweaverco/cheza.js-ima-plugin'
import '@mistweaverco/cheza.js-ima-plugin/dist/style.css'

Cheza.registerPlugin(ChezaIMAPlugin)

const video = document.querySelector('video') as HTMLVideoELement
const cheza = new Cheza(video)

const pluginOpts: typeof ChezaIMAPlugin.Opts = {
  locale: 'de',
  maxRedirects: 10,
  loadVideoTimeout: -1,
  adLabelTime: 'Werbung endet in {{secondsRemaining}} Sekunden',
  adLabelNTime: 'Werbung {{adPosition}} von {{totalAds}} endet in {{secondsRemaining}}s'
}

cheza.addPlugin(ChezaIMAPlugin.Name, pluginOpts)
```
npm package: @mistweaverco/cheza.js-recommendation-plugin
Description: Cheza.js Recommendation Plugin ==============================
Latest version: 1.0.1

Cheza.js Recommendation Plugin
==============================

## Example usage

Install node packages via `npm`

```sh
npm i @mistweaverco/cheza.js @mistweaverco/cheza.js-recommendation-plugin
```

or `yarn`

```sh
yarn add @mistweaverco/cheza.js @mistweaverco/cheza.js-recommendation-plugin
```

`index.html`

```html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>cheza.js recommendation plugin</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <style>
    body {
      background-color: #1ffe87;
    }
    .container {
      margin: 0 auto;
      width: 100%;
      max-width: 640px;
      height: 100%;
    }
    h1 {
      text-align: center;
      color: #fff;
      font-size: 2em;
      padding: 1em;
      text-shadow: 0 0 10px rgba(0,0,0,0.5);
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>cheza.js Videoplayer Recommendation plugin</h1>
    <video id="video" crossorigin playsinline controls preload="metadata"
      data-recommendation-data-url="https://mwcdn.co/cheza.js-recommendation-plugin-example-data.json"
      poster="https://mwcdn.co/demo-videos/View_From_A_Blue_Moon_Trailer-HD.jpg"
    >
      <source src="https://mwcdn.co/demo-videos/View_From_A_Blue_Moon_Trailer-576p.mp4" type="video/mp4" />
    </video>
  </div>
  <script src="app.js"></script>
</body>
</html>
```

`app.ts`

```typescript
import { Cheza } from '@mistweaverco/cheza.js'
import '@mistweaverco/cheza.js/dist/style.css'
import { ChezaRecommendationPlugin } from '@mistweaverco/cheza.js-recommendation-plugin'
import '@mistweaverco/cheza.js-recommendation-plugin/dist/style.css'
import type { ChezaRecommendationDataItem } from '@mistweaverco/cheza.js-recommendation-plugin'

interface RecommendationData extends ChezaRecommendationDataItem {
  endpoint: string
  src: string
}

Cheza.registerPlugin(ChezaRecommendationPlugin)

const video = document.querySelector('video') as HTMLVideoElement
const cheza = new Cheza(video)

const setSrcAndPlay = (src: string): void => {
  video.src = src
  void video.play()
}

cheza.addPlugin(ChezaRecommendationPlugin.Name, {
  debug: true,
  nextVideoLabel: 'Nächstes Video',
  countdownPauseLabel: 'anhalten',
  countdownDuration: 10,
  onTileClick: (index: number, tileData: RecommendationData) => {
    console.log('onTileClick', index, tileData)
    video.dataset.recommendationDataUrl = tileData.endpoint
    video.setAttribute('poster', tileData.image_large)
    setSrcAndPlay(tileData.src)
  },
  onCountdownOver: (tileData: RecommendationData) => {
    video.dataset.recommendationDataUrl = tileData.endpoint
    video.setAttribute('poster', tileData.image_large)
    setSrcAndPlay(tileData.src)
  },
  onBeforeReplayClick: () => {
    console.log('onBeforeReplayClick')
  }
})
```