pulsar-player-core
v32.0.0
Published
Pulsar Player-Core React API
Downloads
3
Readme
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
towindow
These can be very helpful in looking more deeply into playback issues.
Building Against Player-Core Locally
- Install Yalc:
yarn global add yalc
- Follow the Player-Core setup instructions
- In Player-Core run
npm run build:prod && yalc push
- In this package run
yalc add player-core
- Run
npm run build:prod && yalc push
as necessary with each change. - Finally, run
yalc remove player-core
when finished.
Updating Player-Core Versions
Follow this guide.