本文介绍了HTML5 视频不适用于 AngularJS ng-src 标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
AngularJS ng-src
不适用于此小提琴中的 HTML5 Video 元素:http://jsfiddle.net/FsHah/5/
AngularJS ng-src
doesn't work with HTML5 Video element in this fiddle: http://jsfiddle.net/FsHah/5/
查看 video 元素,src 标记填充了正确的 src uri,但视频无法播放.
Looking at video element, the src tag is being populated with the correct src uri, but the video doesn't play.
这在 不支持?/forum/?fromgroups=#!topic/angular/oaSFYtWINzE">AngularJS,有什么解决方法?
Is this not supported in AngularJS, what is the workaround for this?
推荐答案
只需创建一个过滤器:
app.filter("trustUrl", ['$sce', function ($sce) {
return function (recordingUrl) {
return $sce.trustAsResourceUrl(recordingUrl);
};
}]);
在查看文件中:
<audio src="{{Your_URL | trustUrl}}" audioplayer controls></audio>
这篇关于HTML5 视频不适用于 AngularJS ng-src 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!