Skip to content

Commit

Permalink
fix: handling underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
zapfire88 committed Feb 22, 2024
1 parent fcf3f80 commit 80ce887
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/manifests/handlers/dash/segment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('dashSegmentHandler', () => {
queryStringParameters: {
url: 'https://cd-stream-live.telenorcdn.net/cdgo/sm_vgdirekte_no_live/sm_vgdirekte_no_live.isml/dash/sm_vgdirekte_no_live-$RepresentationID$-$Time$.dash'
},
path: '/segment_82008145102133_audio_track_0_0_nor=128000_128000',
path: '/segment_82008145102133_123_audio_track_0_0_nor=128000_128000',
requestContext: {
elb: { targetGroupArn: '' }
},
Expand Down
8 changes: 1 addition & 7 deletions src/manifests/handlers/dash/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default async function dashSegmentHandler(
// eslint-disable-next-line prefer-const
const [, reqSegmentIndexOrTimeStr, bitrateStr, ...representationIdStrList] =
pathStem.split('_');
let representationIdStr = representationIdStrList.join('-');
const representationIdStr = representationIdStrList.join('_');
// Build correct Source Segment url
// segment templates may contain a width parameter "$Number%0[width]d$", and then we need to zero-pad them to that length

Expand All @@ -57,12 +57,6 @@ export default async function dashSegmentHandler(
}
const reqSegmentIndexInt = parseInt(reqSegmentIndexOrTimeStr);

const possibleId = pathStem.match(
/(audio|video)_track_\d+_\d+_[a-zA-Z]{3}=\d+_\d+/
);
if (possibleId) {
representationIdStr = possibleId[0];
}
// Replace RepresentationID in url if present
if (representationIdStr) {
segmentUrl = segmentUrl.replace(
Expand Down

0 comments on commit 80ce887

Please sign in to comment.