mytube-frontend/src/app/feature/video/video.component.ts
2024-02-23 14:07:10 +01:00

40 lines
963 B
TypeScript

import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { VideoDetails } from 'src/app/model/VideoDetails';
import { RequestService } from 'src/app/request.service';
@Component({
selector: 'app-video',
templateUrl: './video.component.html',
styleUrls: ['./video.component.scss']
})
export class VideoComponent {
videoId: string;
videoUrl: string|null = null;
videoDetails: VideoDetails|null = null;
constructor(
private route: ActivatedRoute,
private requestService : RequestService,
) {
this.videoId = this.route.snapshot.paramMap.get('id') ?? '';
this.videoUrl = "http://wsl-flo/api/video/stream/" + this.videoId;
}
ngOnInit(): void {
this.readDetails();
}
readDetails(): void {
this.requestService.post(
'video/read-details',
{
videoId: this.videoId
},
(response:any) => {
this.videoDetails = response;
}
);
}
}