@obipascal/player 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -37,13 +37,13 @@ A modern, feature-rich HLS video player SDK for educational platforms with Cloud
|
|
|
37
37
|
## 📦 Installation
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install @
|
|
40
|
+
npm install @obipascal/player hls.js
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
Or with yarn:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
yarn add @
|
|
46
|
+
yarn add @obipascal/player hls.js
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
## 🚀 Quick Start
|
|
@@ -60,7 +60,7 @@ yarn add @wontum/player hls.js
|
|
|
60
60
|
<div id="player-container"></div>
|
|
61
61
|
|
|
62
62
|
<script type="module">
|
|
63
|
-
import { WontumPlayer } from "@
|
|
63
|
+
import { WontumPlayer } from "@obipascal/player"
|
|
64
64
|
|
|
65
65
|
const player = new WontumPlayer({
|
|
66
66
|
src: "https://media.example.com/video/playlist.m3u8",
|
|
@@ -110,7 +110,7 @@ yarn add @wontum/player hls.js
|
|
|
110
110
|
### React Component
|
|
111
111
|
|
|
112
112
|
```tsx
|
|
113
|
-
import { WontumPlayerReact } from "@
|
|
113
|
+
import { WontumPlayerReact } from "@obipascal/player"
|
|
114
114
|
|
|
115
115
|
function VideoPlayer() {
|
|
116
116
|
return (
|
|
@@ -146,7 +146,7 @@ function VideoPlayer() {
|
|
|
146
146
|
### React Hook (Custom Controls)
|
|
147
147
|
|
|
148
148
|
```tsx
|
|
149
|
-
import { useWontumPlayer } from "@
|
|
149
|
+
import { useWontumPlayer } from "@obipascal/player"
|
|
150
150
|
|
|
151
151
|
function CustomPlayer() {
|
|
152
152
|
const { containerRef, player, state } = useWontumPlayer({
|
|
@@ -182,7 +182,7 @@ function CustomPlayer() {
|
|
|
182
182
|
### React Context Provider
|
|
183
183
|
|
|
184
184
|
```tsx
|
|
185
|
-
import { WontumPlayerProvider, useWontumPlayerContext } from "@
|
|
185
|
+
import { WontumPlayerProvider, useWontumPlayerContext } from "@obipascal/player"
|
|
186
186
|
|
|
187
187
|
function App() {
|
|
188
188
|
return (
|
|
@@ -218,7 +218,7 @@ function ControlPanel() {
|
|
|
218
218
|
For secure video delivery, use CloudFront with signed cookies:
|
|
219
219
|
|
|
220
220
|
```typescript
|
|
221
|
-
import { WontumPlayer } from "@
|
|
221
|
+
import { WontumPlayer } from "@obipascal/player"
|
|
222
222
|
|
|
223
223
|
// Your backend sets signed cookies for CloudFront
|
|
224
224
|
// Cookie names: CloudFront-Policy, CloudFront-Signature, CloudFront-Key-Pair-Id
|
|
@@ -576,7 +576,7 @@ import {
|
|
|
576
576
|
cyberpunkTheme,
|
|
577
577
|
pastelTheme,
|
|
578
578
|
educationTheme,
|
|
579
|
-
} from "@
|
|
579
|
+
} from "@obipascal/player"
|
|
580
580
|
|
|
581
581
|
const player = new WontumPlayer({
|
|
582
582
|
src: "https://media.example.com/video/playlist.m3u8",
|
|
@@ -620,7 +620,7 @@ const player = new WontumPlayer({
|
|
|
620
620
|
Quick brand color presets:
|
|
621
621
|
|
|
622
622
|
```typescript
|
|
623
|
-
import { BrandPresets } from "@
|
|
623
|
+
import { BrandPresets } from "@obipascal/player"
|
|
624
624
|
|
|
625
625
|
const player = new WontumPlayer({
|
|
626
626
|
src: "https://media.example.com/video/playlist.m3u8",
|
|
@@ -14,7 +14,7 @@ export declare function cloudFrontWithRetryExample(): WontumPlayer;
|
|
|
14
14
|
* Note: This is a code example as a string. For actual React usage,
|
|
15
15
|
* copy this to a .tsx file in your project.
|
|
16
16
|
*/
|
|
17
|
-
export declare const ReactCloudFrontPlayerExample = "\nimport React from \"react\"\nimport { WontumPlayerReact } from \"@
|
|
17
|
+
export declare const ReactCloudFrontPlayerExample = "\nimport React from \"react\"\nimport { WontumPlayerReact } from \"@obipascal/player\"\n\nexport function CloudFrontPlayer({ videoUrl, userId }: { videoUrl: string; userId: string }) {\n\t// Sign URL function\n\tasync function signUrl(url: string): Promise<string> {\n\t\tconst response = await fetch(\"/api/cloudfront/sign\", {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t\tbody: JSON.stringify({ url, userId }),\n\t\t\tcredentials: \"include\",\n\t\t})\n\n\t\tconst data = await response.json()\n\t\treturn data.url\n\t}\n\n\treturn (\n\t\t<WontumPlayerReact\n\t\t\tsrc={videoUrl}\n\t\t\twidth=\"100%\"\n\t\t\theight=\"500px\"\n\t\t\ts3Config={{\n\t\t\t\tsignUrl,\n\t\t\t\tcloudFrontDomains: [\"media.domain.com\", \"cdn.domain.com\"], // Multiple domains\n\t\t\t}}\n\t\t\tanalytics={{\n\t\t\t\tenabled: true,\n\t\t\t\tuserId,\n\t\t\t\tvideoId: videoUrl,\n\t\t\t}}\n\t\t\tonError={(error) => {\n\t\t\t\tconsole.error(\"Player error:\", error)\n\t\t\t\t// Handle signing errors\n\t\t\t\tif (error?.message?.includes(\"sign\")) {\n\t\t\t\t\talert(\"Failed to authenticate video. Please refresh and try again.\")\n\t\t\t\t}\n\t\t\t}}\n\t\t/>\n\t)\n}\n";
|
|
18
18
|
/**
|
|
19
19
|
* Example 4: Backend Implementation (Node.js/Express)
|
|
20
20
|
*/
|
|
@@ -31,7 +31,7 @@ export declare function educationTheme(): WontumPlayer;
|
|
|
31
31
|
/**
|
|
32
32
|
* React Example with Custom Theme
|
|
33
33
|
*/
|
|
34
|
-
export declare const ReactCustomThemeExample = "\nimport React from 'react';\nimport { WontumPlayerReact } from '@
|
|
34
|
+
export declare const ReactCustomThemeExample = "\nimport React from 'react';\nimport { WontumPlayerReact } from '@obipascal/player';\n\nfunction CustomStyledPlayer() {\n return (\n <WontumPlayerReact\n src=\"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8\"\n theme={{\n primaryColor: '#ff6b6b', // Coral red\n accentColor: '#ee5a6f',\n fontFamily: 'Helvetica, Arial, sans-serif',\n controlsBackground: 'linear-gradient(to top, rgba(0,0,0,0.85), transparent)',\n buttonHoverBg: 'rgba(255, 107, 107, 0.25)',\n progressHeight: '5px',\n borderRadius: '8px'\n }}\n />\n );\n}\n";
|
|
35
35
|
/**
|
|
36
36
|
* All Available Theme Options
|
|
37
37
|
*/
|
|
@@ -40,7 +40,7 @@ export declare function minimalEventExample(): void;
|
|
|
40
40
|
/**
|
|
41
41
|
* React example with all events
|
|
42
42
|
*/
|
|
43
|
-
export declare const ReactAllEventsExample = "\nimport React from 'react';\nimport { WontumPlayerReact } from '@
|
|
43
|
+
export declare const ReactAllEventsExample = "\nimport React from 'react';\nimport { WontumPlayerReact } from '@obipascal/player';\n\nfunction VideoPlayerWithEvents() {\n return (\n <WontumPlayerReact\n src=\"https://media.domain.com/video.m3u8\"\n \n {/* Playback Events */}\n onPlay={(e) => console.log('Play', e)}\n onPause={(e) => console.log('Pause', e)}\n onPlaying={(e) => console.log('Playing', e)}\n onEnded={(e) => console.log('Ended', e)}\n onTimeupdate={(e) => console.log('Time:', e.data.currentTime)}\n \n {/* Seeking */}\n onSeeking={(e) => console.log('Seeking', e)}\n onSeeked={(e) => console.log('Seeked', e)}\n \n {/* Loading Events */}\n onLoadstart={(e) => console.log('Load Start', e)}\n onLoadeddata={(e) => console.log('Loaded Data', e)}\n onLoadedmetadata={(e) => console.log('Metadata', e)}\n onCanplay={(e) => console.log('Can Play', e)}\n onCanplaythrough={(e) => console.log('Can Play Through', e)}\n onProgress={(e) => console.log('Progress', e)}\n onWaiting={(e) => console.log('Buffering', e)}\n onDurationchange={(e) => console.log('Duration', e)}\n \n {/* Media State */}\n onVolumechange={(e) => console.log('Volume', e)}\n onRatechange={(e) => console.log('Rate', e)}\n onResize={(e) => console.log('Resize', e)}\n \n {/* Network/Error */}\n onAbort={(e) => console.log('Abort', e)}\n onEmptied={(e) => console.log('Emptied', e)}\n onStalled={(e) => console.log('Stalled', e)}\n onSuspend={(e) => console.log('Suspend', e)}\n onError={(e) => console.error('Error', e)}\n \n {/* Custom Events */}\n onQualitychange={(e) => console.log('Quality', e)}\n onFullscreenchange={(e) => console.log('Fullscreen', e)}\n />\n );\n}\n";
|
|
44
44
|
/**
|
|
45
45
|
* Compare with Mux Player events
|
|
46
46
|
*/
|
|
@@ -35,4 +35,4 @@ export declare const htmlExample = "\n<!DOCTYPE html>\n<html>\n<head>\n <title>
|
|
|
35
35
|
/**
|
|
36
36
|
* React example with public stream
|
|
37
37
|
*/
|
|
38
|
-
export declare const reactPublicStreamExample = "\nimport React from 'react';\nimport { WontumPlayerReact } from '@
|
|
38
|
+
export declare const reactPublicStreamExample = "\nimport React from 'react';\nimport { WontumPlayerReact } from '@obipascal/player';\n\nfunction App() {\n return (\n <div style={{ width: '100%', height: '600px', background: '#000' }}>\n <WontumPlayerReact\n src=\"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8\"\n autoplay\n onLoadedmetadata={(e) => console.log('Duration:', e.data.duration)}\n onPlay={() => console.log('Playing!')}\n onError={(e) => console.error('Error:', e.data)}\n />\n </div>\n );\n}\n\nexport default App;\n";
|
package/package.json
CHANGED