You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+103-1Lines changed: 103 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,4 +17,106 @@ Welcome to `@interactive-video-labs/react` — a lightweight React wrapper aroun
17
17
18
18
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.
19
19
20
-
---
20
+
---
21
+
22
+
## Introduction
23
+
24
+
`@interactive-video-labs/react` is a thin React component that provides a convenient way to integrate interactive video experiences into your React applications. It leverages the powerful `@interactive-video-labs/core` engine, allowing you to easily manage video playback, cue points, and analytics within a familiar React paradigm.
25
+
26
+
## Features
27
+
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.
// Handle analytics events, e.g., send to a tracking service
63
+
}}
64
+
cues={[
65
+
{ time: 10, id: 'intro-cue', type: 'pause' },
66
+
{ time: 25, id: 'question-cue', type: 'custom', data: { question: 'What is your favorite color?' } },
67
+
]}
68
+
translations={{
69
+
en: {
70
+
play: 'Play Video',
71
+
pause: 'Pause Video',
72
+
},
73
+
}}
74
+
/>
75
+
</div>
76
+
);
77
+
};
78
+
79
+
exportdefaultMyVideoPlayer;
80
+
```
81
+
82
+
## Props
83
+
84
+
The `InteractiveVideo` component accepts the following props:
85
+
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`.
*`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.
93
+
94
+
## Development
95
+
96
+
To set up the development environment:
97
+
98
+
1. Clone the repository.
99
+
2. Install dependencies:
100
+
```bash
101
+
pnpm install
102
+
```
103
+
3. Build the project:
104
+
```bash
105
+
pnpm build
106
+
```
107
+
4. Run tests:
108
+
```bash
109
+
pnpm test
110
+
```
111
+
5. Run examples:
112
+
```bash
113
+
pnpm serve-examples
114
+
```
115
+
116
+
## Contributing
117
+
118
+
We welcome contributions! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
119
+
120
+
## License
121
+
122
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
0 commit comments