🥞 timestamp feature made more smart

- if time is smaller than 3 dont add timestamp
- if the video ended dont add timestamp
This commit is contained in:
Shiba 2022-01-07 20:56:56 +00:00
parent 2b3d43e0dc
commit 7c50daf7fc

View file

@ -112,11 +112,13 @@ function updateButton(ctx: UpdateContext | null): void {
if (!mountPoint) return
if (!ctx) return render(<WatchOnLbryButton />, mountPoint)
if (ctx.descriptor.type !== 'video') return;
const time = videoElement?.currentTime ?? 0
const lbryPathname = ctx.lbryPathname
const targetPlatform = ctx.targetPlatform
let time: number = videoElement?.currentTime ?? 0
if (time < 3) time = 0
if (time >= (videoElement?.duration ?? 0) - 1) time = 0
render(<WatchOnLbryButton targetPlatform={targetPlatform} lbryPathname={lbryPathname} time={time} />, mountPoint)
render(<WatchOnLbryButton targetPlatform={targetPlatform} lbryPathname={lbryPathname} time={time || undefined} />, mountPoint)
}
function redirectTo({ targetPlatform, lbryPathname }: UpdateContext): void {