|
|
@ -1,13 +1,13 @@ |
|
|
|
import React, { memo, useContext, useRef, useEffect, useMemo, useCallback } from 'react'; |
|
|
|
import React, { memo, useContext, useRef, useEffect, useMemo, useCallback } from 'react'; |
|
|
|
import Broadcast from '@/components/svgIcon'; |
|
|
|
import Broadcast from '@/components/svgIcon'; |
|
|
|
import Tooltip from '@/components/tooltip'; |
|
|
|
import Tooltip from '@/components/tooltip'; |
|
|
|
import { FlowContext, contextType } from '@/core/context'; |
|
|
|
import { FlowContext } from '@/core/context'; |
|
|
|
import { useVideo } from '@/core/useVideo'; |
|
|
|
import { useVideo } from '@/core/useVideo'; |
|
|
|
import { secondsToMinutesAndSecondes, createALabel } from '@/utils'; |
|
|
|
import { secondsToMinutesAndSecondes, createALabel } from '@/utils'; |
|
|
|
import { useControls } from './variable'; |
|
|
|
import { useControls } from './variable'; |
|
|
|
import useWindowClient from '@/utils/useWindowClient'; |
|
|
|
import useWindowClient from '@/utils/useWindowClient'; |
|
|
|
import screenfull, { Screenfull } from 'screenfull'; |
|
|
|
import screenfull, { Screenfull } from 'screenfull'; |
|
|
|
import { multipleList } from '@/core/config'; |
|
|
|
import { multipleList, defaultVolume } from '@/core/config'; |
|
|
|
import SetComponent from './set'; |
|
|
|
import SetComponent from './set'; |
|
|
|
import MultipleComponent from './multiple'; |
|
|
|
import MultipleComponent from './multiple'; |
|
|
|
import VolumeComponent from './volume'; |
|
|
|
import VolumeComponent from './volume'; |
|
|
@ -87,6 +87,7 @@ const Index = memo(function Index(props) { |
|
|
|
* @description 音量滑动元素点击 |
|
|
|
* @description 音量滑动元素点击 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const changeCurrentVolume: React.MouseEventHandler<HTMLDivElement> = (e) => { |
|
|
|
const changeCurrentVolume: React.MouseEventHandler<HTMLDivElement> = (e) => { |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
const volumeSliderMirrorElement = ( |
|
|
|
const volumeSliderMirrorElement = ( |
|
|
|
volumeSliderMirror.current as HTMLDivElement & { element: HTMLDivElement } |
|
|
|
volumeSliderMirror.current as HTMLDivElement & { element: HTMLDivElement } |
|
|
|
).element; |
|
|
|
).element; |
|
|
@ -99,7 +100,8 @@ const Index = memo(function Index(props) { |
|
|
|
updateCurrentVolume(volumePercent); |
|
|
|
updateCurrentVolume(volumePercent); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const slideCurrentVolume = () => { |
|
|
|
const slideCurrentVolume: React.MouseEventHandler<HTMLDivElement> = (e) => { |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
const volumeSliderMirrorElement = ( |
|
|
|
const volumeSliderMirrorElement = ( |
|
|
|
volumeSliderMirror.current as HTMLDivElement & { element: HTMLDivElement } |
|
|
|
volumeSliderMirror.current as HTMLDivElement & { element: HTMLDivElement } |
|
|
|
).element; |
|
|
|
).element; |
|
|
@ -123,7 +125,8 @@ const Index = memo(function Index(props) { |
|
|
|
volumeInterval.current && clearInterval(volumeInterval.current); |
|
|
|
volumeInterval.current && clearInterval(volumeInterval.current); |
|
|
|
dispatch({ type: 'isSlideVolume', data: false }); |
|
|
|
dispatch({ type: 'isSlideVolume', data: false }); |
|
|
|
}; |
|
|
|
}; |
|
|
|
const clearVolumeInterval = () => { |
|
|
|
const clearVolumeInterval: React.MouseEventHandler<HTMLDivElement> = (e) => { |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
whenMouseUpDo(); |
|
|
|
whenMouseUpDo(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
/** |
|
|
|
/** |
|
|
@ -201,6 +204,15 @@ const Index = memo(function Index(props) { |
|
|
|
dispatch({ type: 'isWebPageFullScreen', data: true }); |
|
|
|
dispatch({ type: 'isWebPageFullScreen', data: true }); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @description 静音键和非静音键的切换 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
const toggleVolume = () => { |
|
|
|
|
|
|
|
reviceProps.videoRef!.volume = controlsState.isMuted ? defaultVolume / 100 : 0; |
|
|
|
|
|
|
|
dispatch({ type: 'isMuted', data: controlsState.isMuted ? false : true }); |
|
|
|
|
|
|
|
reviceProps.videoRef!.muted = controlsState.isMuted ? false : true; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
className="JoL-controls-container" |
|
|
|
className="JoL-controls-container" |
|
|
@ -224,12 +236,21 @@ const Index = memo(function Index(props) { |
|
|
|
changeCurrentVolume={changeCurrentVolume} |
|
|
|
changeCurrentVolume={changeCurrentVolume} |
|
|
|
slideCurrentVolume={slideCurrentVolume} |
|
|
|
slideCurrentVolume={slideCurrentVolume} |
|
|
|
clearVolumeInterval={clearVolumeInterval} |
|
|
|
clearVolumeInterval={clearVolumeInterval} |
|
|
|
|
|
|
|
isMuted={controlsState.isMuted} |
|
|
|
|
|
|
|
toggleVolume={toggleVolume} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<SetComponent switchChange={switchChange} /> |
|
|
|
<SetComponent switchChange={switchChange} /> |
|
|
|
<Tooltip |
|
|
|
<Tooltip |
|
|
|
styleCss={{ padding: '0 5px' }} |
|
|
|
styleCss={{ padding: '0 5px' }} |
|
|
|
title="截图" |
|
|
|
title="截图" |
|
|
|
icon={<Broadcast iconClass="screenshot" fill="#fff" onClick={screenshot} />} |
|
|
|
icon={ |
|
|
|
|
|
|
|
<Broadcast |
|
|
|
|
|
|
|
iconClass="screenshot" |
|
|
|
|
|
|
|
className="hover-icon-animate" |
|
|
|
|
|
|
|
fill="#fff" |
|
|
|
|
|
|
|
onClick={screenshot} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<Tooltip |
|
|
|
<Tooltip |
|
|
|
styleCss={{ padding: '0 5px' }} |
|
|
|
styleCss={{ padding: '0 5px' }} |
|
|
@ -238,6 +259,7 @@ const Index = memo(function Index(props) { |
|
|
|
<Broadcast |
|
|
|
<Broadcast |
|
|
|
iconClass="fullScreen" |
|
|
|
iconClass="fullScreen" |
|
|
|
fill="#fff" |
|
|
|
fill="#fff" |
|
|
|
|
|
|
|
className="hover-icon-animate" |
|
|
|
fontSize={'20px'} |
|
|
|
fontSize={'20px'} |
|
|
|
onClick={pictureInPicture} |
|
|
|
onClick={pictureInPicture} |
|
|
|
/> |
|
|
|
/> |
|
|
@ -250,6 +272,7 @@ const Index = memo(function Index(props) { |
|
|
|
<Broadcast |
|
|
|
<Broadcast |
|
|
|
iconClass="fullScreen" |
|
|
|
iconClass="fullScreen" |
|
|
|
fill="#fff" |
|
|
|
fill="#fff" |
|
|
|
|
|
|
|
className="hover-icon-animate" |
|
|
|
fontSize={'20px'} |
|
|
|
fontSize={'20px'} |
|
|
|
onClick={clientFullScreen} |
|
|
|
onClick={clientFullScreen} |
|
|
|
/> |
|
|
|
/> |
|
|
@ -264,6 +287,7 @@ const Index = memo(function Index(props) { |
|
|
|
fill="#fff" |
|
|
|
fill="#fff" |
|
|
|
fontSize={'20px'} |
|
|
|
fontSize={'20px'} |
|
|
|
onClick={requestFullScreen} |
|
|
|
onClick={requestFullScreen} |
|
|
|
|
|
|
|
className="hover-icon-animate" |
|
|
|
/> |
|
|
|
/> |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|