Search code examples
angularjsautoplayvideogular

Videogular autoPlay error


Hey guys I'm trying to setup my videogular for the first time. It's throwing an error when I try set the autoplay setting to true:

ReferenceError: VG_UTILS is not defined
    at videogular.js:506
    at angular.js:16210
    at completeOutstandingRequest (angular.js:4902)
    at angular.js:5282

My controller:

angular.module('app')
.controller('SectionVideoCtrl',  ['$rootScope', '$scope', '$element', '$sce', function ($rootScope, $scope, $element, $sce) {

var _API = null;

$scope.stretchModes = [
    {label: "None", value: "none"},
    {label: "Fit", value: "fit"},
    {label: "Fill", value: "fill"}
];

this.config = {
    sources: [
    {src: $sce.trustAsResourceUrl("video/" + "footy" + ".mp4"), type: "video/mp4"},
    {src: $sce.trustAsResourceUrl("video/" + "footy" + ".webm"), type: "video/webm"},
    {src: $sce.trustAsResourceUrl("video/" + "footy" + ".ogg"), type: "video/ogg"}
    ],
    width: 640,
    height: 360,      
    responsive: true,
    autoPlay: true,
    stretch: $scope.stretchModes[2],
    theme: "css/plugins/videogular.min.css" 
};
}]);

Everything loaded into the module:

angular
.module('app', [    
'ngRoute',
"ngSanitize",
"com.2fdevs.videogular",
        "com.2fdevs.videogular.plugins.controls",
        "com.2fdevs.videogular.plugins.overlayplay",
        "com.2fdevs.videogular.plugins.buffering",
        "com.2fdevs.videogular.plugins.poster"
 ])

And HTML:

<videogular vg-player-ready="controller.onPlayerReady($API)" vg-width="controller.config.width" vg-theme="controller.config.theme.url" vg-auto-play="controller.config.autoPlay">
    <vg-media vg-src="controller.config.sources" vg-native-controls="false">
        <video preload='metadata'></video>
    </vg-media>
</videogular>   

Is there something I have overlooked? Really don't know what I've done wrong.


Solution

  • I'm the creator of Videogular.

    This is a known bug in Videogular 1.0.0 and we want to fix it for the next release in a couple of weeks.

    Here's the link to the issue in case you want to follow it:

    https://github.com/2fdevs/videogular/issues/161