32.0.0 • Published 2 months ago

pulsar-player-core v32.0.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 months ago

Pulsar-Player-Core

A UI agnostic, React API for consuming Player-Core.

Features

  • Stream, VOD, and Clip playback support
  • Emits fully hydrated Player tracking events emission
  • Imperative Player Control Via React Context / Hooks

See the working example.

Usage

import type { FC } from 'react';
import { PulsarCore, PulsarCorePreloadWASM, VideoType } from 'pulsar-player-core';

const PlayerConsumer: FC = () => (
  <>
    <head>
      <PulsarCorePreloadWASM />
    </head>
    <body>
      <PulsarCore
        autoPlay={true}
        environment={{...}}
        onContentRestriction={(restriction) => {/*...*/}}
        onTrackingEvent={(event) => {/*...*/}}
        onError={(error) => {/*...*/}}
        params={{...}}
      />
    </body>
  </>
);

Advanced Interactions

Pulsar-Core integrates with the PlayerController API.

Debugging

If you pass debugMode=true in the props to PulsarCore, it will:

  • enable debug-level logging from player-core
  • attach mediaPlayerInstance to window

These can be very helpful in looking more deeply into playback issues.

Building Against Player-Core Locally

  1. Install Yalc: yarn global add yalc
  2. Follow the Player-Core setup instructions
  3. In Player-Core run npm run build:prod && yalc push
  4. In this package run yalc add player-core
  5. Run npm run build:prod && yalc push as necessary with each change.
  6. Finally, run yalc remove player-core when finished.

Updating Player-Core Versions

Follow this guide.