mirror of
https://github.com/LuanRT/googlevideo.git
synced 2026-06-13 00:32:11 +00:00
chore(tests): Fix sabr stream simulation
This commit is contained in:
@@ -17,7 +17,7 @@ Logger.getInstance().setLogLevels(LogLevel.NONE);
|
|||||||
|
|
||||||
const AUDIO_FORMAT = {
|
const AUDIO_FORMAT = {
|
||||||
itag: 140,
|
itag: 140,
|
||||||
lastModified: 1700000000,
|
lastModified: '1700000000',
|
||||||
contentLength: 117138,
|
contentLength: 117138,
|
||||||
mimeType: 'audio/mp4; codecs="mp4a.40.2"',
|
mimeType: 'audio/mp4; codecs="mp4a.40.2"',
|
||||||
bitrate: 128000,
|
bitrate: 128000,
|
||||||
@@ -28,7 +28,7 @@ const VIDEO_FORMAT = {
|
|||||||
itag: 137,
|
itag: 137,
|
||||||
mimeType: 'video/mp4; codecs="avc1.640028"',
|
mimeType: 'video/mp4; codecs="avc1.640028"',
|
||||||
bitrate: 4337000,
|
bitrate: 4337000,
|
||||||
lastModified: 1700000000,
|
lastModified: '1700000000',
|
||||||
height: 1080,
|
height: 1080,
|
||||||
approxDurationMs: 120000,
|
approxDurationMs: 120000,
|
||||||
qualityLabel: undefined,
|
qualityLabel: undefined,
|
||||||
@@ -57,18 +57,18 @@ function createMediaHeader(
|
|||||||
videoId: '',
|
videoId: '',
|
||||||
itag: format.itag,
|
itag: format.itag,
|
||||||
lmt: format.lastModified,
|
lmt: format.lastModified,
|
||||||
startRange,
|
startRange: startRange.toString(),
|
||||||
compressionAlgorithm: 0,
|
compressionAlgorithm: 0,
|
||||||
isInitSeg,
|
isInitSeg,
|
||||||
sequenceNumber,
|
sequenceNumber,
|
||||||
bitrateBps: format.bitrate,
|
bitrateBps: format.bitrate.toString(),
|
||||||
startMs,
|
startMs: startMs.toString(),
|
||||||
durationMs: durationMs || 0,
|
durationMs: durationMs.toString(),
|
||||||
formatId: format,
|
formatId: format,
|
||||||
contentLength,
|
contentLength: contentLength.toString(),
|
||||||
timeRange: {
|
timeRange: {
|
||||||
startTicks: startMs,
|
startTicks: startMs.toString(),
|
||||||
durationTicks: durationMs || 0,
|
durationTicks: durationMs.toString(),
|
||||||
timescale: 1000
|
timescale: 1000
|
||||||
}
|
}
|
||||||
}).finish()
|
}).finish()
|
||||||
@@ -99,7 +99,7 @@ function createMockFetch(maxSegmentSize: number, maxSegmentDuration: number, str
|
|||||||
const requestBodyData = await request.arrayBuffer();
|
const requestBodyData = await request.arrayBuffer();
|
||||||
const requestBody = VideoPlaybackAbrRequest.decode(new Uint8Array(requestBodyData));
|
const requestBody = VideoPlaybackAbrRequest.decode(new Uint8Array(requestBodyData));
|
||||||
|
|
||||||
const playerTimeMs = requestBody.clientAbrState?.playerTimeMs || 0;
|
const playerTimeMs = parseInt(requestBody.clientAbrState?.playerTimeMs || '0');
|
||||||
|
|
||||||
const partsToWrite = [];
|
const partsToWrite = [];
|
||||||
|
|
||||||
@@ -130,11 +130,11 @@ function createMockFetch(maxSegmentSize: number, maxSegmentDuration: number, str
|
|||||||
partType: UMPPartId.FORMAT_INITIALIZATION_METADATA,
|
partType: UMPPartId.FORMAT_INITIALIZATION_METADATA,
|
||||||
partData: FormatInitializationMetadata.encode({
|
partData: FormatInitializationMetadata.encode({
|
||||||
formatId: AUDIO_FORMAT,
|
formatId: AUDIO_FORMAT,
|
||||||
durationUnits: 120000,
|
durationUnits: '120000',
|
||||||
durationTimescale: 1000,
|
durationTimescale: '1000',
|
||||||
endSegmentNumber: 5,
|
endSegmentNumber: '5',
|
||||||
mimeType: AUDIO_FORMAT.mimeType,
|
mimeType: AUDIO_FORMAT.mimeType,
|
||||||
endTimeMs: 120000,
|
endTimeMs: '120000',
|
||||||
videoId: ''
|
videoId: ''
|
||||||
}).finish()
|
}).finish()
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user