Skip to content

Commit

Permalink
Videoplayer is prepared to play video if downloaded through Save to D…
Browse files Browse the repository at this point in the history
…isk button

Navbar uses new Q-Tube Logo
  • Loading branch information
QortalSeth committed Nov 7, 2024
1 parent bd975e8 commit 1b1c0f3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 140 deletions.
13 changes: 10 additions & 3 deletions src/components/common/VideoPlayer/Components/LoadingVideo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ import { PlayArrow } from "@mui/icons-material";
import { useVideoContext } from "./VideoContext.ts";

export const LoadingVideo = () => {
const { isLoading, resourceStatus, src, startPlay, from, togglePlay } =
useVideoContext();
const {
isLoading,
resourceStatus,
src,
startPlay,
canPlay,
from,
togglePlay,
} = useVideoContext();

const getDownloadProgress = (current: number, total: number) => {
const progress = (current / total) * 100;
Expand Down Expand Up @@ -76,7 +83,7 @@ export const LoadingVideo = () => {
)}
</Box>
)}
{((!src && !isLoading.value) || !startPlay.value) && (
{((!src && !isLoading.value) || (!startPlay.value && !canPlay.value)) && (
<Box
position="absolute"
top={0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const useVideoControlsState = (
}

const reloadVideo = async () => {
if (!videoRef.current) return;
if (!videoRef.current || !src) return;
const currentTime = videoRef.current.currentTime;
videoRef.current.src = src;
videoRef.current.load();
Expand Down Expand Up @@ -393,5 +393,6 @@ export const useVideoControlsState = (
handleCanPlay,
toggleMute,
showControlsFullScreen,
setPlaying,
};
};
9 changes: 9 additions & 0 deletions src/components/common/VideoPlayer/VideoPlayer-State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ 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 Down
2 changes: 1 addition & 1 deletion src/components/layout/Navbar/Navbar-styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const CustomAppBar = styled(AppBar)(({ theme }) => ({
[theme.breakpoints.only("xs")]: {
gap: "15px",
},
height: "40px",
height: "50px",
}));
export const LogoContainer = styled("div")({
cursor: "pointer",
Expand Down
142 changes: 7 additions & 135 deletions src/components/layout/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useNavigate } from "react-router-dom";
import SearchIcon from "@mui/icons-material/Search";

import { DownloadTaskManager } from "../../common/DownloadTaskManager";
import Logo from "../../../assets/img/logo.png";
import Logo from "../../../assets/img/logo.webp";
import { useDispatch, useSelector } from "react-redux";
import {
addFilteredVideos,
Expand Down Expand Up @@ -120,8 +120,9 @@ const NavBar: React.FC<Props> = ({
src={Logo}
style={{
width: "auto",
height: "55px",
height: "45px",
padding: "2px",
marginTop: "5px",
}}
/>
</LogoContainer>
Expand All @@ -133,135 +134,6 @@ const NavBar: React.FC<Props> = ({
gap: "10px",
}}
>
{/* {windowSize.width <= 600 ? (
<Box
sx={{
display: 'flex',
alignItems: 'center',
gap: 1
}}
className="myClassOver600"
>
<Box onClick={openNotificationPopover}>
<SearchIcon
sx={{
cursor: 'pointer',
display: 'flex'
}}
/>
</Box>
{filterValue && (
<BackspaceIcon
sx={{
cursor: 'pointer'
}}
onClick={() => {
dispatch(setIsFiltering(false))
dispatch(setFilterValue(''))
dispatch(addFilteredVideos([]))
searchValRef.current = ''
if (!inputRef.current) return
inputRef.current.value = ''
}}
/>
)}
</Box>
): (
<Box
sx={{
display: 'flex',
alignItems: 'center',
gap: 1
}}
className="myClassUnder600"
>
<Input
id="standard-adornment-name"
inputRef={inputRef}
onChange={(e) => {
searchValRef.current = e.target.value
}}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.keyCode === 13) {
if (!searchValRef.current) {
dispatch(setIsFiltering(false))
dispatch(setFilterValue(''))
dispatch(addFilteredVideos([]))
searchValRef.current = ''
if (!inputRef.current) return
inputRef.current.value = ''
return
}
navigate('/')
dispatch(setIsFiltering(true))
dispatch(addFilteredVideos([]))
dispatch(setFilterValue(searchValRef.current))
}
}}
placeholder="Search"
sx={{
'&&:before': {
borderBottom: 'none'
},
'&&:after': {
borderBottom: 'none'
},
'&&:hover:before': {
borderBottom: 'none'
},
'&&.Mui-focused:before': {
borderBottom: 'none'
},
'&&.Mui-focused': {
outline: 'none'
},
fontSize: '18px'
}}
/>
<SearchIcon
sx={{
cursor: 'pointer'
}}
onClick={() => {
if (!searchValRef.current) {
dispatch(setIsFiltering(false))
dispatch(setFilterValue(''))
dispatch(addFilteredVideos([]))
searchValRef.current = ''
if (!inputRef.current) return
inputRef.current.value = ''
return
}
navigate('/')
dispatch(setIsFiltering(true))
dispatch(addFilteredVideos([]))
dispatch(setFilterValue(searchValRef.current))
}}
/>
{filterValue && (
<BackspaceIcon
sx={{
cursor: 'pointer'
}}
onClick={() => {
dispatch(setIsFiltering(false))
dispatch(setFilterValue(''))
dispatch(addFilteredVideos([]))
searchValRef.current = ''
if (!inputRef.current) return
inputRef.current.value = ''
}}
/>
)}
</Box>
)} */}

<Popover
id={idNotification}
open={openPopover}
Expand Down Expand Up @@ -374,15 +246,15 @@ const NavBar: React.FC<Props> = ({
{!userAvatar ? (
<AccountCircleSVG
color={theme.palette.text.primary}
width="30"
height="30"
width="40"
height="40"
/>
) : (
<img
src={userAvatar}
alt="User Avatar"
width="30"
height="30"
width="40"
height="40"
style={{
borderRadius: "50%",
}}
Expand Down
1 change: 1 addition & 0 deletions src/pages/ContentPages/VideoContent/VideoActionsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const VideoActionsBar = ({
display: "grid",
gridTemplateColumns: "1fr 1fr",
marginTop: "15px",
alignItems: "center",
...sx,
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const FileAttachmentContainer = styled(Box)(({ theme }) => ({
padding: "5px 10px",
border: `1px solid ${theme.palette.text.primary}`,
width: "350px",
height: "50px",
}));

export const FileAttachmentFont = styled(Typography)(({ theme }) => ({
Expand Down

0 comments on commit 1b1c0f3

Please sign in to comment.