My goal is to set a start time for video. Currently, my component looks like this:
const VideoPlayer = () => {
const [config] = useState<ConfigProps>({
url: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
testStartFrom: 30
});
const [isReady, setIsReady] = useState(false);
const playerRef = useRef(null);
const onReady = useCallback(() => {
if (!isReady) {
playerRef.current.seekTo(config.testStartFrom ?? 0, "seconds");
setIsReady(true);
}
}, [isReady]);
return (
<ReactPlayer
ref={playerRef}
url={config.url}
onReady={onReady}
controls
/>
)
}
Almost everything is good, the video starts from 30 seconds, but I got double network request to achieve that. The network looks like this (The first request is from 0s, second is from 30s):
My question is: There is a way to achieve setting start time with single request?