Javascript 如何在angular中播放blob视频
我正在用a=ionic构建一个移动应用程序,我希望能够播放上传视频中的blob文件,但我在控制台中得到了这个Javascript 如何在angular中播放blob视频,javascript,html,angular,ionic-framework,html5-video,Javascript,Html,Angular,Ionic Framework,Html5 Video,我正在用a=ionic构建一个移动应用程序,我希望能够播放上传视频中的blob文件,但我在控制台中得到了这个 unsafe:blob:http://localhost:8100/3d42df5b-d852-4cac-83d8-af0c6d514b04 net::ERR_UNKNOWN_URL_SCHEME 这是我的密码 <input type="file"accept="video/*" #fileInput name="proPics&
unsafe:blob:http://localhost:8100/3d42df5b-d852-4cac-83d8-af0c6d514b04 net::ERR_UNKNOWN_URL_SCHEME
这是我的密码
<input type="file"accept="video/*" #fileInput name="proPics" (change)="onSelectedFile($event)">
preview(files) {
var URL = window.URL || window.webkitURL;
this.vidURL = URL.createObjectURL(files)
}
onSelectedFile(event){
this.selectedFile = <File>event.target.files[0]
this.preview(this.selectedFile)
}
预览(文件){
var URL=window.URL | | window.webkitURL;
this.vidURL=URL.createObjectURL(文件)
}
onSelectedFile(事件){
this.selectedFile=event.target.files[0]
this.preview(this.selectedFile)
}
当我试图上传一个视频文件时,我在控制台中得到了,请我需要你的帮助,我做错了什么你可以在Html上这样做:
<input type="file" accept="video/*" (change)="onSelectedFile($event)">
<video
*ngIf="prev_url"
[src]="prev_url"
style="width:300px; height:300px;"
controls></video>
以下是工作示例:
您可以在Html上这样做:
<input type="file" accept="video/*" (change)="onSelectedFile($event)">
<video
*ngIf="prev_url"
[src]="prev_url"
style="width:300px; height:300px;"
controls></video>
以下是工作示例: