ng-src无法在angularjs中使用视频标签

时间:2018-10-22 23:56:15

标签: angularjs angularjs-directive angular-ui-router angularjs-scope angularjs-ng-repeat

<span ng-repeat="x in pics.files">
    <video ng-src="img/gallery_vid/{{x}}" height="200px" width="200px" class="mt-2" controls>
    </video>
</span>

ng-src无法使用视频标签,如果有人可以为我提供帮助,我会很高兴。 视频没有播放,我在网上搜索了解决方法 I saw this but I didn't get it。 预先感谢

1 个答案:

答案 0 :(得分:0)

控制器:

(function() {
    'use strict';
        var app = angular.module('videoExample', []);
        app.controller('videoExampleController', ['$scope', videoExampleController]);

    function videoExampleController($scope){
       $scope.videoUrl = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';
       $scope.videoMimeType = 'video/mp4';
    }
 })();
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<div ng-app="videoExample" ng-controller="videoExampleController">
<span>
    <video height="300px" width="300px" class="mt-2" controls autoplay>
<source src="{{videoUrl}}" type="{{videoMimeType}}"/>Your browser does not support HTML5 video
    </video>
</span>
</div>