chore: format player storage and timeline
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
export type StorageLike = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
|
export type StorageLike = Pick<Storage, "getItem" | "setItem" | "removeItem">;
|
||||||
|
|
||||||
const getLocalStorage = (): StorageLike | null => {
|
const getLocalStorage = (): StorageLike | null => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { TimelineBounds } from './types';
|
import type { TimelineBounds } from "./types";
|
||||||
import { state } from './state';
|
import { state } from "./state";
|
||||||
import { formatTime } from './controls';
|
import { formatTime } from "./controls";
|
||||||
|
|
||||||
// cached to avoid recalc on every timeupdate
|
// cached to avoid recalc on every timeupdate
|
||||||
let cachedBounds: TimelineBounds = { start: 0, end: 0, duration: 0 };
|
let cachedBounds: TimelineBounds = { start: 0, end: 0, duration: 0 };
|
||||||
@@ -124,11 +124,11 @@ export const updateTimeline = (currentTime: number): void => {
|
|||||||
const b = getBounds();
|
const b = getBounds();
|
||||||
|
|
||||||
if (b.duration <= 0) {
|
if (b.duration <= 0) {
|
||||||
progress.style.width = '0%';
|
progress.style.width = "0%";
|
||||||
buffered.style.width = '0%';
|
buffered.style.width = "0%";
|
||||||
scrubber.style.left = '0%';
|
scrubber.style.left = "0%";
|
||||||
timeDisplay.textContent = '00:00';
|
timeDisplay.textContent = "00:00";
|
||||||
durationDisplay.textContent = '00:00';
|
durationDisplay.textContent = "00:00";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user