You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
45 lines
1.2 KiB
import React, { memo, useRef, useEffect } from 'react'; |
|
import JoLPlayer, { useVideo } from './app'; |
|
import useWindowClient from '@/utils/useWindowClient'; |
|
import '@/icons/'; |
|
|
|
const AppComponent = memo(function AppComponent(props) { |
|
const videoRef = useRef<HTMLVideoElement>(null!); |
|
const { clientX } = useWindowClient(); |
|
const xx = useRef<any>(); |
|
|
|
const { isPlay, handleChangePlayState, currentTime } = useVideo( |
|
{ |
|
videoElement: |
|
videoRef.current && |
|
(videoRef.current as HTMLVideoElement & { video: HTMLVideoElement }).video, |
|
// onPause: (val: any) => { |
|
// console.log(val, xx.current); |
|
// }, |
|
// onPlay: (val: any) => { |
|
// console.log(val, xx.current); |
|
// }, |
|
// onTimeChange: (val: any) => { |
|
// console.log(val); |
|
// }, |
|
// onEndEd: (val: any) => { |
|
// console.log('结束', val); |
|
// }, |
|
onProgressSlide: (val: any) => { |
|
console.log(`童东风`, val); |
|
}, |
|
}, |
|
[videoRef.current], |
|
); |
|
|
|
xx.current = clientX; |
|
return ( |
|
<> |
|
{isPlay ? '播放' : '暂停'} |
|
<JoLPlayer ref={videoRef} /> |
|
{/* <JoLPlayer /> */} |
|
</> |
|
); |
|
}); |
|
|
|
export default AppComponent;
|
|
|