Create a basic frontend and an endpoint to get video stream.

This commit is contained in:
Florian THIERRY
2026-07-24 15:38:27 +02:00
parent c3806f49ba
commit f8f86eeae1
35 changed files with 9665 additions and 16 deletions
+43
View File
@@ -0,0 +1,43 @@
import {Component, computed, inject, OnInit, resource, signal} from '@angular/core';
import { RouterOutlet } from '@angular/router';
import {HttpClient} from '@angular/common/http';
import {firstValueFrom} from 'rxjs';
enum LibraryItemType {
VIDEO = 'VIDEO',
FOLDER = 'FOLDER'
}
interface LibraryItem {
id: string;
name: string;
type: LibraryItemType
parentFolder: LibraryItem | null;
}
@Component({
selector: 'app-root',
imports: [RouterOutlet],
templateUrl: './app.html',
styleUrl: './app.css'
})
export class App implements OnInit {
#httpClient = inject(HttpClient);
libraryItems = resource({
loader: ({}) => firstValueFrom(this.#httpClient.get<LibraryItem[]>('/api/library'))
});
firstVideo = computed(() => {
const libraryItems = this.libraryItems.value() ?? [];
return libraryItems.length ? libraryItems[0] : null
});
ngOnInit(): void {
this.loadLibrary();
}
loadLibrary(): void {
this.libraryItems.reload();
}
}