mirror of
https://github.com/Qortal/qapp-core.git
synced 2025-06-19 03:11:20 +00:00
fix muted
This commit is contained in:
parent
ad2b56d95a
commit
8295688b8a
@ -318,12 +318,12 @@ const VolumeSlider = ({ width, volume, onVolumeChange }: any) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const VolumeControl = ({ sliderWidth, onVolumeChange, volume }: any) => {
|
export const VolumeControl = ({ sliderWidth, onVolumeChange, volume , isMuted, toggleMute}: any) => {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{ display: "flex", gap: "5px", alignItems: "center", width: "100%" }}
|
sx={{ display: "flex", gap: "5px", alignItems: "center", width: "100%" }}
|
||||||
>
|
>
|
||||||
<VolumeButton />
|
<VolumeButton isMuted={isMuted} toggleMute={toggleMute} />
|
||||||
<VolumeSlider
|
<VolumeSlider
|
||||||
width={sliderWidth}
|
width={sliderWidth}
|
||||||
onVolumeChange={onVolumeChange}
|
onVolumeChange={onVolumeChange}
|
||||||
|
@ -38,9 +38,11 @@ interface VideoControlsBarProps {
|
|||||||
openSubtitleManager: ()=> void
|
openSubtitleManager: ()=> void
|
||||||
subtitleBtnRef: any
|
subtitleBtnRef: any
|
||||||
onSelectPlaybackRate: (rate: number)=> void;
|
onSelectPlaybackRate: (rate: number)=> void;
|
||||||
|
isMuted: boolean
|
||||||
|
toggleMute: ()=> void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VideoControlsBar = ({subtitleBtnRef, showControls, playbackRate, increaseSpeed,decreaseSpeed, isFullScreen, showControlsFullScreen, reloadVideo, onVolumeChange, volume, isPlaying, canPlay, isScreenSmall, controlsHeight, playerRef, duration, progress, togglePlay, toggleFullscreen, extractFrames, openSubtitleManager, onSelectPlaybackRate}: VideoControlsBarProps) => {
|
export const VideoControlsBar = ({subtitleBtnRef, showControls, playbackRate, increaseSpeed,decreaseSpeed, isFullScreen, showControlsFullScreen, reloadVideo, onVolumeChange, volume, isPlaying, canPlay, isScreenSmall, controlsHeight, playerRef, duration, progress, togglePlay, toggleFullscreen, extractFrames, openSubtitleManager, onSelectPlaybackRate, isMuted, toggleMute}: VideoControlsBarProps) => {
|
||||||
|
|
||||||
const showMobileControls = isScreenSmall && canPlay;
|
const showMobileControls = isScreenSmall && canPlay;
|
||||||
|
|
||||||
@ -93,7 +95,7 @@ export const VideoControlsBar = ({subtitleBtnRef, showControls, playbackRate, in
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<VolumeControl onVolumeChange={onVolumeChange} volume={volume} sliderWidth={"100px"} />
|
<VolumeControl onVolumeChange={onVolumeChange} volume={volume} sliderWidth={"100px"} isMuted={isMuted} toggleMute={toggleMute} />
|
||||||
<VideoTime progress={progress} duration={duration}/>
|
<VideoTime progress={progress} duration={duration}/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
@ -206,13 +206,14 @@ export const VideoPlayer = ({
|
|||||||
status,
|
status,
|
||||||
percentLoaded,
|
percentLoaded,
|
||||||
showControlsFullScreen,
|
showControlsFullScreen,
|
||||||
onSelectPlaybackRate
|
onSelectPlaybackRate,
|
||||||
} = useVideoPlayerController({
|
} = useVideoPlayerController({
|
||||||
autoPlay,
|
autoPlay,
|
||||||
playerRef,
|
playerRef,
|
||||||
qortalVideoResource,
|
qortalVideoResource,
|
||||||
retryAttempts,
|
retryAttempts,
|
||||||
isPlayerInitialized,
|
isPlayerInitialized,
|
||||||
|
isMuted
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('isFullscreen', isFullscreen)
|
console.log('isFullscreen', isFullscreen)
|
||||||
@ -753,6 +754,8 @@ export const VideoPlayer = ({
|
|||||||
progress={localProgress}
|
progress={localProgress}
|
||||||
openSubtitleManager={openSubtitleManager}
|
openSubtitleManager={openSubtitleManager}
|
||||||
onSelectPlaybackRate={onSelectPlaybackRate}
|
onSelectPlaybackRate={onSelectPlaybackRate}
|
||||||
|
isMuted={isMuted}
|
||||||
|
toggleMute={toggleMute}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -24,10 +24,11 @@ interface UseVideoControls {
|
|||||||
qortalVideoResource: QortalGetMetadata;
|
qortalVideoResource: QortalGetMetadata;
|
||||||
retryAttempts?: number;
|
retryAttempts?: number;
|
||||||
isPlayerInitialized: boolean
|
isPlayerInitialized: boolean
|
||||||
|
isMuted: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useVideoPlayerController = (props: UseVideoControls) => {
|
export const useVideoPlayerController = (props: UseVideoControls) => {
|
||||||
const { autoPlay, playerRef, qortalVideoResource, retryAttempts, isPlayerInitialized } = props;
|
const { autoPlay, playerRef, qortalVideoResource, retryAttempts, isPlayerInitialized, isMuted } = props;
|
||||||
|
|
||||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||||
const [showControlsFullScreen, setShowControlsFullScreen] = useState(false)
|
const [showControlsFullScreen, setShowControlsFullScreen] = useState(false)
|
||||||
@ -153,14 +154,16 @@ export const useVideoPlayerController = (props: UseVideoControls) => {
|
|||||||
|
|
||||||
const toggleMute = useCallback(() => {
|
const toggleMute = useCallback(() => {
|
||||||
try {
|
try {
|
||||||
|
console.log('toggleMute')
|
||||||
const ref = playerRef as any;
|
const ref = playerRef as any;
|
||||||
if (!ref.current?.muted) return;
|
if (!ref.current) return;
|
||||||
|
|
||||||
ref.current?.muted(!ref.current?.muted)
|
|
||||||
|
ref.current?.muted(!isMuted)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('toggleMute', toggleMute)
|
console.error('toggleMute', toggleMute)
|
||||||
}
|
}
|
||||||
}, []);
|
}, [isMuted]);
|
||||||
|
|
||||||
const changeVolume = useCallback(
|
const changeVolume = useCallback(
|
||||||
(delta: number) => {
|
(delta: number) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user