angular能够获取视频和音频地址,但是不能播放,怎么解决?

使用angular渲染页面时,能够获取`
页面html

<div class="other">
    <img  ng-bind-template="{{store.sub[index].attachment}}" ng-src="{{store.sub[index].attachment|trustAsResourceUrl}}" class="image"/>
    <video  width='100%' height="auto" class="video" controls="controls" autoplay="autoplay">
        <source  ng-bind-template="{{store.sub[index].attachment}}" ng-src="{{store.sub[index].attachment|trustAsResourceUrl}}">
    </video>
    <audio class="audio" width='100%' height="auto" controls="controls" autoplay="autoplay" >
        <source  ng-bind-template="{{store.sub[index].attachment}}" ng-src="{{store.sub[index].attachment|trustAsResourceUrl}}">
    </audio>`
</div>
能够获取到的url地址
![图片描述][1]
阅读 4.7k
2 个回答

你可以看一下 $sce 这个东西,angular对来源不明的url是禁用的。用这个解决一下$sce.trustAsHtml(url);

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题