File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
src/pages/Video/components Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ const CorePlayer = ({ video }: { video: GetVideosByVidApiResponse }) => {
5252 const [ postVideoByVidObservations ] = usePostVideosByVidObservationsMutation ( ) ;
5353 const [ patchObservation ] = usePatchVideosByVidObservationsAndOidMutation ( ) ;
5454 const [ start , setStart ] = useState < number | undefined > ( undefined ) ;
55- const { context } = usePlayerContext ( ) ;
55+ const { context, setIsPlaying } = usePlayerContext ( ) ;
5656 const { currentTime } = context . player || { currentTime : 0 } ;
5757 const { addToast } = useToast ( ) ;
5858
@@ -124,9 +124,14 @@ const CorePlayer = ({ video }: { video: GetVideosByVidApiResponse }) => {
124124 ) ;
125125
126126 const seekPlayer = useCallback (
127- ( time : number ) => {
127+ ( time : number , forcePlay ?: boolean ) => {
128128 if ( videoRef && videoRef . current ) {
129129 videoRef . current . currentTime = time ;
130+
131+ if ( forcePlay ) {
132+ setIsPlaying ( true ) ;
133+ videoRef . current . play ( ) ;
134+ }
130135 }
131136 } ,
132137 [ videoRef ]
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ const Transcript = ({
7474} : {
7575 currentTime : number ;
7676 isSearchable : boolean ;
77- setCurrentTime : ( time : number ) => void ;
77+ setCurrentTime : ( time : number , forcePlay ?: boolean ) => void ;
7878} ) => {
7979 const { t } = useTranslation ( ) ;
8080 const { videoId } = useParams ( ) ;
@@ -189,7 +189,7 @@ const Transcript = ({
189189 start = { p . start }
190190 end = { p . end }
191191 speakerIndex = { p . speaker || 0 }
192- setCurrentTime = { setCurrentTime }
192+ setCurrentTime = { ( time ) => setCurrentTime ( time , true ) }
193193 >
194194 { p . words . map ( ( item , index ) => (
195195 < Highlight . Word
You can’t perform that action at this time.
0 commit comments