pict-section-video 1.0.0 → 1.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/LICENSE +21 -0
- package/README.md +154 -20
- package/package.json +1 -1
- package/source/Pict-Section-Video-DefaultConfiguration.js +86 -3
- package/source/Pict-Section-Video-Strategy.js +465 -0
- package/source/Pict-Section-Video.js +1718 -152
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Steven Velozo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
A bespoke, responsive **video player** section for the Retold/Pict ecosystem. Point it at a video URL and it fits
|
|
4
4
|
the whole frame to its stage on phones, tablets, desktops, TVs, and projected displays — with its own control bar
|
|
5
|
-
(play/pause, a seek scrubber, a time readout, mute + volume, a playback-rate cycle,
|
|
6
|
-
Seeking rides the browser's native HTTP **Range** requests, so a range-served file
|
|
7
|
-
[`orator-file-service`](https://github.com/fable-retold/orator-file-service) route, a Sluice depot, a bare 206
|
|
8
|
-
scrubs without downloading the whole clip.
|
|
5
|
+
(play/pause, a seek scrubber with a buffered bar, a time readout, mute + volume, a playback-rate cycle, a quality
|
|
6
|
+
menu, download, and fullscreen). Seeking rides the browser's native HTTP **Range** requests, so a range-served file
|
|
7
|
+
(an [`orator-file-service`](https://github.com/fable-retold/orator-file-service) route, a Sluice depot, a bare 206
|
|
8
|
+
URL) scrubs without downloading the whole clip.
|
|
9
|
+
|
|
10
|
+
It also plays **adaptive (HLS) streams**: natively on Safari (AirPlay, PiP, the lock screen and native fullscreen
|
|
11
|
+
come free) and through a **host-supplied [hls.js](https://github.com/video-dev/hls.js) 1.7.4 light** build
|
|
12
|
+
everywhere else, with an Auto / per-rung / Data-saver quality menu that remembers the reader's pick.
|
|
9
13
|
|
|
10
14
|
It is a single [`pict-view`](https://github.com/fable-retold/pict-view) in the lightweight single-view shape
|
|
11
15
|
(like `pict-section-image`): a stub container template, with the player DOM built imperatively — a `<video>` is
|
|
@@ -21,7 +25,8 @@ Usable on its own, or driven as the video renderer inside
|
|
|
21
25
|
npm install pict-section-video
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
The only hard dependency is `pict-view`.
|
|
28
|
+
The only hard dependency is `pict-view`. **hls.js is never bundled or required** — see
|
|
29
|
+
[Adaptive streaming](#adaptive-streaming-hls) for how a host supplies it.
|
|
25
30
|
|
|
26
31
|
## Usage
|
|
27
32
|
|
|
@@ -39,46 +44,175 @@ pict.views.MyVideo.render();
|
|
|
39
44
|
|
|
40
45
|
// …or point it at a video later:
|
|
41
46
|
pict.views.MyVideo.setVideo('https://host/other.webm');
|
|
42
|
-
pict.views.MyVideo.
|
|
47
|
+
pict.views.MyVideo.setSource({ URL: 'https://host/talk.mp4', Title: 'The Talk', PosterURL: 'https://host/art.jpg' });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Adaptive streaming (HLS)
|
|
51
|
+
|
|
52
|
+
Hand `setSource()` a descriptor with a `Stream` (the shape `pict-section-fileview`'s `descriptorFromMediaPackage()`
|
|
53
|
+
builds from a `retold-media-ladder` package):
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
pict.views.MyVideo.setSource(
|
|
57
|
+
{
|
|
58
|
+
URL: '/media/1a2b3c4d/master.m3u8',
|
|
59
|
+
Title: 'Coast flight',
|
|
60
|
+
PosterURL: '/media/1a2b3c4d/poster.jpg',
|
|
61
|
+
Duration: 312, // seconds; shown until metadata loads
|
|
62
|
+
DownloadURL: null, // null = no download affordance anywhere
|
|
63
|
+
Stream:
|
|
64
|
+
{
|
|
65
|
+
Type: 'hls',
|
|
66
|
+
Manifest: '/media/1a2b3c4d/master.m3u8',
|
|
67
|
+
Renditions: [ { Name: '1080p', ShortSide: 1080, Width: 1920, Height: 1080, Bandwidth: 6234000,
|
|
68
|
+
Playlist: '/media/1a2b3c4d/v0/index.m3u8' } /* … */ ],
|
|
69
|
+
ProgressiveURL: null // '/media/1a2b3c4d/download.mp4' when downloads are allowed
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Supplying hls.js (host-side)
|
|
75
|
+
|
|
76
|
+
hls.js **1.7.4, light build** (`hls.light.min.js`, ~120 KB gzip) is the supported version. The host loads it and
|
|
77
|
+
either passes the class in config or leaves it on the page global:
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<script src="./hls.light.min.js"></script> <!-- copied from node_modules/hls.js/dist/ -->
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
// Either: config (wins) …
|
|
85
|
+
pict.addView('MyVideo', Object.assign({}, libPictSectionVideo.default_configuration,
|
|
86
|
+
{ HlsLibrary: window.Hls, HlsConfig: { maxBufferLength: 20 } }), libPictSectionVideo);
|
|
87
|
+
// … or: nothing — the player falls back to window.Hls.
|
|
43
88
|
```
|
|
44
89
|
|
|
45
|
-
|
|
90
|
+
The light build is enough because ladder packages mux audio into each rung (no alternate audio groups) and need no
|
|
91
|
+
`EXT-X-DEFINE`. Without hls.js the player still plays HLS where the browser does natively, and otherwise falls
|
|
92
|
+
back to `Stream.ProgressiveURL`.
|
|
93
|
+
|
|
94
|
+
### How a playback path is chosen
|
|
95
|
+
|
|
96
|
+
`source/Pict-Section-Video-Strategy.js` is a pure resolver (`resolveStrategy(source, video, Hls, window)`):
|
|
97
|
+
|
|
98
|
+
| Browser | Strategy |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `canPlayType('application/vnd.apple.mpegurl')` **and** `'ManagedMediaSource' in window` (Safari) | `native-hls` |
|
|
101
|
+
| hls.js present and `Hls.isSupported()` (Chrome, Firefox, Edge) | `hls.js` |
|
|
102
|
+
| `canPlayType` passes, no MMS, no hls.js (iOS before 17.1) | `native-hls` |
|
|
103
|
+
| No HLS path but `Stream.ProgressiveURL` — or a plain (non-`Stream`) source | `progressive` |
|
|
104
|
+
| Nothing | `unsupported` (error state) |
|
|
105
|
+
|
|
106
|
+
Under hls.js the player merges `HlsConfig` over `{ autoStartLoad:false, maxBufferLength:30, maxMaxBufferLength:60,
|
|
107
|
+
capLevelToPlayerSize:true }`: the manifest loads on mount, fragments only on the first play (from the play button,
|
|
108
|
+
the `<video>` itself, autoplay or the OS media keys). A first visit leaves `startLevel` unset (hls.js starts on the
|
|
109
|
+
master's first variant — the ladder puts the ~540p rung there); once a fragment has been measured over the
|
|
110
|
+
network the bandwidth estimate is saved beside the quality pick and later visits start with
|
|
111
|
+
`{ startLevel:-1, testBandwidth:false, abrEwmaDefaultEstimate:<saved> }`. A fragment served from the HTTP cache or
|
|
112
|
+
over loopback is not a measurement (hls.js reads one as ~800 Mbps), and the saved value never exceeds the fastest
|
|
113
|
+
fragment that actually crossed the network.
|
|
114
|
+
|
|
115
|
+
The `<video>` box fills the stage and letterboxes the frame (`width/height:100%; object-fit:contain`), so
|
|
116
|
+
`capLevelToPlayerSize` measures the player, not the rung being decoded, and Auto can climb past its starting rung.
|
|
117
|
+
|
|
118
|
+
### Quality menu
|
|
119
|
+
|
|
120
|
+
A **Quality** button after the speed button opens a `role=menu` popover (arrow keys, Home/End, `Esc`):
|
|
121
|
+
|
|
122
|
+
- **Auto (720p)** — adaptive; the label follows hls.js `LEVEL_SWITCHED`, or the `<video>`'s `videoHeight` on
|
|
123
|
+
`resize` under native HLS.
|
|
124
|
+
- **One entry per rung** — `1080p · 6 Mbps`, named by the short side (a portrait 1080×1920 rung is `1080p`).
|
|
125
|
+
Under hls.js a pick sets `hls.nextLevel` while playing (the next fragment switches — no restart) or
|
|
126
|
+
`hls.currentLevel` while paused. Under native HLS it loads that rung's `Playlist` at the same position.
|
|
127
|
+
- **Data saver** — caps hls.js `autoLevelCapping` at the rung `<= SaverMaxHeight` (540), or loads that rung's
|
|
128
|
+
playlist under native HLS.
|
|
129
|
+
|
|
130
|
+
The pick persists in `localStorage` under `QualityStorageKey` (every access guarded — private mode and disabled
|
|
131
|
+
storage just keep the pick in memory). The button hides when a source has fewer than two rungs, for a progressive
|
|
132
|
+
file, or with `ShowQuality:false`.
|
|
133
|
+
|
|
134
|
+
### Errors and fallback
|
|
135
|
+
|
|
136
|
+
| Failure | Response |
|
|
137
|
+
|---|---|
|
|
138
|
+
| hls.js `NETWORK_ERROR` with HTTP 401 / 403 / 404 / 410 | Error state: "This link has expired or been revoked." |
|
|
139
|
+
| Other fatal hls.js network error | Retry (`startLoad()`, or `loadSource()` before the manifest parsed) up to 3×, then fall back |
|
|
140
|
+
| Fatal hls.js `MEDIA_ERROR` (or a `<video>` error under hls.js) | `recoverMediaError()` once, then fall back |
|
|
141
|
+
| Anything else, or retries exhausted | Native HLS (if `canPlayType` passes) → `Stream.ProgressiveURL` → error state |
|
|
142
|
+
|
|
143
|
+
The reader's position carries across every fallback step. `destroy()` calls `hls.destroy()`.
|
|
144
|
+
|
|
145
|
+
### Download links
|
|
146
|
+
|
|
147
|
+
| `DownloadURL` | Control bar + error state |
|
|
148
|
+
|---|---|
|
|
149
|
+
| absent / `''` / `false` | The playing URL — for an HLS source, `Stream.ProgressiveURL` (never the playlist), else nothing |
|
|
150
|
+
| `null` | **No download affordance anywhere** (control bar and error-state link) |
|
|
151
|
+
| a non-empty string | That URL |
|
|
152
|
+
|
|
153
|
+
## Mobile
|
|
154
|
+
|
|
155
|
+
- **Fullscreen** is real: `requestFullscreen()` on the player root (desktop, Android, iPad), `webkitEnterFullscreen()`
|
|
156
|
+
on the `<video>` on iPhone (the native player), and the fill-the-viewport CSS maximize where neither exists (or
|
|
157
|
+
the request is refused). `fullscreenchange` / `webkitendfullscreen` keep `isFullscreen()` honest — including an
|
|
158
|
+
exit made while the `requestFullscreen()` is still in flight, which is undone as soon as the request lands.
|
|
159
|
+
- **Buffering**: `waiting` / `seeking` raise a spinner, `playing` / `canplay` / `seeked` lower it, and `progress`
|
|
160
|
+
grows a buffered bar under the seek track.
|
|
161
|
+
- **Volume**: iOS ignores scripted volume writes, so the volume slider hides there (mute still works).
|
|
162
|
+
- `playsinline` keeps iPhone playback inline until the reader asks for fullscreen.
|
|
163
|
+
|
|
164
|
+
## Configuration
|
|
46
165
|
|
|
47
166
|
| Key | Meaning |
|
|
48
167
|
|---|---|
|
|
49
|
-
| `VideoURL` | Initial video URL (or `false` for an empty player until `setVideo()`). |
|
|
168
|
+
| `VideoURL` | Initial video URL (or `false` for an empty player until `setSource()` / `setVideo()`). |
|
|
50
169
|
| `PosterURL` | A poster image shown before playback (`<video poster>`). |
|
|
51
170
|
| `Title` | A human title (used as the download filename hint). |
|
|
52
|
-
| `DownloadURL` / `DownloadName` | Explicit download href + filename hint
|
|
171
|
+
| `DownloadURL` / `DownloadName` | Explicit download href + filename hint. Absent falls back to the playing URL; `null` = no download anywhere. |
|
|
53
172
|
| `AutoPlay` / `Loop` / `Muted` | Mapped onto the `<video>` element (defaults off). |
|
|
54
|
-
| `Preload` | `'metadata'` (default), `'none'
|
|
173
|
+
| `Preload` | `'metadata'` (default), `'none'` (share pages: nothing loads before play), or `'auto'` (also starts hls.js loading at once). |
|
|
55
174
|
| `ShowToolbar` | Render the control bar (default on). Set `false` when a host owns the chrome. |
|
|
56
175
|
| `ShowDownload` | Show the download affordance in the control bar (default on). |
|
|
57
|
-
| `ShowFullscreen` | Show the
|
|
176
|
+
| `ShowFullscreen` | Show the fullscreen button (default on). |
|
|
58
177
|
| `ClickToPlay` | Clicking the video toggles play/pause (default on). |
|
|
59
178
|
| `PlaybackRates` | The rate cycle the speed button steps through (default `[0.5, 1, 1.25, 1.5, 2]`). |
|
|
60
179
|
| `Volume` | Initial volume `0..1` (default `1`). |
|
|
180
|
+
| `HlsLibrary` | The hls.js class (default `null` → `window.Hls`). Never bundled. |
|
|
181
|
+
| `HlsConfig` | Merged over the player's hls.js defaults (default `{}`; host keys win). |
|
|
182
|
+
| `ShowQuality` | Show the quality menu (default on; hidden anyway with fewer than two rungs). |
|
|
183
|
+
| `ShowDataSaver` | Offer the Data saver entry (default on). |
|
|
184
|
+
| `QualityStorageKey` | `localStorage` key for the pick + bandwidth estimate (default `'pict-section-video-quality'`; `''` disables). |
|
|
185
|
+
| `SaverMaxHeight` | Data saver ceiling as a short side in pixels (default `540`). |
|
|
61
186
|
| `TargetElementAddress`, `DefaultDestinationAddress`, `RenderOnLoad` | Standard pict-view placement. |
|
|
62
187
|
|
|
63
|
-
|
|
188
|
+
## Public API
|
|
64
189
|
|
|
65
190
|
| Method | Does |
|
|
66
191
|
|---|---|
|
|
67
|
-
| `
|
|
192
|
+
| `setSource(descriptor)` | Point the player at `{ URL, Stream?, PosterURL?, Title?, Name?, DownloadURL?, DownloadName?, Duration? }` and pick its playback path; resets to the start. For HLS the played URL is `Stream.Manifest \|\| URL`. |
|
|
193
|
+
| `setVideo(urlOrDescriptor)` | Shorthand: a string → `setSource({ URL })`, an object → `setSource(object)`. |
|
|
194
|
+
| `getStrategy()` | `'native-hls'`, `'hls.js'`, `'progressive'`, `'unsupported'` (`''` before a load). |
|
|
195
|
+
| `getQualityLevels()` | `[{ Index, Height (short side), Width, PixelHeight, Bandwidth, Label }]`, highest first; `[]` for progressive. |
|
|
196
|
+
| `setQuality('auto' \| 'saver' \| shortSide)` / `getQuality()` | Pick (and persist) a quality. |
|
|
197
|
+
| `toggleQualityMenu()` | Open / close the quality menu. |
|
|
68
198
|
| `play()` / `pause()` / `togglePlay()` | Playback control. |
|
|
69
199
|
| `seekTo(seconds)` | Seek to an absolute time (clamped to the duration). |
|
|
70
200
|
| `setVolume(0..1)` / `toggleMute()` | Volume control. |
|
|
71
201
|
| `setPlaybackRate(rate)` / `cyclePlaybackRate()` | Playback speed. |
|
|
72
|
-
| `
|
|
73
|
-
| `getState()` | `{ URL, Loaded, Error, Playing, Duration, CurrentTime, Muted, Volume, PlaybackRate, Fullscreen }`. |
|
|
74
|
-
| `destroy()` | Detach handlers and clear the player. |
|
|
202
|
+
| `enterFullscreen()` / `exitFullscreen()` / `toggleFullscreen()` / `isFullscreen()` | Real fullscreen (see Mobile); `enterFullscreen()` returns `true` when it acted (or already is fullscreen). |
|
|
203
|
+
| `getState()` | `{ URL, Loaded, Error, ErrorMessage, Playing, Duration, CurrentTime, Muted, Volume, PlaybackRate, Fullscreen, Strategy, Quality, PlayingHeight, Levels, Buffered, Waiting }`. |
|
|
204
|
+
| `destroy()` | Detach handlers, tear down hls.js, leave fullscreen and clear the player. |
|
|
205
|
+
|
|
206
|
+
The strategy module is also exported as `require('pict-section-video').Strategy` (`resolveStrategy`,
|
|
207
|
+
`progressiveURL`, `HLS_MIME`, the quality-ladder helpers, and the saved-estimate helpers `fragmentNetworkBandwidth`
|
|
208
|
+
and `persistableEstimate`).
|
|
75
209
|
|
|
76
|
-
|
|
210
|
+
## Formats
|
|
77
211
|
|
|
78
|
-
|
|
212
|
+
A progressive source goes straight to a `<video>` element, so it plays whatever the host browser plays — the safe
|
|
79
213
|
web set is MP4 (H.264/AAC), WebM and Ogg. A container a browser cannot decode (AVI, MKV, WMV, …) is the host's
|
|
80
214
|
problem to transcode; inside `pict-section-fileview` such a file degrades to the download card rather than a dead
|
|
81
|
-
player.
|
|
215
|
+
player. Adaptive sources are HLS with fMP4 segments (see above).
|
|
82
216
|
|
|
83
217
|
## Examples
|
|
84
218
|
|
|
@@ -93,7 +227,7 @@ npm run example-serve # (from the module root) serve at http://localhost:<port
|
|
|
93
227
|
## Development
|
|
94
228
|
|
|
95
229
|
```bash
|
|
96
|
-
npm test # Mocha TDD via quackage (real jsdom document)
|
|
230
|
+
npm test # Mocha TDD via quackage (real jsdom document; a FakeHls stands in for hls.js)
|
|
97
231
|
npm run build # browser bundle via quackage
|
|
98
232
|
```
|
|
99
233
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-video",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Pict video player section — a bespoke, responsive video player (play/seek/time/volume/rate/fullscreen) that scrubs over native HTTP Range and renders well on phones, tablets, desktops and projected displays. Standalone, or driven as the video renderer inside pict-section-fileview.",
|
|
5
5
|
"main": "source/Pict-Section-Video.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,7 +34,8 @@ module.exports = (
|
|
|
34
34
|
"PosterURL": false,
|
|
35
35
|
// A human title shown by the player and used as the download filename hint.
|
|
36
36
|
"Title": "",
|
|
37
|
-
// An explicit download href + filename hint.
|
|
37
|
+
// An explicit download href + filename hint. Absent / false / '' falls back to the playing URL (for an HLS source,
|
|
38
|
+
// its Stream.ProgressiveURL); null means NO download affordance anywhere (control bar and error state).
|
|
38
39
|
"DownloadURL": false,
|
|
39
40
|
"DownloadName": "",
|
|
40
41
|
|
|
@@ -57,6 +58,22 @@ module.exports = (
|
|
|
57
58
|
// Initial volume (0..1).
|
|
58
59
|
"Volume": 1,
|
|
59
60
|
|
|
61
|
+
// Adaptive streaming (HLS). A source carrying Stream:{ Type:'hls', Manifest, Renditions, ProgressiveURL } plays
|
|
62
|
+
// natively on Safari and through hls.js elsewhere. hls.js is NEVER bundled or required: the host supplies it
|
|
63
|
+
// (hls.js 1.7.4 light, `hls.light.min.js`) either here or as the page global window.Hls.
|
|
64
|
+
"HlsLibrary": null,
|
|
65
|
+
// Merged over the player's hls.js defaults ({ autoStartLoad:false, maxBufferLength:30, maxMaxBufferLength:60,
|
|
66
|
+
// capLevelToPlayerSize:true }); host keys win.
|
|
67
|
+
"HlsConfig": {},
|
|
68
|
+
// The quality menu (Auto / one entry per rung / Data saver) — hidden anyway when a source has fewer than two rungs.
|
|
69
|
+
"ShowQuality": true,
|
|
70
|
+
// Offer the Data saver entry (caps adaptive playback at SaverMaxHeight).
|
|
71
|
+
"ShowDataSaver": true,
|
|
72
|
+
// localStorage key the quality pick (and the last bandwidth estimate) persist under; '' / false disables it.
|
|
73
|
+
"QualityStorageKey": "pict-section-video-quality",
|
|
74
|
+
// Data saver ceiling, as a short side in pixels (540 → the 540p rung or the closest one below it).
|
|
75
|
+
"SaverMaxHeight": 540,
|
|
76
|
+
|
|
60
77
|
"CSS": `.psv-root
|
|
61
78
|
{
|
|
62
79
|
display: flex;
|
|
@@ -92,7 +109,10 @@ module.exports = (
|
|
|
92
109
|
overflow: hidden;
|
|
93
110
|
background: #000;
|
|
94
111
|
}
|
|
95
|
-
|
|
112
|
+
/* The <video> box fills the stage and letterboxes the frame inside it (object-fit). A width/height:auto box would be
|
|
113
|
+
exactly as big as the rung it decodes (300x150 before metadata), so hls.js capLevelToPlayerSize would measure the
|
|
114
|
+
frame, not the player, and pin Auto at the starting rung; it would also leave the frame unscaled in fullscreen. */
|
|
115
|
+
.psv-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; cursor: pointer; }
|
|
96
116
|
.psv-loading, .psv-error
|
|
97
117
|
{
|
|
98
118
|
position: absolute;
|
|
@@ -140,7 +160,70 @@ module.exports = (
|
|
|
140
160
|
.psv-btn[disabled] { opacity: 0.45; cursor: default; }
|
|
141
161
|
.psv-rate { font-variant-numeric: tabular-nums; min-width: 2.6rem; }
|
|
142
162
|
.psv-time { font-size: 0.74rem; color: var(--theme-color-text-muted, #6b7686); font-variant-numeric: tabular-nums; min-width: 2.8rem; text-align: center; user-select: none; }
|
|
143
|
-
.psv-seek { flex: 1 1 auto; min-width: 4rem;
|
|
163
|
+
.psv-seek-wrap { position: relative; flex: 1 1 auto; min-width: 4rem; display: flex; align-items: center; }
|
|
164
|
+
.psv-seek { flex: 1 1 auto; min-width: 4rem; width: 100%; accent-color: var(--theme-color-brand-primary, #5650e6); cursor: pointer; }
|
|
165
|
+
/* The buffered bar: a thin strip along the bottom of the seek track, as wide as the buffered range ahead of the playhead. */
|
|
166
|
+
.psv-buffer-track { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--theme-color-border-light, #e8ebf0); pointer-events: none; overflow: hidden; }
|
|
167
|
+
.psv-buffered { display: block; height: 100%; width: 0; background: var(--theme-color-text-muted, #9aa3b0); opacity: 0.6; }
|
|
144
168
|
.psv-volume { width: 4.5rem; flex: 0 0 auto; accent-color: var(--theme-color-brand-primary, #5650e6); cursor: pointer; }
|
|
169
|
+
/* Buffering spinner, centred on the stage while the media waits for data. It fades in after a short delay so a quick
|
|
170
|
+
seek into buffered media never flashes it. */
|
|
171
|
+
.psv-spinner
|
|
172
|
+
{
|
|
173
|
+
position: absolute;
|
|
174
|
+
top: 50%;
|
|
175
|
+
left: 50%;
|
|
176
|
+
width: 2.4rem;
|
|
177
|
+
height: 2.4rem;
|
|
178
|
+
margin: -1.2rem 0 0 -1.2rem;
|
|
179
|
+
border-radius: 50%;
|
|
180
|
+
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
181
|
+
border-top-color: var(--theme-color-text-on-dark, #e8ebf0);
|
|
182
|
+
opacity: 0;
|
|
183
|
+
animation: psv-spin 0.9s linear infinite, psv-spinner-in 0.2s ease-out 0.35s forwards;
|
|
184
|
+
pointer-events: none;
|
|
185
|
+
}
|
|
186
|
+
@keyframes psv-spin { to { transform: rotate(360deg); } }
|
|
187
|
+
@keyframes psv-spinner-in { to { opacity: 1; } }
|
|
188
|
+
/* Quality menu: a button after the rate button that opens a role=menu popover above the control bar. */
|
|
189
|
+
.psv-quality-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
|
|
190
|
+
.psv-quality-btn { font-variant-numeric: tabular-nums; min-width: 3rem; }
|
|
191
|
+
.psv-quality-menu
|
|
192
|
+
{
|
|
193
|
+
position: absolute;
|
|
194
|
+
right: 0;
|
|
195
|
+
bottom: calc(100% + 6px);
|
|
196
|
+
z-index: 5;
|
|
197
|
+
min-width: 11rem;
|
|
198
|
+
padding: 0.3rem;
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
gap: 0.1rem;
|
|
202
|
+
border-radius: 8px;
|
|
203
|
+
border: 1px solid var(--theme-color-border-medium, #d5dbe3);
|
|
204
|
+
background: var(--theme-color-background-panel, #ffffff);
|
|
205
|
+
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
|
|
206
|
+
}
|
|
207
|
+
.psv-quality-item
|
|
208
|
+
{
|
|
209
|
+
display: flex;
|
|
210
|
+
align-items: center;
|
|
211
|
+
gap: 0.45rem;
|
|
212
|
+
width: 100%;
|
|
213
|
+
text-align: left;
|
|
214
|
+
font-size: 0.8rem;
|
|
215
|
+
padding: 0.4rem 0.55rem;
|
|
216
|
+
border: 0;
|
|
217
|
+
border-radius: 5px;
|
|
218
|
+
background: transparent;
|
|
219
|
+
color: var(--theme-color-text-secondary, #45505f);
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
white-space: nowrap;
|
|
222
|
+
font-variant-numeric: tabular-nums;
|
|
223
|
+
}
|
|
224
|
+
.psv-quality-item::before { content: ''; width: 0.45rem; height: 0.45rem; border-radius: 50%; flex: 0 0 auto; }
|
|
225
|
+
.psv-quality-item[aria-checked="true"] { color: var(--theme-color-text-primary, #1f2733); font-weight: 600; }
|
|
226
|
+
.psv-quality-item[aria-checked="true"]::before { background: var(--theme-color-brand-primary, #5650e6); }
|
|
227
|
+
.psv-quality-item:hover, .psv-quality-item:focus { background: var(--theme-color-background-secondary, #f2f4f7); outline: none; }
|
|
145
228
|
`
|
|
146
229
|
});
|