I am able to play the video after it downloads completely using the below code. I am not sure how to buffer a video while the download is in progress.
Service:
getTestVideo() {
return this.http.post(this.getATestVideoURL, null, {
observe: 'response', reportProgress: true, responseType: 'blob'
}).pipe(
catchError(this.errorHandler.handleError)
);
}
Component:
ngAfterViewInit(): void {
this.userService.getTestVideo().pipe(takeUntil(this.ngUnsubscribe)).subscribe(
result => {
this.videoElement.nativeElement.src = URL.createObjectURL(result.body);
this.videoElement.nativeElement.load();
}
);
}