Skip to content

Commit

Permalink
Hide seekbar
Browse files Browse the repository at this point in the history
  • Loading branch information
matvp91 committed Dec 10, 2024
1 parent bfd4a8d commit c8f7c6d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
6 changes: 5 additions & 1 deletion fixtures/media-chrome/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
aspect-ratio: 16 / 9;
background: #000;
}

media-controller[interstitial="1"] media-time-range {
display: none;
}
</style>
</head>
<body>
Expand All @@ -34,7 +38,7 @@
<media-controller>
<superstreamer-video
slot="media"
src="https://stitcher.superstreamer.xyz/session/fdb3f69b-e418-4753-9a6a-4d51e20f14ca/master.m3u8">
src="https://stitcher.superstreamer.xyz/session/6c127f2a-ca33-4eca-aff2-29ab3c3aac7c/master.m3u8">
</superstreamer-video>
<media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>
<media-rendition-menu hidden anchor="auto"></media-rendition-menu>
Expand Down
7 changes: 7 additions & 0 deletions fixtures/media-chrome/superstreamer-video-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ class SuperstreamerVideoElement extends MediaTracksMixin(
this.#player.on(Events.STARTED, () => {
this.#readyState = 3;
});

this.#player.on(Events.ASSET_CHANGE, () => {
const controller = this.closest("media-controller");
if (controller) {
controller.setAttribute("interstitial", this.#player.asset ? "1" : "0");
}
});
}

get src() {
Expand Down
13 changes: 0 additions & 13 deletions packages/player/src/hls-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,6 @@ export class HlsPlayer {
return getState(this.state_, "volume");
}

get cuepoints() {
return getState(this.state_, "cuepoints");
}

private createHls_() {
const hls = new Hls();

Expand Down Expand Up @@ -331,15 +327,6 @@ export class HlsPlayer {
this.updateSubtitleTracks_();
});

listen(Hls.Events.INTERSTITIALS_UPDATED, (_, data) => {
const cuepoints: number[] = [];
// @ts-expect-error Will do this later
data.schedule.forEach((item) => {
// TODO: Make each item with a proper timeline tag.
});
this.state_?.setCuepoints(cuepoints);
});

return hls;
}

Expand Down
8 changes: 0 additions & 8 deletions packages/player/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ interface StateProperties {
audioTracks: AudioTrack[];
subtitleTracks: SubtitleTrack[];
volume: number;
cuepoints: number[];
seeking: boolean;
}

Expand All @@ -49,7 +48,6 @@ const noState: StateProperties = {
audioTracks: [],
subtitleTracks: [],
volume: 1,
cuepoints: [],
seeking: false,
};

Expand Down Expand Up @@ -150,11 +148,6 @@ export class State implements StateProperties {
this.emit_(Events.VOLUME_CHANGE);
}

setCuepoints(cuepoints: number[]) {
this.cuepoints = cuepoints;
this.emit_(Events.CUEPOINTS_CHANGE);
}

setSeeking(seeking: boolean) {
if (seeking === this.seeking) {
return;
Expand Down Expand Up @@ -219,7 +212,6 @@ export class State implements StateProperties {
audioTracks = noState.audioTracks;
subtitleTracks = noState.subtitleTracks;
volume = noState.volume;
cuepoints = noState.cuepoints;
seeking = noState.seeking;
}

Expand Down
2 changes: 0 additions & 2 deletions packages/player/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export enum Events {
AUTO_QUALITY_CHANGE = "autoQualityChange",
ASSET_CHANGE = "assetChange",
ASSET_TIME_CHANGE = "assetTimeChange",
CUEPOINTS_CHANGE = "cuepointsChange",
SEEKING_CHANGE = "seekingChange",
}

Expand All @@ -30,7 +29,6 @@ export type HlsPlayerEventMap = {
[Events.AUTO_QUALITY_CHANGE]: () => void;
[Events.ASSET_CHANGE]: () => void;
[Events.ASSET_TIME_CHANGE]: () => void;
[Events.CUEPOINTS_CHANGE]: () => void;
[Events.SEEKING_CHANGE]: () => void;
} & {
"*": (event: Events) => void;
Expand Down

0 comments on commit c8f7c6d

Please sign in to comment.