When the local video is played in html5 video tag.It throws warning as unsafe URL and video content is not playing.
sanitizing the URL withdomSanitizer.bypassSecurityTrustResourceUrl(url)
in angular still has the same issue
Added the stackblitz ponent.ts
Please help me out..
When the local video is played in html5 video tag.It throws warning as unsafe URL and video content is not playing.
sanitizing the URL withdomSanitizer.bypassSecurityTrustResourceUrl(url)
in angular still has the same issue
Added the stackblitz https://stackblitz./edit/angular-uodypm?file=app%2Fapp.ponent.ts
Please help me out..
Share Improve this question edited Apr 25, 2018 at 7:44 Vikas 12k7 gold badges48 silver badges71 bronze badges asked Apr 25, 2018 at 7:11 Harish98Harish98 4853 gold badges7 silver badges18 bronze badges2 Answers
Reset to default 6use binding in video source element
<video *ngIf="playerSrc" width="100%" autoplay="autoplay" controls style="margin-top: 50px; margin-bottom: 20px;">
<source [src]="playerSrc" type="video/mp4">
</video>
stackblitz https://stackblitz./edit/angular-h5zawg?file=app/app.ponent.html
I have also faced similar kind of issue for video and here's a way how I resolved it. You can set SRC in HTML like mentioned below to resolve unsafe data issue for image/video.
<video *ngIf="playerSrc" width="100%" autoplay="autoplay" controls
style="margin-top: 50px; margin-bottom: 20px;">
<source [src]="sanitizer.bypassSecurityTrustResourceUrl(src)" type="video/mp4">
</video>
Bind src like this: [src]="sanitizer.bypassSecurityTrustResourceUrl(src)"