videojs-rewind 0.1.0

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 ADDED
@@ -0,0 +1,87 @@
1
+ # videojs-rewind
2
+
3
+ A Live DVR Rewind Plugin for video.js — full-stream seek bar, rewind-to-VOD, quality enforcement, and storyboard thumbnails for live HLS playback.
4
+
5
+ ## Features
6
+
7
+ - **Custom Seek Bar** — Full-width seek bar that replaces the native `ProgressControl`. Shows stream position relative to the full stream duration (not just the DVR window).
8
+ - **Live/VOD Timer** — Displays "Live" when at the live edge, or `currentTime / totalTime` (e.g., `1:23:45 / 5:15:00`) when seeking through VOD content.
9
+ - **Rewind-to-VOD** — When the user seeks behind the DVR window, automatically fetches a VOD HLS URL and swaps the source. Provides a "Go Live" button to return to the live stream.
10
+ - **Quality Enforcement** — Locks the player to a user-preferred quality level (e.g., 1080p) across source swaps, with an ABR suppression window to avoid thrashing during initial ramp-up.
11
+ - **Storyboard / Seek Thumbnails** — On seek hover, displays a sprite-sheet-based thumbnail preview above the seek bar.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @ashleyjackson/videojs-rewind
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```javascript
22
+ import videojs from 'video.js';
23
+ import '@videojs/http-streaming';
24
+ import 'videojs-contrib-quality-levels';
25
+ import '@ashleyjackson/videojs-rewind';
26
+
27
+ const player = videojs('my-player', {
28
+ controls: true,
29
+ autoplay: true,
30
+ liveui: true,
31
+ html5: {
32
+ hls: {
33
+ overrideNative: true,
34
+ enableLowInitialPlaylist: true
35
+ }
36
+ },
37
+ plugins: {
38
+ rewind: {
39
+ preferredQuality: 1080,
40
+ enableRewindToVod: true,
41
+ resolveVodUrl: async (channel, seekTime) => {
42
+ const vodId = await fetchVodForChannel(channel, seekTime);
43
+ const hlsUrl = await getSignedVodUrl(vodId);
44
+ return { vodId, hlsUrl };
45
+ },
46
+ storyboard: {
47
+ fetchInfo: async (vodId, cdnBaseUrl) => {
48
+ const res = await fetch(`${cdnBaseUrl}/../storyboards/${vodId}-info.json`);
49
+ return res.json();
50
+ }
51
+ }
52
+ }
53
+ }
54
+ });
55
+ ```
56
+
57
+ ## Options
58
+
59
+ | Option | Type | Default | Description |
60
+ |--------|------|---------|-------------|
61
+ | `customSeekBar` | `boolean` | `true` | Enable custom seek bar (replaces native ProgressControl) |
62
+ | `showTotalTime` | `boolean` | `true` | Show total stream time in timer display |
63
+ | `enableRewindToVod` | `boolean` | `true` | Enable rewind-to-VOD flow |
64
+ | `resolveVodUrl` | `function` | `null` | Callback to resolve a VOD URL when seeking behind DVR window |
65
+ | `preferredQuality` | `number \| "auto"` | `"auto"` | Preferred quality height (e.g., `1080`) or `"auto"` for ABR |
66
+ | `persistQuality` | `boolean` | `true` | Persist quality preference to localStorage |
67
+ | `storageKeyPrefix` | `string` | `"videojs-rewind:"` | Prefix for localStorage keys |
68
+ | `storyboard` | `object` | `null` | Storyboard configuration (`fetchInfo`, `previewWidth`, `previewHeight`) |
69
+ | `dvrWindowThreshold` | `number` | `120` | Seconds before rewind-to-VOD triggers |
70
+ | `showToasts` | `boolean` | `true` | Show toast notifications |
71
+
72
+ ## Development
73
+
74
+ ```bash
75
+ # Install dependencies
76
+ bun install
77
+
78
+ # Build
79
+ bun run build
80
+
81
+ # Test
82
+ bun test
83
+ ```
84
+
85
+ ## License
86
+
87
+ MIT
@@ -0,0 +1,10 @@
1
+ /**
2
+ * videojs-rewind
3
+ * A Live DVR Rewind Plugin for video.js
4
+ *
5
+ * @license MIT
6
+ */
7
+ import RewindPlugin from './plugin.js';
8
+ export default RewindPlugin;
9
+ export type { RewindPluginOptions } from './types.js';
10
+ export { RewindPluginOptionsSchema } from './schema.js';