-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #728 from Harshini-Purushothaman/main
youtube clone
- Loading branch information
Showing
5 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>YouTube Clone</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>YouTube Clone</h1> | ||
<input type="text" id="search" placeholder="Search..."> | ||
</header> | ||
<main> | ||
<div id="video-container"></div> | ||
<div id="video-player" style="display: none;"> | ||
<video controls id="video-element"> | ||
<source id="video-source" src="" type="video/mp4"> | ||
Your browser does not support the video tag. | ||
</video> | ||
<button onclick="closePlayer()">Close</button> | ||
</div> | ||
</main> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const videos = [ | ||
{ | ||
title: 'How to Install Visual Studio Code on Windows 11 (VS Code) (2024)', | ||
src: 'videos/How Install Visual Studio Code on Windows 11 (VS Code) (2024).mp4', | ||
thumbnail: 'thumbnails/vscode.jpeg', | ||
}, | ||
// You can add more videos here if needed | ||
]; | ||
|
||
const videoContainer = document.getElementById('video-container'); | ||
|
||
function loadVideos() { | ||
videos.forEach(video => { | ||
const videoElement = document.createElement('div'); | ||
videoElement.className = 'video'; | ||
videoElement.innerHTML = ` | ||
<img src="${video.thumbnail}" alt="${video.title}" onclick="playVideo('${video.src}')"> | ||
<h3>${video.title}</h3> | ||
`; | ||
videoContainer.appendChild(videoElement); | ||
}); | ||
} | ||
|
||
function playVideo(src) { | ||
document.getElementById('video-source').src = src; | ||
document.getElementById('video-element').load(); | ||
document.getElementById('video-player').style.display = 'block'; | ||
} | ||
|
||
function closePlayer() { | ||
document.getElementById('video-player').style.display = 'none'; | ||
} | ||
|
||
document.getElementById('search').addEventListener('input', function() { | ||
const query = this.value.toLowerCase(); | ||
const filteredVideos = videos.filter(video => video.title.toLowerCase().includes(query)); | ||
videoContainer.innerHTML = ''; | ||
filteredVideos.forEach(video => { | ||
const videoElement = document.createElement('div'); | ||
videoElement.className = 'video'; | ||
videoElement.innerHTML = ` | ||
<img src="${video.thumbnail}" alt="${video.title}" onclick="playVideo('${video.src}')"> | ||
<h3>${video.title}</h3> | ||
`; | ||
videoContainer.appendChild(videoElement); | ||
}); | ||
}); | ||
|
||
window.onload = loadVideos; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
header { | ||
background-color: #f8f8f8; | ||
padding: 10px; | ||
text-align: center; | ||
} | ||
#video-container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
padding: 10px; | ||
} | ||
.video { | ||
margin: 10px; | ||
width: 300px; | ||
} | ||
.video img { | ||
width: 100%; | ||
cursor: pointer; | ||
} | ||
#video-player { | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
background: white; | ||
padding: 20px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.5 MB
youtube-clone/videos/How Install Visual Studio Code on Windows 11 (VS Code) (2024).mp4
Binary file not shown.