繁体   English   中英

在angualrjs中使用html5播放视频

[英]Playing video with html5 in angualrjs

当我使用代码时:

    <video id="video" class="video-js vjs-default-skin" controls width="640" height="264">
      <source src="http://localhost:3000/files/public/photos/Let-her-go.mp4" type='video/mp4' />
      <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
    </video>

运行正常,没问题

但是,当我使用

    <video id="video" class="video-js vjs-default-skin"
    controls width="640" height="264">
        <source src="{{ video.url }}" type='video/mp4' /></source>
        <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
    </video> 

我已经定义

.filter('trusted', function($sce) {
  return function(url) {
    return $sce.trustAsResourceUrl(url);
  };
})

视频无法播放,但我检查了萤火虫,video.url具有可用的值

如何帮助我解决问题,对不起,我的英语不好

将您的源代码行更改为:

<source ng-src="{{ video.url }}" type='video/mp4' /></source>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM