From ba726a1930d82adafb4aedc769febd1114c14f3d Mon Sep 17 00:00:00 2001 From: KunXi-Fox Date: Mon, 31 Mar 2025 15:00:31 +0800 Subject: [PATCH 1/3] narrow down startAt.fromLivePosition option --- src/main_thread/init/utils/get_initial_time.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main_thread/init/utils/get_initial_time.ts b/src/main_thread/init/utils/get_initial_time.ts index 2eacaf6afc9..d8cb8fdba45 100644 --- a/src/main_thread/init/utils/get_initial_time.ts +++ b/src/main_thread/init/utils/get_initial_time.ts @@ -110,7 +110,7 @@ export default function getInitialTime( log.debug("Init: using startAt.fromLastPosition"); const { fromLastPosition } = startAt; return fromLastPosition >= 0 ? max : Math.max(min, max + fromLastPosition); - } else if (!isNullOrUndefined(startAt.fromLivePosition)) { + } else if (!isNullOrUndefined(startAt.fromLivePosition) && manifest.isLive) { log.debug("Init: using startAt.fromLivePosition"); const livePosition = getLivePosition(manifest) ?? max; const { fromLivePosition } = startAt; From e4e6ff087c046fd164ae4aa0151bb6c65774ed7c Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Mon, 19 May 2025 15:33:30 +1000 Subject: [PATCH 2/3] Update docs --- doc/api/Loading_a_Content.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/api/Loading_a_Content.md b/doc/api/Loading_a_Content.md index eef8027f5f2..cc44064f6fe 100644 --- a/doc/api/Loading_a_Content.md +++ b/doc/api/Loading_a_Content.md @@ -191,13 +191,12 @@ either: - for VoD contents, it is the difference between the starting position and the end position of the content. -- **fromLivePosition** relative position relative to the content's live edge (for live - contents, it is the position that is intended to be broadcasted at the current time) if - it makes sense, in seconds. Should be a negative number. +- **fromLivePosition** position relative to the content's live edge (i.e. the position + that is intended to be broadcast at the current time) if it makes sense, in seconds. + Should be a negative number. If the live edge is unknown or if it does not make sense for the current content (for - example, it won't make sense for a VoD content), that setting repeats the same behavior - than **fromLastPosition**. + example, it won't make sense for VoD content), this setting is ignored. - **percentage** (`Number`): percentage of the wanted position. `0` being the minimum position possible (0 for static content, buffer depth for dynamic contents) and `100` From 5b48c3df353f0b6c0f4e102c4d4a5376b7caeb27 Mon Sep 17 00:00:00 2001 From: KunXi-Fox Date: Mon, 19 May 2025 15:25:32 +0800 Subject: [PATCH 3/3] add extra check to make sure live position exists --- src/main_thread/init/utils/get_initial_time.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main_thread/init/utils/get_initial_time.ts b/src/main_thread/init/utils/get_initial_time.ts index d8cb8fdba45..566c732eb15 100644 --- a/src/main_thread/init/utils/get_initial_time.ts +++ b/src/main_thread/init/utils/get_initial_time.ts @@ -93,6 +93,8 @@ export default function getInitialTime( if (!isNullOrUndefined(startAt)) { const min = getMinimumSafePosition(manifest); const max = getMaximumSafePosition(manifest); + const livePosition = getLivePosition(manifest); + if (!isNullOrUndefined(startAt.position)) { log.debug("Init: using startAt.minimumPosition"); return Math.max(Math.min(startAt.position, max), min); @@ -110,9 +112,12 @@ export default function getInitialTime( log.debug("Init: using startAt.fromLastPosition"); const { fromLastPosition } = startAt; return fromLastPosition >= 0 ? max : Math.max(min, max + fromLastPosition); - } else if (!isNullOrUndefined(startAt.fromLivePosition) && manifest.isLive) { + } else if ( + !isNullOrUndefined(startAt.fromLivePosition) && + livePosition !== undefined && + manifest.isLive + ) { log.debug("Init: using startAt.fromLivePosition"); - const livePosition = getLivePosition(manifest) ?? max; const { fromLivePosition } = startAt; return fromLivePosition >= 0 ? livePosition