# @mycujoo/mcls-player

> `@mycujoo/mcls-player` uses video.js player internally and exports a few React.js components:

Latest version **1.0.0-rc.8** (published 2023-11-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mycujoo/mcls-player
pnpm add @mycujoo/mcls-player
yarn add @mycujoo/mcls-player
bun add @mycujoo/mcls-player
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-rc.8 |
| Published | 2023-11-24 |
| First published | 2023-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 18 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | adamahom, yneleven, berker93, vikkivi, pvmnt, farzad-mycujoo, mycujoo.tv, radev83, aandrei, pplaatje, oleksiih, antonella.manilla, thecodeassassin, rgalus, mycujoomats, alaandrei |

## Links

- npm: https://www.npmjs.com/package/@mycujoo/mcls-player
- npm.io page: https://npm.io/package/@mycujoo/mcls-player

## Dependencies (18)

- [immer](https://npm.io/package/immer.md) ^9.0.21
- [flv.js](https://npm.io/package/flv.js.md) ^1.6.2
- [video.js](https://npm.io/package/video.js.md) ^8.3.0
- [facepaint](https://npm.io/package/facepaint.md) ^1.2.1
- [js-cookie](https://npm.io/package/js-cookie.md) ^3.0.5
- [youboralib](https://npm.io/package/youboralib.md) ^6.8.44
- [integration](https://npm.io/package/integration.md) ^0.3.1
- [querystring](https://npm.io/package/querystring.md) ^0.2.1
- [videojs-mux](https://npm.io/package/videojs-mux.md) ^4.15.3
- [@emotion/jest](https://npm.io/package/@emotion/jest.md) ^11.11.0
- [videojs-flvjs-es6](https://npm.io/package/videojs-flvjs-es6.md) ^1.0.1
- [videojs-contrib-ads](https://npm.io/package/videojs-contrib-ads.md) 7.3.1
- [videojs-contrib-eme](https://npm.io/package/videojs-contrib-eme.md) ^3.11.1
- [@mycujoo/videojs-ima](https://npm.io/package/@mycujoo/videojs-ima.md) 3.0.0-rc.1
- [youbora-adapter-videojs](https://npm.io/package/youbora-adapter-videojs.md) ^6.8.12
- [@mycujoo/mcls-components-ads](https://npm.io/package/@mycujoo/mcls-components-ads.md) ^1.0.0
- [videojs-contrib-quality-levels](https://npm.io/package/videojs-contrib-quality-levels.md) ^4.0.0
- [@mycujoo/videojs-hls-quality-selector](https://npm.io/package/@mycujoo/videojs-hls-quality-selector.md) 1.1.5-rc.4

## Recent versions

- 1.0.0-rc.8 (latest) — 2023-11-24
- 1.0.0-rc.7 — 2023-11-24
- 1.0.0-rc.6 — 2023-11-24
- 1.0.0-rc.5 — 2023-11-23
- 1.0.0-rc.4 — 2023-10-17
- 1.0.0-rc.3 — 2023-10-17
- 1.0.0-rc.2 — 2023-10-17
- 1.0.0-rc.1 — 2023-10-10
- 1.0.0-rc.0 — 2023-09-15
- 1.0.0-alpha.13 — 2023-09-08
- 1.0.0-alpha.10 — 2023-09-05
- 1.0.0-alpha.9 — 2023-08-30
- 1.0.0-alpha.8 — 2023-07-17
- 1.0.0-alpha.7 — 2023-07-17
- 1.0.0-alpha.6 — 2023-07-14
- … 34 more at https://npm.io/package/@mycujoo/mcls-player/versions

## README

# MCLS Player

`@mycujoo/mcls-player` uses video.js player internally and exports a few React.js components:

* `VideoJS` - bare video.js react component with minimum added functionality
* `VideoFLV` - bare video.js react component that uses flv.js for flash video
* `Player` - video player component that has support for player state and annotations and integrations with some specialized video.js plugin; This Player needs to be in the context of `PlayerStateContext` and `AnnotationsContext` (both available in this package); Useful for when controlling the player state and annotations is needed. Internally uses `VideoJS` component
* `PlayerWithContexts` - Same as `Player` but with the two contexts already provided.
* `EventPlayer` - video player component that plays a specific MCLS event and handles data fetching and the logic for which player screen to display (eg. geoblocking, scheduled events etc.); Needs to be a child of `PlayerStateContext`, `AnnotationsContext` and `EventContext` (from _@mycujoo/mcls-data-providers_)
* `EventPlayerWithContexts` - Same as `EventPlayer` but with all contexts already provided.

Please check this [CodeSandbox](https://codesandbox.io/s/sad-pateu-w2mvys?file=/src/EventPlayerWithContext.tsx) for examples.

## VideoJS

Props:

* `source` _(string, required)_: The URL of the video source to be played.
* `autoplay` _(boolean, optional)_: If true, the video will automatically start playing when loaded.
* `autoSeekToLiveEdge` _(boolean, optional)_: If true, the video player will seek to the live edge of the video when playing live streams.
* `debug` _(boolean, optional)_: If true, enables debug mode for the video player.
* `playsInline` _(boolean, optional)_: If true, the video will play inline within the element's layout on supported devices.
* `controls` _(boolean, optional)_: If true, shows the video controls (play/pause, volume, etc.).
* `showSeekbar` _(boolean, optional)_: If true, shows the seek bar on the video player controls.
* `showFullscreen` _(boolean, optional)_: If true, shows the fullscreen button on the video player controls.
* `showQualitySelector` _(boolean, optional)_: If true, shows the quality selector for choosing different video quality options.
* `showVolume` _(boolean, optional)_: If true, shows the volume control on the video player.
* `showTimers` _(boolean, optional)_: If true, shows the current time and duration timers on the video player.
* `showChromecast` _(boolean, optional)_: If true, shows the Chromecast button for casting the video.
* `showPictureInPicture` _(boolean, optional)_: If true, shows the picture-in-picture button for enabling picture-in-picture mode.
* `showLiveUI` _(boolean, optional)_: If true, shows UI elements related to live streaming.
* `volume` _(number, optional)_: The initial volume level of the video player (0 to 1).
* `width` _(CSS.Property.Width, optional)_: The width of the video player.
* `height` _(CSS.Property.Height, optional)_: The height of the video player.
* `chromecastCustomData` _(object, optional)_: Custom data required for Chromecast integration. Should have the following properties:
  * `eventId` _(string)_: The event ID.
  * `publicKey` _(string)_: Public key for authentication.
  * `identityToken` _(string)_: Identity token for authentication.
  * `customPlaylistUrl` _(string)_: URL of the custom playlist.
  * `pseudoUserId` _(string)_: Pseudo user ID.
  * `receiverAppID` _(string)_: Receiver app ID for Chromecast.
* `drm` _(DRM, optional)_: Digital Rights Management configuration.
* `posterUrl` _(string, optional)_: URL of the poster image to be displayed before the video starts playing.
* `liveTolerance` _(number, optional)_: Number of seconds behind live that the video player can be before it's considered non-live. Only used when playing at the live edge. Defaults to 15 seconds.
* `limitAutoQualityToPlayerSize` _(boolean, optional)_: If true, the player's automatic quality selection won't choose a rendition larger than the player dimensions. Defaults to true.
* `startAtMaxQuality` _(boolean, optional)_: If true, the player's will disregard bandwidth size in the inital segment calculation and force the player to load the highest quality
* `auth` _(string, optional)_: Authorization token to be used for fetching the stream.

Event Handlers:

* `onPlayerInit` _(function)_: Called when the video player is initialized. Receives the extended Video.js instance as a parameter.

* `onPlayerActive` _(function)_: Called when the video player becomes active.

* `onPlayerReady` _(function)_: Called when the video player is ready.

* `onClick` _(function)_: Called when the video player is clicked.

* `onError` _(function)_: Called when an error occurs. Receives an optional error parameter.

* `onPlay` _(function)_: Called when the video starts playing.

* `onTimeUpdate` _(function)_: Called when the playback time is updated. Receives the current time in seconds.

* `onFirstPlay` _(function)_: Called when the video starts playing for the first time.

* `onPause` _(function)_: Called when the video playback is paused.

* `onSeeked` _(function)_: Called when the video seeking operation is completed. Receives the current time in seconds after seeking.

* `onSeeking` _(function)_: Called while the video is in the process of seeking. Receives the current time in seconds during seeking.

* `onWaiting` _(function)_: Called when the video playback is temporarily paused due to buffering. Receives the current time in seconds.

* `onEnd` _(function)_: Called when the video playback reaches the end.

* `onDispose` _(function)_: Called when the video player component is disposed of or unmounted.

* `onLoadedMetadata` _(function)_: Called when the metadata of the video is successfully loaded. Receives the loaded metadata as an unknown value.

* `onQualityChange` _(function)_: Called when the video quality is changed by the user or automatically. Receives the new quality information as an object with the following properties:

  * `bitrate` _(number)_: The bitrate of the new quality.
  * `height` _(number)_: The height of the new quality.
  * `width` _(number)_: The width of the new quality.

* `children` _(ReactNode, optional)_: Any additional React components that you want to render within the video player component.

---
_Source: https://npm.io/package/@mycujoo/mcls-player · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
