I have had this issue for a while but did not know how o fix it.
I have found this similar question: how to play blob video in angular. But the problem is that even demo in the answear does noot compatible with "avi", and "mov". I am using latest version of Chrome and it does not show me a selected video.
on html template file:
<input type="file" accept="video/*" (change)="onSelectedFile($event)">
<video
*ngIf="prev_url"
[src]="prev_url"
style="width:300px; height:300px;"
controls></video>
on ts file:
export class AppComponent {
prev_url : any;
constructor(
private sanitizer : DomSanitizer
) {}
onSelectedFile(ev) {
let file = ev.target.files[0];
var URL = window.URL;
this.prev_url = this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(file));
console.log(this.prev_url)
}
}
here the working sample
P.S. I also have tried a "vg-player", but neeeeeh it did not work.