23 lines
680 B
Diff
23 lines
680 B
Diff
--- a/frontend/opfs.js
|
|
+++ b/frontend/opfs.js
|
|
@@ -108,6 +108,19 @@
|
|
}
|
|
},
|
|
|
|
+ // Bytes [offset, offset+length) of a saved video — answers the server's
|
|
+ // P2P range challenges (p2p-client.js). null when the file is missing.
|
|
+ async readRange(videoId, offset, length) {
|
|
+ try {
|
|
+ const found = await findHandle(videoId);
|
|
+ if (!found) return null;
|
|
+ const file = await found[0].getFile();
|
|
+ return new Uint8Array(await file.slice(offset, offset + length).arrayBuffer());
|
|
+ } catch {
|
|
+ return null;
|
|
+ }
|
|
+ },
|
|
+
|
|
revokeUrl(url) {
|
|
if (url && _blobUrls.has(url)) {
|
|
URL.revokeObjectURL(url);
|