mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 09:13:41 -05:00
make the tiling system aware of active stream
This commit is contained in:
parent
ffc81adb8f
commit
b5ec309ccb
6 changed files with 88 additions and 43 deletions
|
|
@ -12,8 +12,11 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
||||||
"@tsconfig/svelte": "^5.0.4",
|
"@tsconfig/svelte": "^5.0.4",
|
||||||
|
"autoprefixer": "^10.4.19",
|
||||||
|
"postcss": "^8.4.40",
|
||||||
"svelte": "^4.2.18",
|
"svelte": "^4.2.18",
|
||||||
"svelte-check": "^3.8.1",
|
"svelte-check": "^3.8.1",
|
||||||
|
"tailwindcss": "^3.4.7",
|
||||||
"tslib": "^2.6.3",
|
"tslib": "^2.6.3",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vite": "^5.3.1"
|
"vite": "^5.3.1"
|
||||||
|
|
|
||||||
6
stream/tiling-frontend/postcss.config.js
Normal file
6
stream/tiling-frontend/postcss.config.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
export default {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -18,13 +18,15 @@
|
||||||
name: string;
|
name: string;
|
||||||
}[]
|
}[]
|
||||||
| null = null;
|
| null = null;
|
||||||
|
let activePaths: string[] = [];
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
try {
|
||||||
const activeStreamResponse = await fetch(
|
const activeStreamResponse = await fetch(
|
||||||
"http://localhost:8000/api/v1/active_stream",
|
"http://localhost:8000/api/v1/active_stream",
|
||||||
);
|
);
|
||||||
activeStream = await activeStreamResponse.text();
|
activeStream = (await activeStreamResponse.text()).replaceAll('"', "");
|
||||||
const pathListResponse = await fetch(
|
const pathListResponse = await fetch(
|
||||||
"http://localhost:9997/v3/paths/list",
|
"http://localhost:9997/v3/paths/list",
|
||||||
);
|
);
|
||||||
|
|
@ -36,7 +38,6 @@
|
||||||
delete newData[i].bytesSent;
|
delete newData[i].bytesSent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(videos);
|
|
||||||
videos = Object.fromEntries(
|
videos = Object.fromEntries(
|
||||||
Object.entries(videos).filter(([_, v]) => v != null),
|
Object.entries(videos).filter(([_, v]) => v != null),
|
||||||
);
|
);
|
||||||
|
|
@ -44,9 +45,13 @@
|
||||||
if (JSON.stringify(newData) !== JSON.stringify(pathData)) {
|
if (JSON.stringify(newData) !== JSON.stringify(pathData)) {
|
||||||
console.log("Data changed");
|
console.log("Data changed");
|
||||||
pathData = newData;
|
pathData = newData;
|
||||||
|
for (let pathIdx = 0; pathIdx < pathData?.length! - 1; pathIdx++) {
|
||||||
|
if (pathData![pathIdx].ready) {
|
||||||
|
activePaths.push(pathData![pathIdx].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
for (const video in videos) {
|
for (const video in videos) {
|
||||||
console.log(video);
|
|
||||||
const hlsInstance = new hls({ progressive: false });
|
const hlsInstance = new hls({ progressive: false });
|
||||||
hlsInstance.loadSource(
|
hlsInstance.loadSource(
|
||||||
`http://localhost:8888/${video}/index.m3u8`,
|
`http://localhost:8888/${video}/index.m3u8`,
|
||||||
|
|
@ -75,45 +80,73 @@
|
||||||
>
|
>
|
||||||
<div class="gradient"></div>
|
<div class="gradient"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container2">
|
<div
|
||||||
<h2
|
class="flex w-screen h-screen justify-items-center bg-transparent absolute top-0 left-0 overflow-hidden"
|
||||||
style="position: absolute; top: 0; width: 100vw; text-align: center;font-family: Arial, Helvetica, sans-serif;"
|
|
||||||
>
|
>
|
||||||
|
<h2 class="text-4xl text-center w-screen absolute">
|
||||||
OnBoard Live Design Stream
|
OnBoard Live Design Stream
|
||||||
</h2>
|
</h2>
|
||||||
<img
|
<img
|
||||||
style="position: absolute; top: 0; left: 0; border: 0; width: 12vw; z-index: 999;"
|
class="absolute top-0 left-0 w-48"
|
||||||
src="https://assets.hackclub.com/flag-orpheus-left.svg"
|
src="https://assets.hackclub.com/flag-orpheus-left.svg"
|
||||||
alt="Hack Club"
|
alt="Hack Club"
|
||||||
/>
|
/>
|
||||||
{#if pathData?.map((path) => path.ready).includes(true)}
|
{#if pathData?.map((path) => path.ready).includes(true)}
|
||||||
<div class="container">
|
{#if activePaths.length == 1}
|
||||||
{#each pathData as path}
|
<div
|
||||||
{#if path.ready}
|
class="flex justify-center items-center w-screen h-1/2 absolute top-20"
|
||||||
|
>
|
||||||
<!-- svelte-ignore a11y-media-has-caption -->
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
<video
|
<video
|
||||||
controls
|
controls
|
||||||
autoplay
|
autoplay
|
||||||
|
id={pathData[0].name}
|
||||||
|
bind:this={videos[pathData[0].name]}
|
||||||
|
class="h-full w-auto"
|
||||||
|
></video>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if activePaths.length > 1}
|
||||||
|
<div
|
||||||
|
class="flex justify-center items-center w-screen h-1/2 absolute top-20"
|
||||||
|
>
|
||||||
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
|
<video
|
||||||
|
controls
|
||||||
|
autoplay
|
||||||
|
id={activeStream}
|
||||||
|
bind:this={videos[activeStream]}
|
||||||
|
class="h-full w-auto"
|
||||||
|
></video>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex justify-center items-center w-screen h-1/4 absolute bottom-10"
|
||||||
|
>
|
||||||
|
{#each pathData as path}
|
||||||
|
{#if path.ready && path.name !== activeStream}
|
||||||
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
|
<video
|
||||||
|
controls
|
||||||
|
autoplay
|
||||||
|
muted
|
||||||
id={path.name}
|
id={path.name}
|
||||||
bind:this={videos[path.name]}
|
bind:this={videos[path.name]}
|
||||||
class:active={path.name === activeStream}
|
class="h-[20vh] w-auto mx-10"
|
||||||
class:video={Object.keys(videos).length > 1}
|
|
||||||
class:only-video={!(Object.keys(videos).length > 1)}
|
|
||||||
></video>
|
></video>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<div class="container">
|
<div class="text-center text-4xl absolute w-screen h-screen top-1/2">
|
||||||
<p
|
<p>
|
||||||
style="text-align: center; font-size: 5vw; font-family: Arial, Helvetica, sans-serif"
|
|
||||||
>
|
|
||||||
No one is here yet!<br /> Check back later
|
No one is here yet!<br /> Check back later
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<h2
|
<h2
|
||||||
style="position: absolute; bottom: 0; width: 100vw; text-align: center;font-family: Arial, Helvetica, sans-serif;"
|
class="absolute bottom-0 text-center w-screen text-xl"
|
||||||
>
|
>
|
||||||
Join at <div
|
Join at <div
|
||||||
style="display: inline-block; color: #338eda; text-decoration-line: underline;"
|
style="display: inline-block; color: #338eda; text-decoration-line: underline;"
|
||||||
|
|
@ -124,16 +157,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.container2 {
|
|
||||||
display: flex;
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
.gradient {
|
.gradient {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
|
@ -168,7 +191,7 @@
|
||||||
transform: scale(1) rotate(0deg);
|
transform: scale(1) rotate(0deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.video {
|
/* .video {
|
||||||
width: 40vw;
|
width: 40vw;
|
||||||
height: 40vh;
|
height: 40vh;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
|
|
@ -181,8 +204,8 @@
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
.active {
|
.active {
|
||||||
width: 75vw;
|
width: 60% !important;
|
||||||
height: 75vh;
|
height: 60% !important;
|
||||||
}
|
}
|
||||||
.container {
|
.container {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -191,5 +214,5 @@
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
}
|
} */
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
3
stream/tiling-frontend/src/app.css
Normal file
3
stream/tiling-frontend/src/app.css
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import App from './App.svelte'
|
import App from './App.svelte'
|
||||||
|
import './app.css'
|
||||||
|
|
||||||
const app = new App({
|
const app = new App({
|
||||||
target: document.getElementById('app')!,
|
target: document.getElementById('app')!,
|
||||||
|
|
|
||||||
9
stream/tiling-frontend/tailwind.config.js
Normal file
9
stream/tiling-frontend/tailwind.config.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
export default {
|
||||||
|
content: ['./src/**/*.{html,js,svelte,ts}'],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue