当使用html 5视频标记以角度播放本地视频时,清理不安全的URL

Har*_*h98 1 javascript angular

当本地视频以html5视频标签播放时,由于不安全的URL和视频内容无法播放,因此会发出警告.

使用domSanitizer.bypassSecurityTrustResourceUrl(url)角度消毒URL 仍具有相同的问题

在此输入图像描述

添加了stackblitz https://stackblitz.com/edit/angular-uodypm?file=app%2Fapp.component.ts

请帮帮我..

Abi*_*yel 5

在视频源元素中使用绑定

<video *ngIf="playerSrc" width="100%" autoplay="autoplay" controls style="margin-top: 50px; margin-bottom: 20px;">
  <source [src]="playerSrc" type="video/mp4">
    </video>
Run Code Online (Sandbox Code Playgroud)

stackblitz https://stackblitz.com/edit/angular-h5zawg?file=app/app.component.html