简体   繁体   中英

Playing video with html5 in angualrjs

When i used code:

    <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>

It operates normally, no problem

But, when i used

    <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> 

I have defined

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

Video don't play, but i check firebug, video.url has a value availble

How can help me fix it, sorry, my English is bad

将您的源代码行更改为:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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