diff --git a/p2p-media-loader-demo/index.html b/p2p-media-loader-demo/index.html
index fccca772..4f96d729 100644
--- a/p2p-media-loader-demo/index.html
+++ b/p2p-media-loader-demo/index.html
@@ -6,7 +6,7 @@
Vite + React + TS
-
+
diff --git a/p2p-media-loader-demo/src/App.tsx b/p2p-media-loader-demo/src/App.tsx
index f9f911c4..6d8c4803 100644
--- a/p2p-media-loader-demo/src/App.tsx
+++ b/p2p-media-loader-demo/src/App.tsx
@@ -139,10 +139,7 @@ function App() {
type: "customHls",
customType: {
customHls: (video: HTMLVideoElement) => {
- const hls = new Hls({
- ...engine.getConfig(),
- liveSyncDurationCount: 7,
- });
+ const hls = new Hls(engine.getConfig());
engine.setHls(hls);
hls.loadSource(video.src);
hls.attachMedia(video);
diff --git a/packages/p2p-media-loader-hlsjs/src/engine.ts b/packages/p2p-media-loader-hlsjs/src/engine.ts
index 9c94c748..35984759 100644
--- a/packages/p2p-media-loader-hlsjs/src/engine.ts
+++ b/packages/p2p-media-loader-hlsjs/src/engine.ts
@@ -10,6 +10,8 @@ import { PlaylistLoaderBase } from "./playlist-loader";
import { SegmentManager } from "./segment-mananger";
import { Core, CoreEventHandlers } from "p2p-media-loader-core";
+const LIVE_EDGE_DELAY = 25;
+
export class Engine {
private readonly core: Core;
private readonly segmentManager: SegmentManager;
@@ -23,12 +25,12 @@ export class Engine {
public getConfig(): Pick<
HlsConfig,
- "fLoader" | "pLoader" | "liveSyncDurationCount"
+ "fLoader" | "pLoader" | "liveSyncDuration"
> {
return {
- liveSyncDurationCount: 7,
fLoader: this.createFragmentLoaderClass(),
pLoader: this.createPlaylistLoaderClass(),
+ liveSyncDuration: LIVE_EDGE_DELAY,
};
}
diff --git a/packages/p2p-media-loader-shaka/src/engine.ts b/packages/p2p-media-loader-shaka/src/engine.ts
index 5f2e4daf..c64431b1 100644
--- a/packages/p2p-media-loader-shaka/src/engine.ts
+++ b/packages/p2p-media-loader-shaka/src/engine.ts
@@ -15,6 +15,8 @@ import {
import { Loader } from "./loading-handler";
import { Core, CoreEventHandlers } from "p2p-media-loader-core";
+const LIVE_EDGE_DELAY = 25;
+
export class Engine {
private player?: shaka.Player;
private readonly shaka: Shaka;
@@ -68,6 +70,14 @@ export class Engine {
player[method]("loaded", this.handlePlayerLoaded);
player[method]("loading", this.destroyCurrentStreamContext);
player[method]("unloading", this.handlePlayerUnloading);
+ player[method]("manifestparsed", this.handleManifestParsed);
+ };
+
+ private handleManifestParsed = () => {
+ const manifest = this.player?.getManifest();
+ if (!manifest) return;
+ const { presentationTimeline } = manifest;
+ presentationTimeline.setDelay(LIVE_EDGE_DELAY);
};
private handlePlayerLoaded = () => {