Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout repository
Expand All @@ -23,17 +26,13 @@ jobs:
uses: actions/setup-node@v7
with:
node-version: 26
registry-url: 'https://registry.npmjs.org/'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
run: pnpm install --frozen-lockfile

- name: Build package
run: pnpm build

- name: Publish to npm
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

run: pnpm publish --access public --no-git-checks --provenance
19 changes: 15 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Changelog

All notable changes to this project will be documented in this file.

## [0.3.0] - 2026-11-25

### Changed

- Updated compatibility to `@interactive-video-labs/core@^0.3.1`.
- Added pass-through support for current core player configuration options.
- Added analytics subscriptions for the complete core event surface.
- Added live sync event and status callbacks.
- Added an imperative ref handle for core playback and decision APIs.
- Updated README and developer documentation for core 0.3.1 usage.

## v0.2.0 2025-09-24

### Added
Expand Down Expand Up @@ -99,10 +114,6 @@
- update dependency @vitejs/plugin-react to v5
- update dependency typescript to v5.9.2

# Changelog

All notable changes to this project will be documented in this file.

## [0.0.2] - 2025-08-10

### Style
Expand Down
1 change: 1 addition & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Here's an overview of the key directories and files in this project:
* `tsup.config.ts`: Configuration for `tsup`, the bundler used to build the library.
* `vitest.config.ts`: Configuration for `Vitest`, the testing framework.
* `package.json`: Project metadata, dependencies, and scripts.
* Core compatibility: the wrapper targets `@interactive-video-labs/core@^0.3.1`.

## 3. Available Scripts

Expand Down
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</p>

Welcome to `@interactive-video-labs/react` — a lightweight React wrapper around the `@interactive-video-labs/core` engine for cue-driven interactive video experiences.
This release tracks `@interactive-video-labs/core` `^0.3.1`.

This wrapper makes it easy to embed interactive video players in React apps using familiar props and event handlers, while keeping close to the core API.

Expand All @@ -28,6 +29,8 @@ This wrapper makes it easy to embed interactive video players in React apps usin
- **Cue Point Management**: Load and manage cue points for dynamic video interactions.
- **Analytics Events**: Receive detailed analytics events from the video player to track user engagement.
- **Localization**: Support for player localization through translations.
- **Core 0.3.1 Features**: Pass-through support for subtitles, interactions, debugger mode, decision adapters, and live sync.
- **Imperative Controls**: Optional React ref access to playback, state, cues, translations, decisions, and live sync.
- **Direct Core API Access**: Provides a React-friendly interface while maintaining close alignment with the core IVLabsPlayer API.

## Installation
Expand Down Expand Up @@ -55,7 +58,6 @@ const MyVideoPlayer = () => {
videoUrl="https://interactive-video-labs.github.io/interactive-video-demos/videos/big_buck_bunny.mp4"
autoplay={true}
loop={false}
controls={true}
onAnalyticsEvent={(event, payload) => {
console.log('Analytics Event:', event, payload);
// Handle analytics events, e.g., send to a tracking service
Expand Down Expand Up @@ -93,6 +95,10 @@ const MyVideoPlayer = () => {
pause: 'Pause Video',
},
}}
debugger={true}
onLiveSyncStatus={(status) => {
console.log('Live sync status:', status);
}}
/>
</div>
);
Expand All @@ -107,11 +113,34 @@ The `InteractiveVideo` component accepts the following props:

- `videoUrl` (string, **required**): The URL of the video to be played.
- `onAnalyticsEvent` (function, optional): A callback function that is triggered when an analytics event occurs. It receives the `event` name and an optional `payload`.
- `event`: `PLAYER_LOADED`, `VIDEO_STARTED`, `VIDEO_PAUSED`, `VIDEO_ENDED`, `CUE_TRIGGERED`, `INTERACTION_COMPLETED`, `ERROR`.
- Includes core events such as `PLAYER_LOADED`, `VIDEO_STARTED`, `VIDEO_PAUSED`, `CUE_LOADED`, `CUE_TRIGGERED`, `INTERACTION_SHOWN`, `INTERACTION_COMPLETED`, `VIDEO_ENDED`, `PLAYER_DESTROYED`, `ERROR`, and the normalized analytics hooks.
- `payload`: An object containing event-specific data.
- `cues` (CuePoint[], optional): An array of cue points to load into the player. Each `CuePoint` object should conform to the `@interactive-video-labs/core` `CuePoint` interface.
- `translations` (Translations, optional): An object containing translations for player localization. This should conform to the `@interactive-video-labs/core` `Translations` interface.
- `...restOptions` (PlayerConfig, optional): Any other valid `PlayerConfig` options from `@interactive-video-labs/core` (excluding `videoUrl`, `cues`, and `translations`). This allows for direct pass-through of core player configurations like `autoplay`, `loop`, `controls`, `locale`, etc.
- `translations` (Record<string, Translations>, optional): A locale-to-translations map for player localization.
- `onLiveSyncEvent` (function, optional): Receives normalized live sync events such as room state, cue, decision, poll, and presence updates.
- `onLiveSyncStatus` (function, optional): Receives live sync connection lifecycle updates.
- `...restOptions` (PlayerConfig, optional): Any other valid `PlayerConfig` options from `@interactive-video-labs/core` (excluding `videoUrl`, `cues`, and `translations`). This allows for direct pass-through of core player configurations like `autoplay`, `loop`, `subtitlesUrl`, `locale`, `interactions`, `debugger`, `liveSync`, and decision adapters.

## Imperative Ref

The component forwards a ref for core player operations:

```tsx
import { useRef } from 'react';
import {
InteractiveVideo,
type InteractiveVideoHandle,
} from '@interactive-video-labs/react';

const playerRef = useRef<InteractiveVideoHandle>(null);

<InteractiveVideo ref={playerRef} videoUrl="/video.mp4" />
playerRef.current?.play();
playerRef.current?.pause();
const state = playerRef.current?.getState();
```

Available methods include `play`, `pause`, `syncToLive`, `getState`, `setLocale`, `loadCues`, `loadTranslations`, `getDecisionHistory`, `clearDecisionHistory`, `sendLiveSyncMessage`, and `getPlayer`.

## Development

Expand Down
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interactive-video-labs/react",
"version": "0.2.0",
"version": "0.3.0",
"description": "Thin React wrapper for the @interactive-video-labs/core engine. Enables cue-based interactive video playback in React apps.",
"type": "module",
"main": "dist/index.cjs",
Expand Down Expand Up @@ -55,34 +55,35 @@
},
"packageManager": "pnpm@12.23.0",
"peerDependencies": {
"@interactive-video-labs/core": "^0.1.2 || ^0.2.0 || ^0.3.0",
"@interactive-video-labs/core": "^0.3.1",
"react": ">=17.0.0 || >=18.0.0",
"react-dom": ">=17.0.0 || >=18.0.0"
},
"dependencies": {
"@vitejs/plugin-react": "^6.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"jsdom": "^31.0.0",
"@vitejs/plugin-react": "^6.3.0",
"jsdom": "^31.0.1",
"tsup": "^9.0.0",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vitest": "^5.0.0"
"vitest": "^5.1.1"
},
"devDependencies": {
"@commitlint/cli": "^21.0.0",
"@commitlint/config-conventional": "^21.0.0",
"@testing-library/jest-dom": "^7.0.0",
"@testing-library/react": "^16.0.0",
"@types/react": "^19.1.9",
"@typescript-eslint/eslint-plugin": "^8.39.0",
"@typescript-eslint/parser": "^8.39.0",
"eslint": "^10.0.0",
"@commitlint/cli": "^21.2.4",
"@commitlint/config-conventional": "^21.2.4",
"@interactive-video-labs/core": "0.3.1",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@types/react": "^19.3.0",
"@typescript-eslint/eslint-plugin": "^8.74.0",
"@typescript-eslint/parser": "^8.74.0",
"eslint": "^10.15.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-prettier": "^5.5.7",
"eslint-plugin-react": "^7.37.5",
"http-server": "^14.1.1",
"husky": "^9.1.7",
"lint-staged": "^17.0.0",
"prettier": "^3.6.2",
"typescript-eslint": "^8.39.0"
"lint-staged": "^17.6.2",
"prettier": "^3.10.1",
"typescript-eslint": "^8.74.0"
}
}
Loading