Skip to content

Commit

Permalink
fix(#64): handle hls with init segments
Browse files Browse the repository at this point in the history
  • Loading branch information
birme committed Apr 22, 2024
1 parent e10a98d commit 3098240
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@aws-sdk/client-ssm": "^3.306.0",
"@eyevinn/m3u8": ">=0.1.2",
"@eyevinn/m3u8": ">=0.5.6",
"@fastify/aws-lambda": "^3.2.0",
"aws-lambda": "^1.0.7",
"dotenv": "^8.2.0",
Expand Down
5 changes: 3 additions & 2 deletions src/manifests/handlers/hls/media.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ https://mock.mock.com/stream/hls/manifest_1_00001.ts
expect(response.body).toEqual(expected.body);
});

fit('should handle init segments for HLS cmaf media', async () => {
it('should handle init segments for HLS cmaf media', async () => {
// Arrange
const getMedia = () => {
return new Promise((resolve) => {
Expand Down Expand Up @@ -448,7 +448,8 @@ https://mock.mock.com/stream/hls/subdir/142d4370-56c9-11ee-a816-2da19aea6ed1_205
https://mock.mock.com/stream/hls/subdir/142d4370-56c9-11ee-a816-2da19aea6ed1_20571919-video=6500000-2.m4s
#EXTINF:3.8400, no desc
https://mock.mock.com/stream/hls/subdir/142d4370-56c9-11ee-a816-2da19aea6ed1_20571919-video=6500000-3.m4s
#EXT-X-ENDLIST`
#EXT-X-ENDLIST
`
};
expect(response.statusCode).toEqual(expected.statusCode);
expect(response.headers).toEqual(expected.headers);
Expand Down
5 changes: 5 additions & 0 deletions src/manifests/utils/hlsManifestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ export default function (): HLSManifestTools {
if (!sourceSegURL.match(/^http/)) {
sourceSegURL = `${sourceBaseURL}/${item.get('uri')}`;
}
let sourceMapURL: string | undefined = item.get('map-uri');
if (sourceMapURL && !sourceMapURL.match(/^http/)) {
sourceMapURL = `${sourceBaseURL}/${sourceMapURL}`;
item.set('map-uri', sourceMapURL);
}

if (!corruption) {
item.set('uri', sourceSegURL);
Expand Down
4 changes: 2 additions & 2 deletions src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export type TargetLevel = number;

/* eslint-disable */
export type M3UItem = {
get: (key: 'uri' | 'type') => string | any;
set: (key: 'uri', value: string) => void;
get: (key: 'uri' | 'type' | 'map-uri') => string | any;
set: (key: 'uri' | 'map-uri', value: string) => void;
};

export type M3U = {
Expand Down

0 comments on commit 3098240

Please sign in to comment.