Skip to content
This repository has been archived by the owner on Feb 7, 2025. It is now read-only.

Commit

Permalink
yad init (not working yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexFreik committed Dec 2, 2023
1 parent f510dd0 commit f67d6df
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"cSpell.words": [
"enablejsapi",
"playsinline",
"Vars"
]
}
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,23 @@ You will need to do the following:

1. Open Zoom Web Client [app.zoom.us/wc](https://app.zoom.us/wc):

<img width="500" alt="Zoom Web Client" src="https://github.com/AlexFreik/zam/assets/61039123/f0c15a18-6ae3-4272-ac18-86de2e4bb901">
<img width="500" alt="Zoom Web Client" src="https://github.com/AlexFreik/zam/assets/61039123/f0c15a18-6ae3-4272-ac18-86de2e4bb901">

3. Open a meeting and join the audio.
2. Open a meeting and join the audio.

4. Open the developer Console in Chrome browser and execute this line (press F12):
3. Open the developer Console in Chrome browser and execute this line (press F12):

```js
document
.getElementById('webclient')
.contentWindow.document.body.appendChild(
Object.assign(document.createElement('script'), {
src: 'https://alexfreik.github.io/zam/script.js',
}),
);
document.getElementById('webclient').contentWindow.document.body.appendChild(
Object.assign(document.createElement('script'), {
src: 'https://alexfreik.github.io/zam/script.js',
}),
);
```

5. If a new ZAM window appears it means you are done!
4. If a new ZAM window appears it means you are done!

<img width="500" alt="Screenshot 2023-11-29 at 12 54 35" src="https://github.com/AlexFreik/zam/assets/61039123/43a91dfb-d221-4a3b-bfc2-7fc810d93954">
<img width="500" alt="Screenshot 2023-11-29 at 12 54 35" src="https://github.com/AlexFreik/zam/assets/61039123/43a91dfb-d221-4a3b-bfc2-7fc810d93954">

## Features

Expand Down
1 change: 0 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ function logAudioStatus() {
logMessage(audioStatus, type);
}


/**
* Logs a message with a specified type to the designated logs container.
*
Expand Down
46 changes: 46 additions & 0 deletions yad/index.html
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>
Binary file added yad/isha-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions yad/script.js
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();
75 changes: 75 additions & 0 deletions yad/styles.css
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%;
}

0 comments on commit f67d6df

Please sign in to comment.