diff --git a/src/manifests/handlers/dash/segment.ts b/src/manifests/handlers/dash/segment.ts index ee313ba..7b672a8 100644 --- a/src/manifests/handlers/dash/segment.ts +++ b/src/manifests/handlers/dash/segment.ts @@ -37,7 +37,7 @@ export default async function dashSegmentHandler( const urlSearchParams = new URLSearchParams(event.queryStringParameters); const pathStem = path.basename(event.path).replace('.mp4', ''); // Get the number part after "segment_" - const [, reqSegmentIndexStr, representationIdStr, bitrateStr] = + const [, reqSegmentIndexStr, representationIdStr, bitrateStr, timeStr] = pathStem.split('_'); // 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 @@ -54,6 +54,9 @@ export default async function dashSegmentHandler( representationIdStr ); } + if (timeStr) { + segmentUrl = segmentUrl.replace('$Time$', timeStr); + } if (bitrateStr) { urlSearchParams.set('bitrate', bitrateStr); } diff --git a/src/manifests/utils/dashManifestUtils.ts b/src/manifests/utils/dashManifestUtils.ts index 1d1606b..e8a2d27 100644 --- a/src/manifests/utils/dashManifestUtils.ts +++ b/src/manifests/utils/dashManifestUtils.ts @@ -103,7 +103,7 @@ export default function (): DASHManifestTools { segmentTemplate.$.media = proxyPathBuilder( mediaUrl.match(/^http/) ? mediaUrl : baseUrl + mediaUrl, urlQuery, - 'proxy-segment/segment_$Number$_$RepresentationID$_$Bandwidth$' + 'proxy-segment/segment_$Number$_$RepresentationID$_$Bandwidth$_$Time$' ); // Initialization attr. const initUrl = segmentTemplate.$.initialization; diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 1a54dae..7b12dba 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -187,7 +187,8 @@ type ProxyBasenames = | 'proxy-media.m3u8' | '../../segments/proxy-segment' | 'proxy-segment/segment_$Number$.mp4' - | 'proxy-segment/segment_$Number$_$RepresentationID$_$Bandwidth$'; + | 'proxy-segment/segment_$Number$_$RepresentationID$_$Bandwidth$' + | 'proxy-segment/segment_$Number$_$RepresentationID$_$Bandwidth$_$Time$'; /** * Adjust paths based on directory navigation diff --git a/src/testvectors/dash/dash1_compressed/proxy-manifest.xml b/src/testvectors/dash/dash1_compressed/proxy-manifest.xml index a1f96a0..0ff7c44 100644 --- a/src/testvectors/dash/dash1_compressed/proxy-manifest.xml +++ b/src/testvectors/dash/dash1_compressed/proxy-manifest.xml @@ -34,7 +34,7 @@ + media="proxy-segment/segment_$Number$_$RepresentationID$_$Bandwidth$_$Time$?url=https%3A%2F%2Fmock.mock.com%2Fstream%2Frelative_base%2Faudiotrack%2F%24RepresentationID%24%2F%24Time%24.m4s&statusCode=%5B%7Bi%3A0%2Ccode%3A404%7D%2C%7Bi%3A2%2Ccode%3A401%7D%5D&timeout=%5B%7Bi%3A3%7D%5D&delay=%5B%7Bi%3A2%2Cms%3A2000%7D%5D"> @@ -62,7 +62,7 @@ + media="proxy-segment/segment_$Number$_$RepresentationID$_$Bandwidth$_$Time$?url=https%3A%2F%2Fmock.mock.com%2Fstream%2Frelative_base%2Fvideotrack%2F%24RepresentationID%24%2F%24Time%24.m4s&statusCode=%5B%7Bi%3A0%2Ccode%3A404%7D%2C%7Bi%3A2%2Ccode%3A401%7D%5D&timeout=%5B%7Bi%3A3%7D%5D&delay=%5B%7Bi%3A2%2Cms%3A2000%7D%5D"> diff --git a/src/testvectors/dash/dash_period_baseurl/proxy-manifest.xml b/src/testvectors/dash/dash_period_baseurl/proxy-manifest.xml index 29c7c95..23f08e6 100644 --- a/src/testvectors/dash/dash_period_baseurl/proxy-manifest.xml +++ b/src/testvectors/dash/dash_period_baseurl/proxy-manifest.xml @@ -1,7 +1,7 @@ - + @@ -17,7 +17,7 @@ - +