Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Merge branch 'event-source' of https://github.com/DenizUgur/MV_LL-DASH
Browse files Browse the repository at this point in the history
…into event-source
  • Loading branch information
ofaladag committed May 16, 2021
2 parents 3739704 + 84e883a commit 01eeff8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
2 changes: 1 addition & 1 deletion dashjs
27 changes: 5 additions & 22 deletions development/app/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import { MediaPlayer } from "../../../dashjs";
import styles from "../styles/Home.module.css";

export default function Home() {
const [state, setState] = useState({
latency: [],
mv: 0,
frame: 0,
});
const [state, setState] = useState(0);
const ref = useRef(null);

useEffect(() => {
Expand All @@ -23,17 +19,13 @@ export default function Home() {
mode: "liveCatchupModeLoLP",
minDrift: 0.2,
playbackRate: 0.3,
respectVideoEvents: true,
},
},
});

player.on("motionVectorReceived", (e) => {
setState((prevState) => ({
...prevState,
mv: e.mv_data.length > 0 ? e.mv_data.pop().mv : prevState.mv,
frame: e.mv_data.length > 0 ? e.mv_data.pop().frame : prevState.frame,
latency: [...prevState.latency, { t: player.getCurrentLiveLatency() }],
}));
player.on("playbackProgress", (e) => {
setState(player.getCurrentLiveLatency());
});

return () => {};
Expand All @@ -55,16 +47,7 @@ export default function Home() {
muted
></video>
<div className={styles.latency}>
<span className={styles.delayBig}>
{state.latency[state.latency.length - 1] &&
state.latency[state.latency.length - 1].t}
</span>
s
<br />
mv: {state.mv}
<br />
frame: {state.frame}
<br />
<span className={styles.delayBig}>{state}</span>s
</div>
</main>
</div>
Expand Down

0 comments on commit 01eeff8

Please sign in to comment.