This repository has been archived by the owner on Feb 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
189 additions
and
13 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,7 @@ | ||
{ | ||
"cSpell.words": [ | ||
"enablejsapi", | ||
"playsinline", | ||
"Vars" | ||
] | ||
} |
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
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
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,46 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>YAD: YouTube Auto Delay</title> | ||
<script src="./script.js"></script> | ||
<link rel="stylesheet" href="./styles.css" /> | ||
<link rel="icon" type="image/png" href="./isha-logo.png" /> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>YAD: YouTube Auto Delay</h1> | ||
</header> | ||
|
||
<section> | ||
<label for="videoId">Video ID:</label> | ||
<input | ||
type="text" | ||
id="videoId" | ||
placeholder="Enter Video ID" | ||
value="jfKfPfyJRdk" /> | ||
|
||
<label for="delay">Delay (in seconds):</label> | ||
<input | ||
type="number" | ||
id="delay" | ||
placeholder="Enter Delay" | ||
value="900" /> | ||
|
||
<button onclick="configurePlayer()">Update</button> | ||
</section> | ||
|
||
<div class="iframe-container"> | ||
<iframe | ||
id="player" | ||
width="560" | ||
height="315" | ||
src="https://www.youtube-nocookie.com/embed/jfKfPfyJRdk?autoplay=1&enablejsapi=1&iv_load_policy=3&start=900" | ||
title="YouTube video player" | ||
frameborder="0" | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" | ||
allowfullscreen></iframe> | ||
</div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,51 @@ | ||
var player; | ||
|
||
function configurePlayer() { | ||
var videoId = document.getElementById('videoId').value; | ||
var delay = document.getElementById('delay').value; | ||
player.loadVideoById({ videoId: videoId }); | ||
|
||
// Update the URL without triggering a full page reload | ||
var stateObj = { videoId: videoId, delay: delay }; | ||
var newUrl = | ||
window.location.href.split('?')[0] + | ||
`?videoId=${videoId}&delay=${delay}`; | ||
history.pushState(stateObj, '', newUrl); | ||
|
||
console.log( | ||
'Configuring player with Video ID:', | ||
videoId, | ||
'and Delay:', | ||
delay, | ||
); | ||
} | ||
|
||
function loadPlayerAPI() { | ||
var tag = document.createElement('script'); | ||
tag.src = 'https://www.youtube.com/iframe_api'; | ||
var firstScriptTag = document.getElementsByTagName('script')[0]; | ||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | ||
} | ||
|
||
function onYouTubeIframeAPIReady() { | ||
player = new YT.Player('player', { | ||
events: { | ||
onReady: onPlayerReady, | ||
onStateChange: onPlayerStateChange, | ||
}, | ||
}); | ||
} | ||
|
||
function onPlayerReady(event) { | ||
event.target.playVideo(); | ||
} | ||
|
||
var done = false; | ||
function onPlayerStateChange(event) { | ||
if (event.data == YT.PlayerState.PLAYING && !done) { | ||
setTimeout(() => player.stopVideo(), 6000); | ||
done = true; | ||
} | ||
} | ||
|
||
loadPlayerAPI(); |
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,75 @@ | ||
/* Reset some default styles */ | ||
body, | ||
h1, | ||
p, | ||
input, | ||
button { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
body { | ||
font-family: 'Arial', sans-serif; | ||
background-color: #f5f5f5; | ||
color: #333; | ||
} | ||
|
||
header { | ||
background-color: #333; | ||
color: #fff; | ||
text-align: center; | ||
padding: 1em; | ||
} | ||
|
||
section { | ||
max-width: 400px; | ||
margin: 20px auto; | ||
padding: 20px; | ||
background-color: #fff; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
label { | ||
display: block; | ||
margin-bottom: 8px; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
padding: 10px; | ||
margin-bottom: 16px; | ||
box-sizing: border-box; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
} | ||
|
||
button { | ||
background-color: #333; | ||
color: #fff; | ||
padding: 10px 20px; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
font-size: 16px; | ||
transition: background-color 0.3s; | ||
} | ||
|
||
button:hover { | ||
background-color: #555; | ||
} | ||
|
||
.iframe-container { | ||
margin: 50px auto; | ||
position: relative; | ||
overflow: hidden; | ||
width: 80%; | ||
padding-bottom: 56.25%; /* 16:9 aspect ratio */ | ||
} | ||
|
||
iframe { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
} |