(function () { "use strict"; angular .module('app.modals') .controller('VideoPlayerModalController', uploadPhotoModal); function uploadPhotoModal($scope, $modalInstance, moment) { $scope.moment = moment; // Methods $scope.ok = function () { $modalInstance.close($scope.selected.item); }; $scope.cancel = function () { $modalInstance.dismiss('cancel'); }; $scope.initVideoPlayer = function () { setTimeout(function () { initVideoJsPlayer('certainMomentVideo-' + moment.id); }, 200); }; function initVideoJsPlayer(videoId) { var isVideoElementExist = $('#' + videoId).length > 0; if (isVideoElementExist) { if (!videojs.getPlayers()[videoId]) { videojs(videoId).load(); } } } // Main. window.VIDEO_PLAYER = $scope; } // IoC container. uploadPhotoModal.$inject = [ "$scope", '$modalInstance', 'moment' ]; })();