-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.txt
93 lines (73 loc) · 2.46 KB
/
error.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
1st
error: cannot upload video (Error: Unauthorized request)
soluion : need to login 1st to authenticate user, so that we get to know about the video that is getting uploaded is published by which user
2nd
return (
{Array.isArray(videos) &&
videos.map((video, index) => (
<>
<Link key={`${video._id}_${index}`} to={`/videoplayer/${video._id}`}>
<div
className="p-4 cursor-pointer"
>
</Link>
</>
))}
</div>
</div>
);
error: Warning: Each child in a list should have a unique "key" prop.
context: Here we have given Each child a unique video._id but sill getting the problem
solution: just remove the empty fragments (<> </>).
solved code:
return (
{Array.isArray(videos) &&
videos.map((video, index) => (
<Link key={`${video._id}_${index}`} to={`/videoplayer/${video._id}`}>
<div
className="p-4 cursor-pointer"
>
</Link>
))}
</div>
</div>
);
3rd
<video controls width="60%" height="auto">
<source src={videoFile} type="video/mp4" />
Your browser does not support the video tag.
</video>
error context:"the video was not getting played"
solution: " check Conditionally if the "videoFile" is not null. before it was playing the videoFile in null state. even useeffect was used to update the videoFile link, without checking condtionally it was unable to run"
solved:
{videoFile && ( // Conditionally render if videoFile is not null
<video controls width="60%" height="auto">
<source src={videoFile} type="video/mp4" />
Your browser does not support the video tag.
</video>
)}
4th
error context : current user like not getting fetched on initial reload.
tried1 : useEffect(() => {
fetchUser();
fetchVideo();
fetchLikedVideos();
}, [likeClicked , dislikeClicked , likes]);
tried2 : useEffect(() => {
fetchUser();
fetchVideo();
fetchLikedVideos();
}, []);
solution: still not very clear. But as far as i got, i called the fetchLikedVideos() inside the fetchvideo() as video was getting fetched on initial reload.
solved:
const fetchVideo = async () => {
try {
const response = await axios.get(
`http://localhost:3000/api/v1/video/${id}`
);
setLikes(response.data.data.likes);
await fetchLikedVideos();
} catch (error) {
console.error("Error:", error);
}
};