Skip to content

Commit 0c46d33

Browse files
committed
docs: readme file cue added
1 parent 08b3f68 commit 0c46d33

File tree

1 file changed

+38
-16
lines changed

1 file changed

+38
-16
lines changed

README.md

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# @interactive-video-labs/react
2+
23
<p align="center">
34
<img src="https://raw.githubusercontent.com/interactive-video-labs/docs/main/logo.svg" width="200px" alt="Interactive Video Labs Logo" />
45
</p>
@@ -11,8 +12,6 @@
1112
</a>
1213
</p>
1314

14-
15-
1615
Welcome to `@interactive-video-labs/react` — a lightweight React wrapper around the `@interactive-video-labs/core` engine for cue-driven interactive video experiences.
1716

1817
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.
@@ -25,11 +24,11 @@ This wrapper makes it easy to embed interactive video players in React apps usin
2524

2625
## Features
2726

28-
* **Easy Integration**: Seamlessly embed interactive videos into your React components.
29-
* **Cue Point Management**: Load and manage cue points for dynamic video interactions.
30-
* **Analytics Events**: Receive detailed analytics events from the video player to track user engagement.
31-
* **Localization**: Support for player localization through translations.
32-
* **Direct Core API Access**: Provides a React-friendly interface while maintaining close alignment with the core IVLabsPlayer API.
27+
- **Easy Integration**: Seamlessly embed interactive videos into your React components.
28+
- **Cue Point Management**: Load and manage cue points for dynamic video interactions.
29+
- **Analytics Events**: Receive detailed analytics events from the video player to track user engagement.
30+
- **Localization**: Support for player localization through translations.
31+
- **Direct Core API Access**: Provides a React-friendly interface while maintaining close alignment with the core IVLabsPlayer API.
3332

3433
## Installation
3534

@@ -62,8 +61,31 @@ const MyVideoPlayer = () => {
6261
// Handle analytics events, e.g., send to a tracking service
6362
}}
6463
cues={[
65-
{ time: 10, id: 'intro-cue', type: 'pause' },
66-
{ time: 25, id: 'question-cue', type: 'custom', data: { question: 'What is your favorite color?' } },
64+
{
65+
id: 'segmentChange',
66+
time: 10,
67+
label: 'Segment Change',
68+
payload: {
69+
interaction: {
70+
type: 'choice-video-segment-change',
71+
title: 'Choose your path',
72+
description: 'Select a video segment to jump to.',
73+
question: 'Where would you like to go?',
74+
options: [
75+
{
76+
level: 'Segment A',
77+
video:
78+
'https://interactive-video-labs.github.io/assets/sample-interaction-1.mp4',
79+
},
80+
{
81+
level: 'Segment B',
82+
video:
83+
'https://interactive-video-labs.github.io/assets/sample-interaction-2.mp4',
84+
},
85+
],
86+
},
87+
},
88+
},
6789
]}
6890
translations={{
6991
en: {
@@ -83,13 +105,13 @@ export default MyVideoPlayer;
83105

84106
The `InteractiveVideo` component accepts the following props:
85107

86-
* `videoUrl` (string, **required**): The URL of the video to be played.
87-
* `onAnalyticsEvent` (function, optional): A callback function that is triggered when an analytics event occurs. It receives the `event` name and an optional `payload`.
88-
* `event`: `PLAYER_LOADED`, `VIDEO_STARTED`, `VIDEO_PAUSED`, `VIDEO_ENDED`, `CUE_TRIGGERED`, `INTERACTION_COMPLETED`, `ERROR`.
89-
* `payload`: An object containing event-specific data.
90-
* `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.
91-
* `translations` (Translations, optional): An object containing translations for player localization. This should conform to the `@interactive-video-labs/core` `Translations` interface.
92-
* `...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.
108+
- `videoUrl` (string, **required**): The URL of the video to be played.
109+
- `onAnalyticsEvent` (function, optional): A callback function that is triggered when an analytics event occurs. It receives the `event` name and an optional `payload`.
110+
- `event`: `PLAYER_LOADED`, `VIDEO_STARTED`, `VIDEO_PAUSED`, `VIDEO_ENDED`, `CUE_TRIGGERED`, `INTERACTION_COMPLETED`, `ERROR`.
111+
- `payload`: An object containing event-specific data.
112+
- `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.
113+
- `translations` (Translations, optional): An object containing translations for player localization. This should conform to the `@interactive-video-labs/core` `Translations` interface.
114+
- `...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.
93115

94116
## Development
95117

0 commit comments

Comments
 (0)