Skip to content

Commit 8459f01

Browse files
committed
Replace failoverPresentationTimeInSeconds with cached currentTime
1 parent cde08da commit 8459f01

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/playbackstrategy/msestrategy.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function MSEStrategy(
5757
const liveDelay = isNaN(playerSettings.streaming?.delay?.liveDelay)
5858
? DEFAULT_SETTINGS.liveDelay
5959
: playerSettings.streaming?.delay?.liveDelay
60-
let failoverPresentationTimeInSeconds
6160
let isEnded = false
6261
const cached = {
6362
seekableRange: undefined,
@@ -207,7 +206,7 @@ function MSEStrategy(
207206
isFinite(currentPresentationTimeInSeconds) &&
208207
parseInt(currentPresentationTimeInSeconds) > 0
209208
) {
210-
failoverPresentationTimeInSeconds = currentPresentationTimeInSeconds
209+
cached.currentTime = currentPresentationTimeInSeconds
211210
}
212211

213212
publishTimeUpdate()
@@ -488,9 +487,9 @@ function MSEStrategy(
488487

489488
function load(mimeType, presentationTimeInSeconds) {
490489
if (mediaPlayer) {
491-
modifySource(cached.currentTime || failoverPresentationTimeInSeconds)
490+
modifySource(cached.currentTime)
492491
} else {
493-
failoverPresentationTimeInSeconds = presentationTimeInSeconds
492+
cached.currentTime = presentationTimeInSeconds
494493
setUpMediaElement(playbackElement)
495494
setUpMediaPlayer(presentationTimeInSeconds)
496495
setUpMediaListeners()
@@ -639,10 +638,7 @@ function MSEStrategy(
639638
function getCurrentTime() {
640639
const currentTime = mediaElement?.currentTime
641640

642-
if (currentTime === 0) {
643-
cached.currentTime = 0
644-
return 0
645-
} else if (currentTime && !isNaN(currentTime)) {
641+
if (currentTime && !isNaN(currentTime)) {
646642
cached.currentTime = currentTime
647643
return currentTime
648644
}
@@ -844,7 +840,6 @@ function MSEStrategy(
844840
eventCallbacks = []
845841
errorCallback = undefined
846842
timeUpdateCallback = undefined
847-
failoverPresentationTimeInSeconds = undefined
848843
isEnded = undefined
849844
dashMetrics = undefined
850845
playerMetadata = {

0 commit comments

Comments
 (0)