Skip to content

Commit

Permalink
Updates to VideoPlayer and VideoContent pages
Browse files Browse the repository at this point in the history
Area that clicking focuses video in VideoContent.tsx has been increased on left side of page. Video is also autofocused by default.

Fixed issue where changing video progress (such as the left/right or 1-9 hotkeys) would make a paused video play.

Removed old logos
  • Loading branch information
QortalSeth committed Nov 12, 2024
1 parent 1b1c0f3 commit dcb2aec
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 22 deletions.
Binary file removed src/assets/img/logo.png
Binary file not shown.
Binary file added src/assets/img/logo.webp
Binary file not shown.
Binary file removed src/assets/img/logo2.jpg
Binary file not shown.
Binary file removed src/assets/img/logo3.jpg
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
17 changes: 8 additions & 9 deletions src/components/common/VideoPlayer/VideoPlayer-State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/components/common/VideoPlayer/VideoPlayer-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const VideoContainer = styled(Box)(({ theme }) => ({
height: "100%",
margin: 0,
padding: 0,

"&:focus": { outline: "none" },
}));

Expand Down
19 changes: 12 additions & 7 deletions src/pages/ContentPages/VideoContent/VideoContent-State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/pages/ContentPages/VideoContent/VideoContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
>
Expand Down

0 comments on commit dcb2aec

Please sign in to comment.