41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { Observable } from 'rxjs';
|
|
import { environment } from '../environments/environment';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class VideoProcessingService {
|
|
private apiUrl = environment.serviceEndpoint;
|
|
|
|
constructor(private http: HttpClient) { }
|
|
|
|
startProcess(data: any): Observable<{ jobId: string }> {
|
|
return this.http.post<{ jobId: string }>(`${this.apiUrl}/start-process`, data);
|
|
}
|
|
|
|
load(data: any): Observable<any> {
|
|
return this.http.post<any>(`${this.apiUrl}/processMPD`, data);
|
|
}
|
|
|
|
getJobsStatus(): Observable<Array<any>> {
|
|
return this.http.get<Array<any>>(`${this.apiUrl}/jobs-status`);
|
|
}
|
|
|
|
hello(): Observable<Array<any>> {
|
|
return this.http.get<any>(`${this.apiUrl}/hello`);
|
|
}
|
|
|
|
processUpdate(data: any): Observable<any> {
|
|
return this.http.post<any>(`${this.apiUrl}/processUpdate`, data);
|
|
}
|
|
|
|
downloadFile(filename: string): Observable<Blob> {
|
|
return this.http.get(`${this.apiUrl}/download?filename=${encodeURIComponent(filename)}`, { responseType: 'blob' });
|
|
}
|
|
|
|
flushQueue(): Observable<any> {
|
|
return this.http.delete<any>(`${this.apiUrl}/jobs/completed`, {});
|
|
}
|
|
} |