Skip to content

Commit

Permalink
feat: add support for setting name of manifest files through parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Gustav Grusell <[email protected]>
  • Loading branch information
grusell committed Sep 10, 2024
1 parent f6bfbfe commit f4da9ab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/packager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,20 @@ describe('Test create shaka args', () => {
'manifest.mpd'
]);
});

it('Should set name of master playlist and manifest as specified', async () => {
const args = createShakaArgs(singleInputVideo, false, {
hlsManifestName: 'myHlsMasterPlaylist.m3u8',
dashManifestName: 'myDashManifest.mpd'
});
expect(args).toEqual([
'in=test.mp4,stream=video,playlist_name=video-1.m3u8,init_segment=video-1/init.mp4,segment_template=video-1/$Number$.m4s',
'in=test.mp4,stream=audio,playlist_name=audio.m3u8,hls_group_id=audio,hls_name=defaultaudio,init_segment=audio/init.mp4,segment_template=audio/$Number$.m4s',
'--hls_master_playlist_output',
'myHlsMasterPlaylist.m3u8',
'--generate_static_live_mpd',
'--mpd_output',
'myDashManifest.mpd'
]);
});
});
9 changes: 7 additions & 2 deletions src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface PackageFormatOptions {
segmentSingleFile?: boolean;
segmentSingleFileTemplate?: string;
segmentDuration?: number;
dashManifestName?: string;
hlsManifestName?: string;
}

export interface PackageOptions {
Expand Down Expand Up @@ -283,13 +285,16 @@ export function createShakaArgs(
console.log('No audio input found');
}
if (packageFormatOptions?.dashOnly !== true) {
cmdInputs.push('--hls_master_playlist_output', 'index.m3u8');
cmdInputs.push(
'--hls_master_playlist_output',
packageFormatOptions?.hlsManifestName || 'index.m3u8'
);
}
if (packageFormatOptions?.hlsOnly !== true) {
cmdInputs.push(
'--generate_static_live_mpd',
'--mpd_output',
'manifest.mpd'
packageFormatOptions?.dashManifestName || 'manifest.mpd'
);
}
if (packageFormatOptions?.segmentDuration) {
Expand Down

0 comments on commit f4da9ab

Please sign in to comment.