Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial offset for playing recordings #716

Open
177taki opened this issue Aug 13, 2021 · 6 comments
Open

Initial offset for playing recordings #716

177taki opened this issue Aug 13, 2021 · 6 comments
Labels
enhancement New feature or request player Related to player (media-stream-player-js package) stale

Comments

@177taki
Copy link

177taki commented Aug 13, 2021

Would you support a feature enabling to specify a start position (offset) to play a recording? In particular, for long recordings, changing the offset could be helpful in addition to seek.

What I thought is like below. Any better ideas would be appreciated.

diff --git a/lib/Player.tsx b/lib/Player.tsx
index 2308b52..f97a13e 100644
--- a/lib/Player.tsx
+++ b/lib/Player.tsx
@@ -59,6 +59,7 @@ interface PlayerProps {
    * Activate automatic retries on RTSP errors.
    */
   readonly autoRetry?: boolean
+  readonly initialOffset?: number
 }
 
 export const Player = forwardRef<PlayerNativeElement, PlayerProps>(
@@ -75,11 +76,12 @@ export const Player = forwardRef<PlayerNativeElement, PlayerProps>(
       startTime,
       duration,
       autoRetry,
+      initialOffset,
     },
     ref,
   ) => {
     const [play, setPlay] = useState(autoPlay)
-    const [offset, setOffset] = useState(0)
+    const [offset, setOffset] = useState(initialOffset)
     const [refresh, setRefresh] = useState(0)
     const [host, setHost] = useState(hostname)
     const [waiting, setWaiting] = useState(autoPlay)
@177taki 177taki added the enhancement New feature or request label Aug 13, 2021
@lekoaf
Copy link
Member

lekoaf commented Aug 13, 2021

Hmm, does something like this not already exist? @barnomasoz ?

@lekoaf
Copy link
Member

lekoaf commented Aug 17, 2021

@177taki, if you can make it work, go for it. initialOffset needs a default value of 0 though.

@lekoaf
Copy link
Member

lekoaf commented Aug 17, 2021

Something like this maybe?

const [offset, setOffset] = useState(
  vapixParameters['recordingid'] !== undefined && initialOffset !== undefined ?
  initialOffset : 
  0
)

@177taki
Copy link
Author

177taki commented Aug 17, 2021

@lekoaf, much appreciated. Precisely what I wanted. Would it be possible to apply this change?

@lekoaf
Copy link
Member

lekoaf commented Aug 17, 2021

@177taki be my guest.

@lekoaf lekoaf transferred this issue from AxisCommunications/media-stream-player-js Jan 25, 2023
@lekoaf lekoaf added the player Related to player (media-stream-player-js package) label Jan 25, 2023
@github-actions
Copy link

This issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale label Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request player Related to player (media-stream-player-js package) stale
Projects
None yet
Development

No branches or pull requests

2 participants