@obipascal/player 1.0.14 → 1.0.16
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/dist/index.d.ts +9 -1
- package/package.json +4 -2
- package/dist/examples/cloudfront-example.d.ts +0 -25
- package/dist/examples/custom-themes.d.ts +0 -124
- package/dist/examples/events-demo.d.ts +0 -52
- package/dist/examples/public-stream-test.d.ts +0 -38
- package/dist/examples/react-examples.d.ts +0 -32
- package/dist/examples/vanilla-js-examples.d.ts +0 -56
- package/dist/src/index.d.ts +0 -9
- package/dist/src/test-app.d.ts +0 -1
- /package/dist/{src/analytics.d.ts → analytics.d.ts} +0 -0
- /package/dist/{src/file-info.d.ts → file-info.d.ts} +0 -0
- /package/dist/{src/player.d.ts → player.d.ts} +0 -0
- /package/dist/{src/react.d.ts → react.d.ts} +0 -0
- /package/dist/{src/s3-handler.d.ts → s3-handler.d.ts} +0 -0
- /package/dist/{src/types.d.ts → types.d.ts} +0 -0
- /package/dist/{src/ui-controller.d.ts → ui-controller.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { WontumPlayer } from './player';
|
|
2
|
+
export { Analytics } from './analytics';
|
|
3
|
+
export { S3Handler } from './s3-handler';
|
|
4
|
+
export { UIController } from './ui-controller';
|
|
5
|
+
export { WontumFileInfo } from './file-info';
|
|
6
|
+
export { WontumPlayerReact, useWontumPlayer, WontumPlayerProvider, useWontumPlayerContext, useVideoFileInfo, useAnalytics } from './react';
|
|
7
|
+
export type { WontumPlayerConfig, PlayerTheme, S3Config, AnalyticsConfig, WebSocketAnalyticsHandler, SocketIOAnalyticsHandler, PlayerState, PlayerEvent, PlayerEventType, AnalyticsEvent, QualityLevel, } from './types';
|
|
8
|
+
export type { VideoFileInfo } from './file-info';
|
|
9
|
+
export type { WontumPlayerReactProps, UseVideoFileInfoResult, UseAnalyticsResult } from './react';
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@obipascal/player",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "A modern HLS video player SDK for educational platforms with S3 integration",
|
|
5
5
|
"main": "dist/wontum-player.cjs.js",
|
|
6
6
|
"module": "dist/wontum-player.esm.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
|
-
"dist"
|
|
9
|
+
"dist/wontum-player.esm.js",
|
|
10
|
+
"dist/wontum-player.cjs.js",
|
|
11
|
+
"dist/*.d.ts"
|
|
10
12
|
],
|
|
11
13
|
"scripts": {
|
|
12
14
|
"dev": "vite",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { WontumPlayer } from '../src/index';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Example 1: Basic CloudFront Setup
|
|
5
|
-
*/
|
|
6
|
-
export declare function basicCloudFrontExample(): WontumPlayer;
|
|
7
|
-
/**
|
|
8
|
-
* Example 2: With Error Handling and Retry
|
|
9
|
-
*/
|
|
10
|
-
export declare function cloudFrontWithRetryExample(): WontumPlayer;
|
|
11
|
-
/**
|
|
12
|
-
* Example 3: React Component with CloudFront
|
|
13
|
-
*
|
|
14
|
-
* Note: This is a code example as a string. For actual React usage,
|
|
15
|
-
* copy this to a .tsx file in your project.
|
|
16
|
-
*/
|
|
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
|
-
/**
|
|
19
|
-
* Example 4: Backend Implementation (Node.js/Express)
|
|
20
|
-
*/
|
|
21
|
-
export declare const backendExample = "\n// backend/routes/cloudfront.js\nconst express = require('express');\nconst AWS = require('aws-sdk');\nconst router = express.Router();\n\n// Initialize CloudFront signer\nconst cloudFront = new AWS.CloudFront.Signer(\n process.env.CLOUDFRONT_KEY_PAIR_ID,\n process.env.CLOUDFRONT_PRIVATE_KEY\n);\n\n// Middleware to verify user authentication\nfunction requireAuth(req, res, next) {\n if (!req.user) {\n return res.status(401).json({ error: 'Unauthorized' });\n }\n next();\n}\n\n// Middleware to verify user has access to video\nasync function verifyVideoAccess(req, res, next) {\n const { url } = req.body;\n const userId = req.user.id;\n \n // Extract video ID from URL\n const videoId = extractVideoIdFromUrl(url);\n \n // Check database if user has access\n const hasAccess = await checkUserVideoAccess(userId, videoId);\n \n if (!hasAccess) {\n return res.status(403).json({ error: 'Access denied to this video' });\n }\n \n next();\n}\n\n// Sign CloudFront URL endpoint\nrouter.post('/cloudfront/sign', requireAuth, verifyVideoAccess, (req, res) => {\n try {\n const { url } = req.body;\n \n if (!url) {\n return res.status(400).json({ error: 'URL is required' });\n }\n \n // Parse URL to get domain\n const urlObj = new URL(url);\n const domain = urlObj.hostname;\n \n // Create signed cookies\n const policy = JSON.stringify({\n Statement: [{\n Resource: `https://${domain}/*`,\n Condition: {\n DateLessThan: {\n 'AWS:EpochTime': Math.floor(Date.now() / 1000) + 3600 // 1 hour\n }\n }\n }]\n });\n \n const signedCookies = cloudFront.getSignedCookie({\n policy\n });\n \n // Set signed cookies\n const cookieOptions = {\n domain: domain,\n path: '/',\n secure: true,\n httpOnly: true,\n sameSite: 'none',\n maxAge: 3600000 // 1 hour\n };\n \n res.cookie('CloudFront-Policy', signedCookies['CloudFront-Policy'], cookieOptions);\n res.cookie('CloudFront-Signature', signedCookies['CloudFront-Signature'], cookieOptions);\n res.cookie('CloudFront-Key-Pair-Id', signedCookies['CloudFront-Key-Pair-Id'], cookieOptions);\n \n // Return the original URL\n // The cookies will authenticate subsequent requests\n res.json({ url });\n \n } catch (error) {\n console.error('Error signing CloudFront URL:', error);\n res.status(500).json({ error: 'Failed to sign URL' });\n }\n});\n\nmodule.exports = router;\n";
|
|
22
|
-
/**
|
|
23
|
-
* Example 5: Python/Django Backend
|
|
24
|
-
*/
|
|
25
|
-
export declare const pythonBackendExample = "\n# backend/videos/views.py\nfrom django.http import JsonResponse\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.contrib.auth.decorators import login_required\nimport json\nfrom datetime import datetime, timedelta\nfrom cryptography.hazmat.primitives import hashes, serialization\nfrom cryptography.hazmat.primitives.asymmetric import padding\nimport base64\n\n@csrf_exempt\n@login_required\ndef sign_cloudfront_url(request):\n if request.method != 'POST':\n return JsonResponse({'error': 'Method not allowed'}, status=405)\n \n try:\n data = json.loads(request.body)\n url = data.get('url')\n \n if not url:\n return JsonResponse({'error': 'URL is required'}, status=400)\n \n # Verify user has access to video\n video_id = extract_video_id_from_url(url)\n if not user_has_video_access(request.user, video_id):\n return JsonResponse({'error': 'Access denied'}, status=403)\n \n # Create CloudFront signed cookies\n expiration = datetime.utcnow() + timedelta(hours=1)\n \n policy = {\n \"Statement\": [{\n \"Resource\": f\"https://media.domain.com/*\",\n \"Condition\": {\n \"DateLessThan\": {\n \"AWS:EpochTime\": int(expiration.timestamp())\n }\n }\n }]\n }\n \n # Sign the policy\n signed_cookies = create_signed_cookies(policy)\n \n # Set cookies\n response = JsonResponse({'url': url})\n response.set_cookie(\n 'CloudFront-Policy',\n signed_cookies['CloudFront-Policy'],\n domain='media.domain.com',\n secure=True,\n httponly=True,\n samesite='None',\n max_age=3600\n )\n response.set_cookie(\n 'CloudFront-Signature',\n signed_cookies['CloudFront-Signature'],\n domain='media.domain.com',\n secure=True,\n httponly=True,\n samesite='None',\n max_age=3600\n )\n response.set_cookie(\n 'CloudFront-Key-Pair-Id',\n signed_cookies['CloudFront-Key-Pair-Id'],\n domain='media.domain.com',\n secure=True,\n httponly=True,\n samesite='None',\n max_age=3600\n )\n \n return response\n \n except Exception as e:\n return JsonResponse({'error': str(e)}, status=500)\n";
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { WontumPlayer } from '../src/index';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Example 1: Netflix-style Dark Theme
|
|
5
|
-
*/
|
|
6
|
-
export declare function netflixTheme(): WontumPlayer;
|
|
7
|
-
/**
|
|
8
|
-
* Example 2: YouTube-style Theme
|
|
9
|
-
*/
|
|
10
|
-
export declare function youtubeTheme(): WontumPlayer;
|
|
11
|
-
/**
|
|
12
|
-
* Example 3: Modern Purple/Pink Theme
|
|
13
|
-
*/
|
|
14
|
-
export declare function modernTheme(): WontumPlayer;
|
|
15
|
-
/**
|
|
16
|
-
* Example 4: Minimal Green Theme
|
|
17
|
-
*/
|
|
18
|
-
export declare function minimalGreenTheme(): WontumPlayer;
|
|
19
|
-
/**
|
|
20
|
-
* Example 5: Bold Cyberpunk Theme
|
|
21
|
-
*/
|
|
22
|
-
export declare function cyberpunkTheme(): WontumPlayer;
|
|
23
|
-
/**
|
|
24
|
-
* Example 6: Soft Pastel Theme
|
|
25
|
-
*/
|
|
26
|
-
export declare function pastelTheme(): WontumPlayer;
|
|
27
|
-
/**
|
|
28
|
-
* Example 7: Education Platform Theme
|
|
29
|
-
*/
|
|
30
|
-
export declare function educationTheme(): WontumPlayer;
|
|
31
|
-
/**
|
|
32
|
-
* React Example with Custom Theme
|
|
33
|
-
*/
|
|
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
|
-
/**
|
|
36
|
-
* All Available Theme Options
|
|
37
|
-
*/
|
|
38
|
-
export declare const ThemeOptions: {
|
|
39
|
-
/**
|
|
40
|
-
* Primary color for progress bar, sliders, etc.
|
|
41
|
-
* Default: '#3b82f6' (blue)
|
|
42
|
-
*/
|
|
43
|
-
primaryColor: string;
|
|
44
|
-
/**
|
|
45
|
-
* Accent color for hover states
|
|
46
|
-
* Default: '#2563eb' (darker blue)
|
|
47
|
-
*/
|
|
48
|
-
accentColor: string;
|
|
49
|
-
/**
|
|
50
|
-
* Font family for all text
|
|
51
|
-
* Default: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
52
|
-
*/
|
|
53
|
-
fontFamily: string;
|
|
54
|
-
/**
|
|
55
|
-
* Background for controls overlay
|
|
56
|
-
* Can be solid color or gradient
|
|
57
|
-
* Default: 'linear-gradient(to top, rgba(0,0,0,0.8), transparent)'
|
|
58
|
-
*/
|
|
59
|
-
controlsBackground: string;
|
|
60
|
-
/**
|
|
61
|
-
* Button hover background color
|
|
62
|
-
* Default: 'rgba(255, 255, 255, 0.1)'
|
|
63
|
-
*/
|
|
64
|
-
buttonHoverBg: string;
|
|
65
|
-
/**
|
|
66
|
-
* Height of progress bar
|
|
67
|
-
* Default: '6px'
|
|
68
|
-
*/
|
|
69
|
-
progressHeight: string;
|
|
70
|
-
/**
|
|
71
|
-
* Border radius for buttons and progress bar
|
|
72
|
-
* Default: '4px'
|
|
73
|
-
*/
|
|
74
|
-
borderRadius: string;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Brand Color Presets
|
|
78
|
-
*/
|
|
79
|
-
export declare const BrandPresets: {
|
|
80
|
-
netflix: {
|
|
81
|
-
primary: string;
|
|
82
|
-
accent: string;
|
|
83
|
-
};
|
|
84
|
-
youtube: {
|
|
85
|
-
primary: string;
|
|
86
|
-
accent: string;
|
|
87
|
-
};
|
|
88
|
-
vimeo: {
|
|
89
|
-
primary: string;
|
|
90
|
-
accent: string;
|
|
91
|
-
};
|
|
92
|
-
spotify: {
|
|
93
|
-
primary: string;
|
|
94
|
-
accent: string;
|
|
95
|
-
};
|
|
96
|
-
twitch: {
|
|
97
|
-
primary: string;
|
|
98
|
-
accent: string;
|
|
99
|
-
};
|
|
100
|
-
disney: {
|
|
101
|
-
primary: string;
|
|
102
|
-
accent: string;
|
|
103
|
-
};
|
|
104
|
-
hulu: {
|
|
105
|
-
primary: string;
|
|
106
|
-
accent: string;
|
|
107
|
-
};
|
|
108
|
-
amazon: {
|
|
109
|
-
primary: string;
|
|
110
|
-
accent: string;
|
|
111
|
-
};
|
|
112
|
-
apple: {
|
|
113
|
-
primary: string;
|
|
114
|
-
accent: string;
|
|
115
|
-
};
|
|
116
|
-
hbo: {
|
|
117
|
-
primary: string;
|
|
118
|
-
accent: string;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* Quick Setup Helper
|
|
123
|
-
*/
|
|
124
|
-
export declare function createThemedPlayer(containerId: string, streamUrl: string, brandName: keyof typeof BrandPresets): WontumPlayer;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { WontumPlayer } from '../src/index';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* All available events in Wontum Player (Mux Player compatible)
|
|
5
|
-
*/
|
|
6
|
-
export declare function allEventsDemo(): WontumPlayer;
|
|
7
|
-
/**
|
|
8
|
-
* Event categories breakdown
|
|
9
|
-
*/
|
|
10
|
-
export declare const EventCategories: {
|
|
11
|
-
/**
|
|
12
|
-
* Playback Events - Control and playback state
|
|
13
|
-
*/
|
|
14
|
-
readonly playback: readonly ["play", "pause", "playing", "ended", "timeupdate"];
|
|
15
|
-
/**
|
|
16
|
-
* Seeking Events - User navigation
|
|
17
|
-
*/
|
|
18
|
-
readonly seeking: readonly ["seeking", "seeked"];
|
|
19
|
-
/**
|
|
20
|
-
* Loading Events - Media loading and buffering
|
|
21
|
-
*/
|
|
22
|
-
readonly loading: readonly ["loadstart", "loadeddata", "loadedmetadata", "canplay", "canplaythrough", "progress", "waiting", "durationchange"];
|
|
23
|
-
/**
|
|
24
|
-
* Media State Events - Volume, rate, dimensions
|
|
25
|
-
*/
|
|
26
|
-
readonly mediaState: readonly ["volumechange", "ratechange", "resize"];
|
|
27
|
-
/**
|
|
28
|
-
* Network/Error Events - Network issues and errors
|
|
29
|
-
*/
|
|
30
|
-
readonly network: readonly ["abort", "emptied", "stalled", "suspend", "error"];
|
|
31
|
-
/**
|
|
32
|
-
* Custom Player Events - Wontum Player specific
|
|
33
|
-
*/
|
|
34
|
-
readonly custom: readonly ["qualitychange", "fullscreenchange"];
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Minimal event listener example
|
|
38
|
-
*/
|
|
39
|
-
export declare function minimalEventExample(): void;
|
|
40
|
-
/**
|
|
41
|
-
* React example with all events
|
|
42
|
-
*/
|
|
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
|
-
/**
|
|
45
|
-
* Compare with Mux Player events
|
|
46
|
-
*/
|
|
47
|
-
export declare const MuxPlayerCompatibility: {
|
|
48
|
-
muxPlayerEvents: string[];
|
|
49
|
-
wontumExtensions: string[];
|
|
50
|
-
allSupported: boolean;
|
|
51
|
-
totalEvents: number;
|
|
52
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { WontumPlayer } from '../src/index';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Example 1: Basic public stream
|
|
5
|
-
*/
|
|
6
|
-
export declare function basicPublicStream(): WontumPlayer;
|
|
7
|
-
/**
|
|
8
|
-
* Example 2: With event logging
|
|
9
|
-
*/
|
|
10
|
-
export declare function publicStreamWithEvents(): WontumPlayer;
|
|
11
|
-
/**
|
|
12
|
-
* Example 3: Multiple quality levels
|
|
13
|
-
*/
|
|
14
|
-
export declare function adaptiveStreamTest(): WontumPlayer;
|
|
15
|
-
/**
|
|
16
|
-
* Public HLS Test Streams
|
|
17
|
-
*/
|
|
18
|
-
export declare const PUBLIC_TEST_STREAMS: {
|
|
19
|
-
appleBasic: string;
|
|
20
|
-
apple4K: string;
|
|
21
|
-
muxDemo: string;
|
|
22
|
-
bigBuckBunny: string;
|
|
23
|
-
tearsOfSteel: string;
|
|
24
|
-
sintel: string;
|
|
25
|
-
multiBitrate: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Quick test function - just paste into console
|
|
29
|
-
*/
|
|
30
|
-
export declare function quickTest(streamUrl?: string): WontumPlayer;
|
|
31
|
-
/**
|
|
32
|
-
* HTML Example for quick testing
|
|
33
|
-
*/
|
|
34
|
-
export declare const htmlExample = "\n<!DOCTYPE html>\n<html>\n<head>\n <title>Wontum Player Test</title>\n <style>\n body { \n margin: 0; \n padding: 20px; \n font-family: Arial, sans-serif; \n background: #1a1a1a;\n color: white;\n }\n #player { \n width: 100%; \n max-width: 1200px; \n height: 600px; \n background: #000;\n margin: 20px auto;\n }\n .info {\n max-width: 1200px;\n margin: 0 auto;\n padding: 20px;\n }\n </style>\n</head>\n<body>\n <div class=\"info\">\n <h1>\uD83C\uDFAC Wontum Player Test</h1>\n <p>Testing with public HLS stream (no authentication required)</p>\n </div>\n \n <div id=\"player\"></div>\n\n <script type=\"module\">\n import { WontumPlayer } from './dist/index.js';\n \n const player = new WontumPlayer({\n src: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',\n container: '#player',\n autoplay: true,\n controls: true,\n analytics: {\n enabled: true\n }\n });\n\n // Log events\n player.on('loadedmetadata', (e) => {\n console.log('Duration:', e.data.duration);\n });\n \n player.on('play', () => console.log('Playing!'));\n player.on('pause', () => console.log('Paused'));\n player.on('error', (e) => console.error('Error:', e.data));\n \n // Make player available in console\n window.player = player;\n </script>\n</body>\n</html>\n";
|
|
35
|
-
/**
|
|
36
|
-
* React example with public stream
|
|
37
|
-
*/
|
|
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";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example 1: Basic React Player
|
|
3
|
-
*/
|
|
4
|
-
export declare function BasicPlayer(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
/**
|
|
6
|
-
* Example 2: Player with Event Handlers
|
|
7
|
-
*/
|
|
8
|
-
export declare function PlayerWithEvents(): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
/**
|
|
10
|
-
* Example 3: Custom Controls with useWontumPlayer Hook
|
|
11
|
-
*/
|
|
12
|
-
export declare function CustomControls(): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export declare function S3Player(): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
/**
|
|
15
|
-
* Example 5: Player with Analytics
|
|
16
|
-
*/
|
|
17
|
-
export declare function AnalyticsPlayer({ videoId, userId }: {
|
|
18
|
-
videoId: string;
|
|
19
|
-
userId: string;
|
|
20
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
/**
|
|
22
|
-
* Example 6: Playlist Player
|
|
23
|
-
*/
|
|
24
|
-
export declare function PlaylistPlayer(): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
/**
|
|
26
|
-
* Example 7: Player with Custom Theme
|
|
27
|
-
*/
|
|
28
|
-
export declare function ThemedPlayer(): import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
/**
|
|
30
|
-
* Example 8: Responsive Player
|
|
31
|
-
*/
|
|
32
|
-
export declare function ResponsivePlayer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { WontumPlayer } from '../src/index';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Example 1: Basic Player Setup
|
|
5
|
-
*/
|
|
6
|
-
declare function basicPlayerExample(): WontumPlayer;
|
|
7
|
-
/**
|
|
8
|
-
* Example 2: Player with Event Listeners
|
|
9
|
-
*/
|
|
10
|
-
declare function playerWithEventsExample(): WontumPlayer;
|
|
11
|
-
/**
|
|
12
|
-
* Example 3: Programmatic Control
|
|
13
|
-
*/
|
|
14
|
-
declare function programmaticControlExample(): WontumPlayer;
|
|
15
|
-
/**
|
|
16
|
-
* Example 4: S3 Integration
|
|
17
|
-
* Note: Install AWS SDK with: npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
|
|
18
|
-
*/
|
|
19
|
-
declare function s3IntegrationExample(): Promise<WontumPlayer>;
|
|
20
|
-
/**
|
|
21
|
-
* Example 5: Backend Presigned URL Generation
|
|
22
|
-
*/
|
|
23
|
-
declare function backendPresignedUrlExample(): Promise<WontumPlayer>;
|
|
24
|
-
/**
|
|
25
|
-
* Example 6: Analytics Integration
|
|
26
|
-
*/
|
|
27
|
-
declare function analyticsExample(): WontumPlayer;
|
|
28
|
-
/**
|
|
29
|
-
* Example 7: Quality Selection
|
|
30
|
-
*/
|
|
31
|
-
declare function qualitySelectionExample(): WontumPlayer;
|
|
32
|
-
/**
|
|
33
|
-
* Example 8: Multiple Players on One Page
|
|
34
|
-
*/
|
|
35
|
-
declare function multiplePlayersExample(): WontumPlayer[];
|
|
36
|
-
/**
|
|
37
|
-
* Example 9: Custom HLS Configuration
|
|
38
|
-
*/
|
|
39
|
-
declare function customHlsConfigExample(): WontumPlayer;
|
|
40
|
-
/**
|
|
41
|
-
* Example 10: Playlist with Auto-advance
|
|
42
|
-
*/
|
|
43
|
-
declare function playlistExample(): {
|
|
44
|
-
next: () => void;
|
|
45
|
-
previous: () => void;
|
|
46
|
-
goto: (index: number) => void;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Example 11: Save and Resume Playback Position
|
|
50
|
-
*/
|
|
51
|
-
declare function saveResumeExample(): WontumPlayer;
|
|
52
|
-
/**
|
|
53
|
-
* Example 12: Picture-in-Picture
|
|
54
|
-
*/
|
|
55
|
-
declare function pictureInPictureExample(): Promise<WontumPlayer>;
|
|
56
|
-
export { basicPlayerExample, playerWithEventsExample, programmaticControlExample, s3IntegrationExample, backendPresignedUrlExample, analyticsExample, qualitySelectionExample, multiplePlayersExample, customHlsConfigExample, playlistExample, saveResumeExample, pictureInPictureExample, };
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { WontumPlayer } from './player';
|
|
2
|
-
export { Analytics } from './analytics';
|
|
3
|
-
export { S3Handler } from './s3-handler';
|
|
4
|
-
export { UIController } from './ui-controller';
|
|
5
|
-
export { WontumFileInfo } from './file-info';
|
|
6
|
-
export { WontumPlayerReact, useWontumPlayer, WontumPlayerProvider, useWontumPlayerContext, useVideoFileInfo, useAnalytics } from './react';
|
|
7
|
-
export type { WontumPlayerConfig, PlayerTheme, S3Config, AnalyticsConfig, WebSocketAnalyticsHandler, SocketIOAnalyticsHandler, PlayerState, PlayerEvent, PlayerEventType, AnalyticsEvent, QualityLevel, } from './types';
|
|
8
|
-
export type { VideoFileInfo } from './file-info';
|
|
9
|
-
export type { WontumPlayerReactProps, UseVideoFileInfoResult, UseAnalyticsResult } from './react';
|
package/dist/src/test-app.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|