本文介绍了HTML5视频无法正常工作与AngularJS NG-SRC标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AngularJS NG-SRC HTML5的视频元素在这拨弄不起作用:的

AngularJS ng-src doesn't work with HTML5 Video element in this fiddle: http://jsfiddle.net/FsHah/5/

看视频元素,将src标签被填入正确的SRC URI,但不能播放视频。

Looking at video element, the src tag is being populated with the correct src uri, but the video doesn't play.

难道这不支持中的,有什么解决方法吗?

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标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 19:06