mirror of
https://github.com/LBRYFoundation/Watch-on-LBRY.git
synced 2025-08-23 17:47:26 +00:00
Merge pull request #83 from DeepDoge/1.7.6
[Feature Update] Timestamp feature made more smart
This commit is contained in:
commit
a7b66660ea
1 changed files with 4 additions and 2 deletions
|
@ -112,11 +112,13 @@ function updateButton(ctx: UpdateContext | null): void {
|
||||||
if (!mountPoint) return
|
if (!mountPoint) return
|
||||||
if (!ctx) return render(<WatchOnLbryButton />, mountPoint)
|
if (!ctx) return render(<WatchOnLbryButton />, mountPoint)
|
||||||
if (ctx.descriptor.type !== 'video') return;
|
if (ctx.descriptor.type !== 'video') return;
|
||||||
const time = videoElement?.currentTime ?? 0
|
|
||||||
const lbryPathname = ctx.lbryPathname
|
const lbryPathname = ctx.lbryPathname
|
||||||
const targetPlatform = ctx.targetPlatform
|
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 {
|
function redirectTo({ targetPlatform, lbryPathname }: UpdateContext): void {
|
||||||
|
|
Loading…
Add table
Reference in a new issue