shaka-player icon indicating copy to clipboard operation
shaka-player copied to clipboard

This is a seekRange() question.

Open brodiddev opened this issue 10 months ago • 3 comments

Have you read the Tutorials? yes

Have you read the FAQ and checked for duplicate open issues? yes

If the question is related to FairPlay, have you read the tutorial?

yes

What version of Shaka Player are you using? 4.5.11

What browser and OS are you using? chrome Window

Please ask your question

I previously asked the above question regarding CMAF HLS live stream time difference reduction. I've seen the potential to shorten the lag by adjusting the liveSegmentsDelay option, but the buffer runs out quickly. The buffer was checked with the code below.


logBufferedInfo() {
const position = this.videoElement.currentTime;
let bufferedInfo = { total: 0, played: 0, left: 0 };

for (let i = 0; i < this.videoElement.buffered.length; i++) {
	const start = this.videoElement.buffered.start(i);
	const end = this.videoElement.buffered.end(i);
	const duration = end - start;

	if (start <= position && end > position) {
		bufferedInfo.played += Math.max(0, position - start);
		bufferedInfo.left += Math.max(0, end - position);
	} else if (start > position) {
		bufferedInfo.left += duration;
	} else {
		bufferedInfo.played += duration;
	}

	bufferedInfo.total += duration;
}
const leftFormatted = bufferedInfo.left.toFixed(3);

document.getElementById(
	'logBufferedInfoLabel'
).innerHTML = `Buffer (left/played/total): ${leftFormatted}/${bufferedInfo.played.toFixed(
	3
)}/${bufferedInfo.total.toFixed(3)}`;
}

I have a question here.

  1. Will playing the last segment when loading using the player.seekRange().end() API help reduce time lag?

  2. When liveSegmentsDelay is set to less than 1.5, leftBuffer becomes 0.00 when playing for 2 to 3 minutes, resulting in buffering. Are the configure settings below the optimal settings?

  3. Will Shaka Player help reduce lag when #EXT-X-TARGETDURATION:3 is reduced to 2? I would like to know the relationship between the player and the corresponding tag to shorten the time difference.


this.player.configure({
    streaming: {
        bufferingGoal: 30,
        rebufferingGoal: 5,
        lowLatencyMode: true, 
        startAtSegmentBoundary: true,
        retryParameters: {
	        baseDelay: 1000,
	        timeout: 5000, 
	        maxAttempts: 2,
        },
    },
    manifest: {
        hls: {
	        liveSegmentsDelay: 1.5,
        },
        retryParameters: {
	        baseDelay: 1000, 
	        timeout: 5000,
	        maxAttempts: 2, 
        },
    },

brodiddev avatar Apr 23 '24 02:04 brodiddev

Can try with manifest.hls.useSafariBehaviorForLive = false?

avelad avatar Apr 23 '24 13:04 avelad

May I know why you recommended that option to me? Why disable Safari's way of finding Live Edge?

brodiddev avatar Apr 24 '24 07:04 brodiddev

The way Sfari works is different, it doesn't let you search on a Live stream. In Shaka we have that functionality enabled by default. But if it is disabled we allow seek on a live stream.

avelad avatar May 08 '24 13:05 avelad

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.

shaka-bot avatar May 15 '24 13:05 shaka-bot