refactor: rewrite video player

This commit is contained in:
Prayag Prajapati committed 2025-06-27 16:55:17 +05:30
1 parent 0f5482627a
commit 7b0b22b611
34 files changed
+3766 -3007

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
/**
* Formats a given ticks value into a human-readable time string.
* @param ticks - The ticks value to be formatted, typically in 100-nanosecond intervals.
* @returns Formatted time string in the format HH:MM:SS.
*/
const ticksDisplay = (ticks: number) => {
const time = Math.round(ticks / 10000);
let formatedTime = "";
let timeSec = Math.floor(time / 1000);
let timeMin = Math.floor(timeSec / 60);
timeSec -= timeMin * 60;
timeSec = timeSec === 0 ? 0o0 : timeSec;
const timeHr = Math.floor(timeMin / 60);
timeMin -= timeHr * 60;
formatedTime = `${timeHr.toLocaleString([], {
minimumIntegerDigits: 2,
useGrouping: false,
})}:${timeMin.toLocaleString([], {
minimumIntegerDigits: 2,
useGrouping: false,
})}:${timeSec.toLocaleString([], {
minimumIntegerDigits: 2,
useGrouping: false,
})}`;
return formatedTime;
};
export default ticksDisplay;