3
0
mirror of https://github.com/Qortal/q-tube.git synced 2025-02-11 17:55:51 +00:00

Merge pull request #50 from QortalSeth/main

Updates to VideoPlayer and VideoContent pages
This commit is contained in:
Qortal Dev 2024-11-12 15:07:04 -07:00 committed by GitHub
commit e0be6f4efd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 24 additions and 23 deletions

View File

@ -9,7 +9,6 @@ export const useAppState = () => {
const persistor = persistStore(store);
useEffect(() => {
const subscriptionList = store.getState().persist.subscriptionList;
subscriptionListFilter(false).then(filteredList => {
store.dispatch(setFilteredSubscriptions(filteredList));
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

BIN
src/assets/img/logo.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

View File

@ -149,11 +149,11 @@ export const useVideoControlsState = (
togglePlay();
};
const firstPlay = useSignal(true);
const handleCanPlay = () => {
if (firstPlay.value) setPlaying(true); // makes the video play when fully loaded
firstPlay.value = false;
isLoading.value = false;
canPlay.value = true;
updatePlaybackRate(playbackRate.value);
setPlaying(true); // makes the video play when fully loaded
};
const setPlaying = async (setPlay: boolean) => {

View File

@ -110,15 +110,6 @@ export const useVideoPlayerState = (props: VideoPlayerProps, ref: any) => {
const toggleRef = useRef<any>(null);
const { downloadVideo } = useContext(MyContext);
if (resourceStatus?.status === "READY") {
canPlay.value = true;
isLoading.value = false;
//startPlay.value = true;
// playing.value = false;
// videoRef.current.pause();
}
const onProgressChange = async (_: any, value: number | number[]) => {
if (!videoRef.current) return;
videoRef.current.currentTime = value as number;
@ -142,6 +133,14 @@ export const useVideoPlayerState = (props: VideoPlayerProps, ref: any) => {
progress.value = videoRef.current.currentTime;
};
const videoCanPlayIfDownloaded = () => {
if (resourceStatus?.status === "READY") {
canPlay.value = true;
}
};
videoCanPlayIfDownloaded();
const getSrc = React.useCallback(async () => {
if (!name || !identifier || !service || !jsonId || !user) return;
try {

View File

@ -11,7 +11,6 @@ export const VideoContainer = styled(Box)(({ theme }) => ({
height: "100%",
margin: 0,
padding: 0,
"&:focus": { outline: "none" },
}));

View File

@ -236,11 +236,17 @@ export const useVideoContentState = () => {
if (!nameAddress || !id) return;
getComments(id, nameAddress);
}, [getComments, id, nameAddress]);
const subList = useSelector(
(state: RootState) => state.persist.subscriptionList
);
const focusVideo = (e: React.MouseEvent<HTMLDivElement>) => {
const focusVideo = () => {
const focusRef = containerRef.current?.getContainerRef()?.current;
focusRef?.focus({ preventScroll: true });
};
useEffect(() => {
focusVideo();
});
const focusVideoOnClick = (e: React.MouseEvent<HTMLDivElement>) => {
console.log("in focusVideo");
const target = e.target as Element;
@ -259,12 +265,11 @@ export const useVideoContentState = () => {
if (target == e.currentTarget || clickOnEmptySpace) {
console.log("in correctTarget");
const focusRef = containerRef.current?.getContainerRef()?.current;
focusRef.focus({ preventScroll: true });
focusVideo();
}
};
return {
focusVideo,
focusVideo: focusVideoOnClick,
videoReference,
channelName,
id,

View File

@ -68,9 +68,8 @@ export const VideoContent = () => {
<Box
sx={{
display: "flex",
marginLeft: "5%",
flexDirection: "column",
padding: "0px 10px",
padding: "0px 10px 0px 5%",
}}
onClick={focusVideo}
>