Skip to content

Commit 771a47e

Browse files
committed
feat: Migrated to hls.js-beta.4
1 parent 4e8416b commit 771a47e

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

bun.lockb

0 Bytes
Binary file not shown.

packages/player/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"typedoc": "typedoc --tsconfig tsconfig.typedoc.json"
2323
},
2424
"dependencies": {
25-
"hls.js": "^1.6.0-beta.3",
25+
"hls.js": "^1.6.0-beta.4",
2626
"tseep": "^1.3.1",
2727
"shared": "workspace:*"
2828
},

packages/player/src/hls-player.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class HlsPlayer {
5050
this.state_ = new State({
5151
onEvent: (event: Events) => this.emit_(event),
5252
getTiming: () => hls.interstitialsManager?.integrated,
53-
getInterstitialTiming: () => hls.interstitialsManager?.bufferingPlayer,
53+
getInterstitialTiming: () => hls.interstitialsManager?.interstitialPlayer,
5454
});
5555

5656
hls.attachMedia(this.media_);
@@ -95,8 +95,10 @@ export class HlsPlayer {
9595

9696
seekTo(time: number) {
9797
assert(this.hls_);
98-
99-
this.hls_.interstitialsManager?.integrated.seekTo(time);
98+
const integrated = this.hls_.interstitialsManager?.integrated;
99+
if (integrated) {
100+
integrated.currentTime = time;
101+
}
100102
}
101103

102104
setQuality(height: number | null) {
@@ -109,11 +111,10 @@ export class HlsPlayer {
109111
assert(loadLevel, "No level found for loadLevel index");
110112

111113
const idx = this.hls_.levels.findIndex((level) => {
112-
return (
113-
level.height === height &&
114+
const equalAudioCodec =
114115
level.audioCodec?.substring(0, 4) ===
115-
loadLevel.audioCodec?.substring(0, 4)
116-
);
116+
loadLevel.audioCodec?.substring(0, 4);
117+
return level.height === height && equalAudioCodec;
117118
});
118119

119120
if (idx < 0) {

packages/player/src/state.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,15 @@ export class State implements StateProperties {
159159
) {
160160
if (interstitial) {
161161
this.setSeeking(false);
162+
this.interstitial = {
163+
...interstitial,
164+
currentTime: 0,
165+
duration: NaN,
166+
};
167+
} else {
168+
this.interstitial = null;
162169
}
163170

164-
this.interstitial = interstitial
165-
? {
166-
...interstitial,
167-
currentTime: 0,
168-
duration: NaN,
169-
}
170-
: null;
171-
172171
this.requestTimingSync(/* skipEvent= */ true);
173172

174173
this.params_.onEvent(Events.INTERSTITIAL_CHANGE);
@@ -200,9 +199,9 @@ export class State implements StateProperties {
200199
this.seekableStart = seekableStart;
201200
}
202201

203-
const interstitialTiming = this.params_.getInterstitialTiming();
204-
if (interstitialTiming) {
205-
assert(this.interstitial);
202+
if (this.interstitial) {
203+
const interstitialTiming = this.params_.getInterstitialTiming();
204+
assert(interstitialTiming);
206205

207206
const currentTime = preciseFloat(interstitialTiming.currentTime);
208207
const duration = preciseFloat(interstitialTiming.duration);

0 commit comments

Comments
 (0)