vidstream-player
v1.0.6
Published
Production-ready customizable video player SDK using Vidstack - supports OTT and LMS platforms
Maintainers
Readme
vidstream-player
Production-ready video player SDK for Web Components and React. Includes HLS support, theming, quality control, watermark/anti-piracy overlays, analytics, and LMS progress tracking.
Installation
npm install vidstream-playerFor React usage, make sure your app also has:
npm install react react-domReact Quick Start
'use client';
import { useRef } from 'react';
import {
VideoPlayer,
usePlayerControls,
usePlayerState,
type VideoPlayerRef,
} from 'vidstream-player/react';
export default function CourseVideo() {
const playerRef = useRef<VideoPlayerRef>(null);
const state = usePlayerState(playerRef);
const controls = usePlayerControls(playerRef);
return (
<div>
<VideoPlayer
ref={playerRef}
source={{
src: 'https://example.com/video.m3u8',
type: 'hls',
poster: 'https://example.com/poster.jpg',
}}
mode="ott"
onReady={() => console.log('ready')}
onError={(error) => console.error(error)}
/>
<button onClick={() => controls.togglePlay()}>
{state.playing ? 'Pause' : 'Play'}
</button>
</div>
);
}VideoPlayer is also available as the default export:
import VideoPlayer from 'vidstream-player/react';Web Component Quick Start
ESM
import { registerVideoPlayerElement } from 'vidstream-player';
registerVideoPlayerElement();<video-player
src="https://example.com/video.m3u8"
source-type="hls"
mode="ott"
accent-color="#e50914"
></video-player>Script Tag
<script src="https://unpkg.com/vidstream-player/dist/vidstream-player.umd.js"></script>Main React Props
| Prop | Type | Notes |
|---|---|---|
| source | VideoSource | Required. { src, type?, poster?, title? } |
| mode | 'ott' \| 'lms' \| 'live' | Player mode |
| theme | PlayerTheme | Brand colors and UI styles |
| watermark | WatermarkConfig | Static watermark settings |
| controls | ControlsConfig | Control visibility/config |
| analytics | AnalyticsConfig | Analytics integration |
| lmsProgress | LMSProgressConfig | LMS tracking config |
| subtitles | SubtitleTrack[] | Subtitles/captions list |
| autoplay | boolean | Start automatically |
| muted | boolean | Start muted |
| loop | boolean | Loop playback |
Player API (Ref / Element)
Available methods:
play()pause()togglePlay()seek(time)setVolume(volume)toggleMute()setPlaybackRate(rate)toggleFullscreen()togglePip()setQuality(quality | 'auto')setSubtitle(track | null)getState()loadSource(source)updateConfig(config)destroy()
Player Events
The player emits custom events including:
player-readyplayer-playplayer-pauseplayer-endedplayer-timeupdateplayer-volumechangeplayer-fullscreenplayer-pipplayer-quality-changeplayer-bufferingplayer-error
Package Entry Points
vidstream-player-> Web Component SDK entryvidstream-player/webcomponent-> Explicit Web Component entryvidstream-player/react-> React wrapper entry
License
MIT
