googlevideo 2.0.0 → 3.0.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 +9 -9
- package/README.md +79 -66
- package/dist/protos/generated/misc/common.d.ts +0 -15
- package/dist/protos/generated/misc/common.js +1 -134
- package/dist/protos/generated/video_streaming/buffered_range.d.ts +0 -15
- package/dist/protos/generated/video_streaming/buffered_range.js +1 -147
- package/dist/protos/generated/video_streaming/client_abr_state.d.ts +16 -38
- package/dist/protos/generated/video_streaming/client_abr_state.js +95 -319
- package/dist/protos/generated/video_streaming/crypto_params.d.ts +0 -17
- package/dist/protos/generated/video_streaming/crypto_params.js +1 -79
- package/dist/protos/generated/video_streaming/encrypted_player_request.d.ts +2 -19
- package/dist/protos/generated/video_streaming/encrypted_player_request.js +9 -106
- package/dist/protos/generated/video_streaming/format_initialization_metadata.d.ts +0 -15
- package/dist/protos/generated/video_streaming/format_initialization_metadata.js +1 -75
- package/dist/protos/generated/video_streaming/live_metadata.d.ts +17 -0
- package/dist/protos/generated/video_streaming/live_metadata.js +122 -0
- package/dist/protos/generated/video_streaming/media_capabilities.d.ts +0 -15
- package/dist/protos/generated/video_streaming/media_capabilities.js +1 -122
- package/dist/protos/generated/video_streaming/media_header.d.ts +0 -17
- package/dist/protos/generated/video_streaming/media_header.js +1 -128
- package/dist/protos/generated/video_streaming/next_request_policy.d.ts +0 -15
- package/dist/protos/generated/video_streaming/next_request_policy.js +1 -50
- package/dist/protos/generated/video_streaming/onesie_header.d.ts +0 -15
- package/dist/protos/generated/video_streaming/onesie_header.js +1 -123
- package/dist/protos/generated/video_streaming/onesie_header_type.d.ts +0 -2
- package/dist/protos/generated/video_streaming/onesie_header_type.js +1 -146
- package/dist/protos/generated/video_streaming/onesie_player_request.d.ts +1 -17
- package/dist/protos/generated/video_streaming/onesie_player_request.js +5 -50
- package/dist/protos/generated/video_streaming/onesie_player_response.d.ts +18 -16
- package/dist/protos/generated/video_streaming/onesie_player_response.js +19 -54
- package/dist/protos/generated/video_streaming/onesie_request.d.ts +2 -15
- package/dist/protos/generated/video_streaming/onesie_request.js +11 -84
- package/dist/protos/generated/video_streaming/playback_cookie.d.ts +0 -15
- package/dist/protos/generated/video_streaming/playback_cookie.js +1 -43
- package/dist/protos/generated/video_streaming/playback_start_policy.d.ts +0 -15
- package/dist/protos/generated/video_streaming/playback_start_policy.js +1 -66
- package/dist/protos/generated/video_streaming/proxy_status.d.ts +0 -2
- package/dist/protos/generated/video_streaming/proxy_status.js +1 -66
- package/dist/protos/generated/video_streaming/request_cancellation_policy.d.ts +0 -15
- package/dist/protos/generated/video_streaming/request_cancellation_policy.js +1 -66
- package/dist/protos/generated/video_streaming/sabr_error.d.ts +0 -15
- package/dist/protos/generated/video_streaming/sabr_error.js +1 -29
- package/dist/protos/generated/video_streaming/sabr_redirect.d.ts +0 -15
- package/dist/protos/generated/video_streaming/sabr_redirect.js +1 -22
- package/dist/protos/generated/video_streaming/stream_protection_status.d.ts +0 -15
- package/dist/protos/generated/video_streaming/stream_protection_status.js +1 -29
- package/dist/protos/generated/video_streaming/streamer_context.d.ts +0 -17
- package/dist/protos/generated/video_streaming/streamer_context.js +1 -351
- package/dist/protos/generated/video_streaming/time_range.d.ts +0 -15
- package/dist/protos/generated/video_streaming/time_range.js +1 -34
- package/dist/protos/generated/video_streaming/video_playback_abr_request.d.ts +1 -15
- package/dist/protos/generated/video_streaming/video_playback_abr_request.js +19 -257
- package/dist/src/core/ServerAbrStream.d.ts +1 -0
- package/dist/src/core/ServerAbrStream.js +34 -47
- package/dist/src/core/UMP.d.ts +25 -1
- package/dist/src/core/UMP.js +35 -19
- package/dist/src/utils/Protos.d.ts +3 -2
- package/dist/src/utils/Protos.js +3 -2
- package/package.json +59 -60
package/LICENSE
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 LuanRT
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 LuanRT
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,66 +1,79 @@
|
|
|
1
|
-
# What Is This?
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
# What Is This?
|
|
2
|
+
[](https://jsr.io/@luanrt/googlevideo)
|
|
3
|
+
[](https://www.npmjs.com/package/googlevideo)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
This is a collection of utilities for working with Google Video APIs, with a primary focus on UMP.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* [Video Streaming Protos](./protos/video_streaming/)
|
|
10
|
+
* [UMP (Parser)](./src/core/UMP.ts)
|
|
11
|
+
* [ServerAbrStream (SABR Client)](./src/core/ServerAbrStream.ts)
|
|
12
|
+
* [ChunkedDataBuffer (Buffer Manager)](./src/core/ChunkedDataBuffer.ts)
|
|
13
|
+
|
|
14
|
+
The protobuf definitions were extracted from YouTube's Android and iOS clients, and the UMP parser and buffer manager are based on the implementation currently found on youtube.com.
|
|
15
|
+
|
|
16
|
+
Usage examples can be found [here](./examples/).
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# NPM
|
|
22
|
+
npm install googlevideo
|
|
23
|
+
|
|
24
|
+
# JSR / Deno
|
|
25
|
+
npx jsr add @luanrt/googlevideo
|
|
26
|
+
deno add jsr:@luanrt/googlevideo
|
|
27
|
+
|
|
28
|
+
# GitHub
|
|
29
|
+
npm install LuanRT/googlevideo
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Basic Usage
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import GoogleVideo, { PART, Protos } from 'googlevideo';
|
|
36
|
+
|
|
37
|
+
const streamingUrl = 'https://abcd--a.googlevideo.com/videoplayback?...';
|
|
38
|
+
|
|
39
|
+
const response = await fetch(streamingUrl, { method: 'POST' });
|
|
40
|
+
|
|
41
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
42
|
+
|
|
43
|
+
const dataBuffer = new GoogleVideo.ChunkedDataBuffer();
|
|
44
|
+
dataBuffer.append(new Uint8Array(arrayBuffer));
|
|
45
|
+
|
|
46
|
+
const googUmp = new GoogleVideo.UMP(dataBuffer);
|
|
47
|
+
|
|
48
|
+
googUmp.parse((part) => {
|
|
49
|
+
switch (part.type) {
|
|
50
|
+
case PART.MEDIA_HEADER: {
|
|
51
|
+
console.log('[MediaHeader]:', Protos.MediaHeader.decode(part.data.chunks[0]));
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case PART.MEDIA: {
|
|
55
|
+
const headerId = part.data.getUint8(0);
|
|
56
|
+
const streamData = part.data.split(1).remainingBuffer;
|
|
57
|
+
console.log('[Media]:', `Header ID: ${headerId}`, `length: ${streamData.getLength()}`);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case PART.MEDIA_END: {
|
|
61
|
+
const headerId = part.data.getUint8(0);
|
|
62
|
+
console.log('[MediaEnd]:', `Header ID: ${headerId}`);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
default:
|
|
66
|
+
console.log('Unhandled part:', part.type);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For more advanced examples, including scenarios beyond just parsing responses, check out the [examples](./examples/).
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
Distributed under the [MIT](./LICENSE) License.
|
|
76
|
+
|
|
77
|
+
<p align="right">
|
|
78
|
+
(<a href="#top">back to top</a>)
|
|
79
|
+
</p>
|
|
@@ -26,22 +26,7 @@ export declare const FormatId: MessageFns<FormatId>;
|
|
|
26
26
|
export declare const InitRange: MessageFns<InitRange>;
|
|
27
27
|
export declare const IndexRange: MessageFns<IndexRange>;
|
|
28
28
|
export declare const KeyValuePair: MessageFns<KeyValuePair>;
|
|
29
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
30
|
-
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
31
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
32
|
-
} : Partial<T>;
|
|
33
|
-
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
34
|
-
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
35
|
-
[K in keyof P]: Exact<P[K], I[K]>;
|
|
36
|
-
} & {
|
|
37
|
-
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
38
|
-
};
|
|
39
29
|
export interface MessageFns<T> {
|
|
40
30
|
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
41
31
|
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
42
|
-
fromJSON(object: any): T;
|
|
43
|
-
toJSON(message: T): unknown;
|
|
44
|
-
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
45
|
-
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
46
32
|
}
|
|
47
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.2.0
|
|
4
|
-
// protoc
|
|
4
|
+
// protoc v3.21.12
|
|
5
5
|
// source: misc/common.proto
|
|
6
6
|
/* eslint-disable */
|
|
7
7
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
@@ -46,31 +46,6 @@ export const HttpHeader = {
|
|
|
46
46
|
}
|
|
47
47
|
return message;
|
|
48
48
|
},
|
|
49
|
-
fromJSON(object) {
|
|
50
|
-
return {
|
|
51
|
-
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
|
52
|
-
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
toJSON(message) {
|
|
56
|
-
const obj = {};
|
|
57
|
-
if (message.name !== undefined && message.name !== "") {
|
|
58
|
-
obj.name = message.name;
|
|
59
|
-
}
|
|
60
|
-
if (message.value !== undefined && message.value !== "") {
|
|
61
|
-
obj.value = message.value;
|
|
62
|
-
}
|
|
63
|
-
return obj;
|
|
64
|
-
},
|
|
65
|
-
create(base) {
|
|
66
|
-
return HttpHeader.fromPartial(base ?? {});
|
|
67
|
-
},
|
|
68
|
-
fromPartial(object) {
|
|
69
|
-
const message = createBaseHttpHeader();
|
|
70
|
-
message.name = object.name ?? "";
|
|
71
|
-
message.value = object.value ?? "";
|
|
72
|
-
return message;
|
|
73
|
-
},
|
|
74
49
|
};
|
|
75
50
|
function createBaseFormatId() {
|
|
76
51
|
return { itag: 0, lastModified: 0, xtags: "" };
|
|
@@ -121,36 +96,6 @@ export const FormatId = {
|
|
|
121
96
|
}
|
|
122
97
|
return message;
|
|
123
98
|
},
|
|
124
|
-
fromJSON(object) {
|
|
125
|
-
return {
|
|
126
|
-
itag: isSet(object.itag) ? globalThis.Number(object.itag) : 0,
|
|
127
|
-
lastModified: isSet(object.lastModified) ? globalThis.Number(object.lastModified) : 0,
|
|
128
|
-
xtags: isSet(object.xtags) ? globalThis.String(object.xtags) : "",
|
|
129
|
-
};
|
|
130
|
-
},
|
|
131
|
-
toJSON(message) {
|
|
132
|
-
const obj = {};
|
|
133
|
-
if (message.itag !== undefined && message.itag !== 0) {
|
|
134
|
-
obj.itag = Math.round(message.itag);
|
|
135
|
-
}
|
|
136
|
-
if (message.lastModified !== undefined && message.lastModified !== 0) {
|
|
137
|
-
obj.lastModified = Math.round(message.lastModified);
|
|
138
|
-
}
|
|
139
|
-
if (message.xtags !== undefined && message.xtags !== "") {
|
|
140
|
-
obj.xtags = message.xtags;
|
|
141
|
-
}
|
|
142
|
-
return obj;
|
|
143
|
-
},
|
|
144
|
-
create(base) {
|
|
145
|
-
return FormatId.fromPartial(base ?? {});
|
|
146
|
-
},
|
|
147
|
-
fromPartial(object) {
|
|
148
|
-
const message = createBaseFormatId();
|
|
149
|
-
message.itag = object.itag ?? 0;
|
|
150
|
-
message.lastModified = object.lastModified ?? 0;
|
|
151
|
-
message.xtags = object.xtags ?? "";
|
|
152
|
-
return message;
|
|
153
|
-
},
|
|
154
99
|
};
|
|
155
100
|
function createBaseInitRange() {
|
|
156
101
|
return { start: 0, end: 0 };
|
|
@@ -192,31 +137,6 @@ export const InitRange = {
|
|
|
192
137
|
}
|
|
193
138
|
return message;
|
|
194
139
|
},
|
|
195
|
-
fromJSON(object) {
|
|
196
|
-
return {
|
|
197
|
-
start: isSet(object.start) ? globalThis.Number(object.start) : 0,
|
|
198
|
-
end: isSet(object.end) ? globalThis.Number(object.end) : 0,
|
|
199
|
-
};
|
|
200
|
-
},
|
|
201
|
-
toJSON(message) {
|
|
202
|
-
const obj = {};
|
|
203
|
-
if (message.start !== undefined && message.start !== 0) {
|
|
204
|
-
obj.start = Math.round(message.start);
|
|
205
|
-
}
|
|
206
|
-
if (message.end !== undefined && message.end !== 0) {
|
|
207
|
-
obj.end = Math.round(message.end);
|
|
208
|
-
}
|
|
209
|
-
return obj;
|
|
210
|
-
},
|
|
211
|
-
create(base) {
|
|
212
|
-
return InitRange.fromPartial(base ?? {});
|
|
213
|
-
},
|
|
214
|
-
fromPartial(object) {
|
|
215
|
-
const message = createBaseInitRange();
|
|
216
|
-
message.start = object.start ?? 0;
|
|
217
|
-
message.end = object.end ?? 0;
|
|
218
|
-
return message;
|
|
219
|
-
},
|
|
220
140
|
};
|
|
221
141
|
function createBaseIndexRange() {
|
|
222
142
|
return { start: 0, end: 0 };
|
|
@@ -258,31 +178,6 @@ export const IndexRange = {
|
|
|
258
178
|
}
|
|
259
179
|
return message;
|
|
260
180
|
},
|
|
261
|
-
fromJSON(object) {
|
|
262
|
-
return {
|
|
263
|
-
start: isSet(object.start) ? globalThis.Number(object.start) : 0,
|
|
264
|
-
end: isSet(object.end) ? globalThis.Number(object.end) : 0,
|
|
265
|
-
};
|
|
266
|
-
},
|
|
267
|
-
toJSON(message) {
|
|
268
|
-
const obj = {};
|
|
269
|
-
if (message.start !== undefined && message.start !== 0) {
|
|
270
|
-
obj.start = Math.round(message.start);
|
|
271
|
-
}
|
|
272
|
-
if (message.end !== undefined && message.end !== 0) {
|
|
273
|
-
obj.end = Math.round(message.end);
|
|
274
|
-
}
|
|
275
|
-
return obj;
|
|
276
|
-
},
|
|
277
|
-
create(base) {
|
|
278
|
-
return IndexRange.fromPartial(base ?? {});
|
|
279
|
-
},
|
|
280
|
-
fromPartial(object) {
|
|
281
|
-
const message = createBaseIndexRange();
|
|
282
|
-
message.start = object.start ?? 0;
|
|
283
|
-
message.end = object.end ?? 0;
|
|
284
|
-
return message;
|
|
285
|
-
},
|
|
286
181
|
};
|
|
287
182
|
function createBaseKeyValuePair() {
|
|
288
183
|
return { key: "", value: "" };
|
|
@@ -324,31 +219,6 @@ export const KeyValuePair = {
|
|
|
324
219
|
}
|
|
325
220
|
return message;
|
|
326
221
|
},
|
|
327
|
-
fromJSON(object) {
|
|
328
|
-
return {
|
|
329
|
-
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
330
|
-
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
331
|
-
};
|
|
332
|
-
},
|
|
333
|
-
toJSON(message) {
|
|
334
|
-
const obj = {};
|
|
335
|
-
if (message.key !== undefined && message.key !== "") {
|
|
336
|
-
obj.key = message.key;
|
|
337
|
-
}
|
|
338
|
-
if (message.value !== undefined && message.value !== "") {
|
|
339
|
-
obj.value = message.value;
|
|
340
|
-
}
|
|
341
|
-
return obj;
|
|
342
|
-
},
|
|
343
|
-
create(base) {
|
|
344
|
-
return KeyValuePair.fromPartial(base ?? {});
|
|
345
|
-
},
|
|
346
|
-
fromPartial(object) {
|
|
347
|
-
const message = createBaseKeyValuePair();
|
|
348
|
-
message.key = object.key ?? "";
|
|
349
|
-
message.value = object.value ?? "";
|
|
350
|
-
return message;
|
|
351
|
-
},
|
|
352
222
|
};
|
|
353
223
|
function longToNumber(int64) {
|
|
354
224
|
const num = globalThis.Number(int64.toString());
|
|
@@ -360,6 +230,3 @@ function longToNumber(int64) {
|
|
|
360
230
|
}
|
|
361
231
|
return num;
|
|
362
232
|
}
|
|
363
|
-
function isSet(value) {
|
|
364
|
-
return value !== null && value !== undefined;
|
|
365
|
-
}
|
|
@@ -29,22 +29,7 @@ export declare const BufferedRange: MessageFns<BufferedRange>;
|
|
|
29
29
|
export declare const Kob: MessageFns<Kob>;
|
|
30
30
|
export declare const Kob_Pa: MessageFns<Kob_Pa>;
|
|
31
31
|
export declare const YPa: MessageFns<YPa>;
|
|
32
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
33
|
-
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
34
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
35
|
-
} : Partial<T>;
|
|
36
|
-
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
37
|
-
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
38
|
-
[K in keyof P]: Exact<P[K], I[K]>;
|
|
39
|
-
} & {
|
|
40
|
-
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
41
|
-
};
|
|
42
32
|
export interface MessageFns<T> {
|
|
43
33
|
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
44
34
|
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
45
|
-
fromJSON(object: any): T;
|
|
46
|
-
toJSON(message: T): unknown;
|
|
47
|
-
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
48
|
-
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
49
35
|
}
|
|
50
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.2.0
|
|
4
|
-
// protoc
|
|
4
|
+
// protoc v3.21.12
|
|
5
5
|
// source: video_streaming/buffered_range.proto
|
|
6
6
|
/* eslint-disable */
|
|
7
7
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
@@ -121,76 +121,6 @@ export const BufferedRange = {
|
|
|
121
121
|
}
|
|
122
122
|
return message;
|
|
123
123
|
},
|
|
124
|
-
fromJSON(object) {
|
|
125
|
-
return {
|
|
126
|
-
formatId: isSet(object.formatId) ? FormatId.fromJSON(object.formatId) : undefined,
|
|
127
|
-
startTimeMs: isSet(object.startTimeMs) ? globalThis.Number(object.startTimeMs) : 0,
|
|
128
|
-
durationMs: isSet(object.durationMs) ? globalThis.Number(object.durationMs) : 0,
|
|
129
|
-
startSegmentIndex: isSet(object.startSegmentIndex) ? globalThis.Number(object.startSegmentIndex) : 0,
|
|
130
|
-
endSegmentIndex: isSet(object.endSegmentIndex) ? globalThis.Number(object.endSegmentIndex) : 0,
|
|
131
|
-
timeRange: isSet(object.timeRange) ? TimeRange.fromJSON(object.timeRange) : undefined,
|
|
132
|
-
field9: isSet(object.field9) ? Kob.fromJSON(object.field9) : undefined,
|
|
133
|
-
field11: isSet(object.field11) ? YPa.fromJSON(object.field11) : undefined,
|
|
134
|
-
field12: isSet(object.field12) ? YPa.fromJSON(object.field12) : undefined,
|
|
135
|
-
};
|
|
136
|
-
},
|
|
137
|
-
toJSON(message) {
|
|
138
|
-
const obj = {};
|
|
139
|
-
if (message.formatId !== undefined) {
|
|
140
|
-
obj.formatId = FormatId.toJSON(message.formatId);
|
|
141
|
-
}
|
|
142
|
-
if (message.startTimeMs !== 0) {
|
|
143
|
-
obj.startTimeMs = Math.round(message.startTimeMs);
|
|
144
|
-
}
|
|
145
|
-
if (message.durationMs !== 0) {
|
|
146
|
-
obj.durationMs = Math.round(message.durationMs);
|
|
147
|
-
}
|
|
148
|
-
if (message.startSegmentIndex !== 0) {
|
|
149
|
-
obj.startSegmentIndex = Math.round(message.startSegmentIndex);
|
|
150
|
-
}
|
|
151
|
-
if (message.endSegmentIndex !== 0) {
|
|
152
|
-
obj.endSegmentIndex = Math.round(message.endSegmentIndex);
|
|
153
|
-
}
|
|
154
|
-
if (message.timeRange !== undefined) {
|
|
155
|
-
obj.timeRange = TimeRange.toJSON(message.timeRange);
|
|
156
|
-
}
|
|
157
|
-
if (message.field9 !== undefined) {
|
|
158
|
-
obj.field9 = Kob.toJSON(message.field9);
|
|
159
|
-
}
|
|
160
|
-
if (message.field11 !== undefined) {
|
|
161
|
-
obj.field11 = YPa.toJSON(message.field11);
|
|
162
|
-
}
|
|
163
|
-
if (message.field12 !== undefined) {
|
|
164
|
-
obj.field12 = YPa.toJSON(message.field12);
|
|
165
|
-
}
|
|
166
|
-
return obj;
|
|
167
|
-
},
|
|
168
|
-
create(base) {
|
|
169
|
-
return BufferedRange.fromPartial(base ?? {});
|
|
170
|
-
},
|
|
171
|
-
fromPartial(object) {
|
|
172
|
-
const message = createBaseBufferedRange();
|
|
173
|
-
message.formatId = (object.formatId !== undefined && object.formatId !== null)
|
|
174
|
-
? FormatId.fromPartial(object.formatId)
|
|
175
|
-
: undefined;
|
|
176
|
-
message.startTimeMs = object.startTimeMs ?? 0;
|
|
177
|
-
message.durationMs = object.durationMs ?? 0;
|
|
178
|
-
message.startSegmentIndex = object.startSegmentIndex ?? 0;
|
|
179
|
-
message.endSegmentIndex = object.endSegmentIndex ?? 0;
|
|
180
|
-
message.timeRange = (object.timeRange !== undefined && object.timeRange !== null)
|
|
181
|
-
? TimeRange.fromPartial(object.timeRange)
|
|
182
|
-
: undefined;
|
|
183
|
-
message.field9 = (object.field9 !== undefined && object.field9 !== null)
|
|
184
|
-
? Kob.fromPartial(object.field9)
|
|
185
|
-
: undefined;
|
|
186
|
-
message.field11 = (object.field11 !== undefined && object.field11 !== null)
|
|
187
|
-
? YPa.fromPartial(object.field11)
|
|
188
|
-
: undefined;
|
|
189
|
-
message.field12 = (object.field12 !== undefined && object.field12 !== null)
|
|
190
|
-
? YPa.fromPartial(object.field12)
|
|
191
|
-
: undefined;
|
|
192
|
-
return message;
|
|
193
|
-
},
|
|
194
124
|
};
|
|
195
125
|
function createBaseKob() {
|
|
196
126
|
return { EW: [] };
|
|
@@ -223,24 +153,6 @@ export const Kob = {
|
|
|
223
153
|
}
|
|
224
154
|
return message;
|
|
225
155
|
},
|
|
226
|
-
fromJSON(object) {
|
|
227
|
-
return { EW: globalThis.Array.isArray(object?.EW) ? object.EW.map((e) => Kob_Pa.fromJSON(e)) : [] };
|
|
228
|
-
},
|
|
229
|
-
toJSON(message) {
|
|
230
|
-
const obj = {};
|
|
231
|
-
if (message.EW?.length) {
|
|
232
|
-
obj.EW = message.EW.map((e) => Kob_Pa.toJSON(e));
|
|
233
|
-
}
|
|
234
|
-
return obj;
|
|
235
|
-
},
|
|
236
|
-
create(base) {
|
|
237
|
-
return Kob.fromPartial(base ?? {});
|
|
238
|
-
},
|
|
239
|
-
fromPartial(object) {
|
|
240
|
-
const message = createBaseKob();
|
|
241
|
-
message.EW = object.EW?.map((e) => Kob_Pa.fromPartial(e)) || [];
|
|
242
|
-
return message;
|
|
243
|
-
},
|
|
244
156
|
};
|
|
245
157
|
function createBaseKob_Pa() {
|
|
246
158
|
return { videoId: "", lmt: 0 };
|
|
@@ -282,31 +194,6 @@ export const Kob_Pa = {
|
|
|
282
194
|
}
|
|
283
195
|
return message;
|
|
284
196
|
},
|
|
285
|
-
fromJSON(object) {
|
|
286
|
-
return {
|
|
287
|
-
videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : "",
|
|
288
|
-
lmt: isSet(object.lmt) ? globalThis.Number(object.lmt) : 0,
|
|
289
|
-
};
|
|
290
|
-
},
|
|
291
|
-
toJSON(message) {
|
|
292
|
-
const obj = {};
|
|
293
|
-
if (message.videoId !== undefined && message.videoId !== "") {
|
|
294
|
-
obj.videoId = message.videoId;
|
|
295
|
-
}
|
|
296
|
-
if (message.lmt !== undefined && message.lmt !== 0) {
|
|
297
|
-
obj.lmt = Math.round(message.lmt);
|
|
298
|
-
}
|
|
299
|
-
return obj;
|
|
300
|
-
},
|
|
301
|
-
create(base) {
|
|
302
|
-
return Kob_Pa.fromPartial(base ?? {});
|
|
303
|
-
},
|
|
304
|
-
fromPartial(object) {
|
|
305
|
-
const message = createBaseKob_Pa();
|
|
306
|
-
message.videoId = object.videoId ?? "";
|
|
307
|
-
message.lmt = object.lmt ?? 0;
|
|
308
|
-
return message;
|
|
309
|
-
},
|
|
310
197
|
};
|
|
311
198
|
function createBaseYPa() {
|
|
312
199
|
return { field1: 0, field2: 0, field3: 0 };
|
|
@@ -357,36 +244,6 @@ export const YPa = {
|
|
|
357
244
|
}
|
|
358
245
|
return message;
|
|
359
246
|
},
|
|
360
|
-
fromJSON(object) {
|
|
361
|
-
return {
|
|
362
|
-
field1: isSet(object.field1) ? globalThis.Number(object.field1) : 0,
|
|
363
|
-
field2: isSet(object.field2) ? globalThis.Number(object.field2) : 0,
|
|
364
|
-
field3: isSet(object.field3) ? globalThis.Number(object.field3) : 0,
|
|
365
|
-
};
|
|
366
|
-
},
|
|
367
|
-
toJSON(message) {
|
|
368
|
-
const obj = {};
|
|
369
|
-
if (message.field1 !== undefined && message.field1 !== 0) {
|
|
370
|
-
obj.field1 = Math.round(message.field1);
|
|
371
|
-
}
|
|
372
|
-
if (message.field2 !== undefined && message.field2 !== 0) {
|
|
373
|
-
obj.field2 = Math.round(message.field2);
|
|
374
|
-
}
|
|
375
|
-
if (message.field3 !== undefined && message.field3 !== 0) {
|
|
376
|
-
obj.field3 = Math.round(message.field3);
|
|
377
|
-
}
|
|
378
|
-
return obj;
|
|
379
|
-
},
|
|
380
|
-
create(base) {
|
|
381
|
-
return YPa.fromPartial(base ?? {});
|
|
382
|
-
},
|
|
383
|
-
fromPartial(object) {
|
|
384
|
-
const message = createBaseYPa();
|
|
385
|
-
message.field1 = object.field1 ?? 0;
|
|
386
|
-
message.field2 = object.field2 ?? 0;
|
|
387
|
-
message.field3 = object.field3 ?? 0;
|
|
388
|
-
return message;
|
|
389
|
-
},
|
|
390
247
|
};
|
|
391
248
|
function longToNumber(int64) {
|
|
392
249
|
const num = globalThis.Number(int64.toString());
|
|
@@ -398,6 +255,3 @@ function longToNumber(int64) {
|
|
|
398
255
|
}
|
|
399
256
|
return num;
|
|
400
257
|
}
|
|
401
|
-
function isSet(value) {
|
|
402
|
-
return value !== null && value !== undefined;
|
|
403
|
-
}
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
-
import { MediaCapabilities } from "./media_capabilities.js";
|
|
3
2
|
export declare const protobufPackage = "video_streaming";
|
|
4
3
|
export interface ClientAbrState {
|
|
5
4
|
timeSinceLastManualFormatSelectionMs?: number | undefined;
|
|
6
5
|
lastManualDirection?: number | undefined;
|
|
7
|
-
|
|
6
|
+
lastManualSelectedResolution?: number | undefined;
|
|
8
7
|
detailedNetworkType?: number | undefined;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
clientViewportWidth?: number | undefined;
|
|
9
|
+
clientViewportHeight?: number | undefined;
|
|
10
|
+
clientBitrateCap?: number | undefined;
|
|
11
|
+
stickyResolution?: number | undefined;
|
|
12
|
+
clientViewportIsFlexible?: boolean | undefined;
|
|
13
|
+
bandwidthEstimate?: number | undefined;
|
|
14
|
+
playerTimeMs?: number | undefined;
|
|
14
15
|
timeSinceLastSeek?: number | undefined;
|
|
16
|
+
dataSaverMode?: boolean | undefined;
|
|
15
17
|
visibility?: number | undefined;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
playbackRate?: number | undefined;
|
|
19
|
+
elapsedWallTimeMs?: number | undefined;
|
|
20
|
+
mediaCapabilities?: Uint8Array | undefined;
|
|
21
|
+
timeSinceLastActionMs?: number | undefined;
|
|
22
|
+
enabledTrackTypesBitfield?: number | undefined;
|
|
23
|
+
maxPacingRate?: number | undefined;
|
|
21
24
|
playerState?: number | undefined;
|
|
22
|
-
|
|
25
|
+
drcEnabled?: boolean | undefined;
|
|
23
26
|
Jda?: number | undefined;
|
|
24
27
|
qw?: number | undefined;
|
|
25
28
|
Ky?: number | undefined;
|
|
@@ -36,34 +39,9 @@ export interface ClientAbrState {
|
|
|
36
39
|
sabrForceProxima?: number | undefined;
|
|
37
40
|
Tqb?: number | undefined;
|
|
38
41
|
sabrForceMaxNetworkInterruptionDurationMs?: number | undefined;
|
|
39
|
-
playbackRate?: number | undefined;
|
|
40
|
-
}
|
|
41
|
-
export declare enum ClientAbrState_MediaType {
|
|
42
|
-
MEDIA_TYPE_DEFAULT = 0,
|
|
43
|
-
MEDIA_TYPE_AUDIO = 1,
|
|
44
|
-
MEDIA_TYPE_VIDEO = 2,
|
|
45
|
-
USE_SERVER_FORMAT_FILTER = 3,
|
|
46
|
-
UNRECOGNIZED = -1
|
|
47
42
|
}
|
|
48
|
-
export declare function clientAbrState_MediaTypeFromJSON(object: any): ClientAbrState_MediaType;
|
|
49
|
-
export declare function clientAbrState_MediaTypeToJSON(object: ClientAbrState_MediaType): string;
|
|
50
43
|
export declare const ClientAbrState: MessageFns<ClientAbrState>;
|
|
51
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
52
|
-
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
53
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
54
|
-
} : Partial<T>;
|
|
55
|
-
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
56
|
-
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
57
|
-
[K in keyof P]: Exact<P[K], I[K]>;
|
|
58
|
-
} & {
|
|
59
|
-
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
60
|
-
};
|
|
61
44
|
export interface MessageFns<T> {
|
|
62
45
|
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
63
46
|
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
64
|
-
fromJSON(object: any): T;
|
|
65
|
-
toJSON(message: T): unknown;
|
|
66
|
-
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
67
|
-
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
68
47
|
}
|
|
69
|
-
export {};
|