UNPKG

unserver-unify

Version:

48 lines (38 loc) 1.18 kB
'use strict'; angular.module('bamboo.help') .controller('HelpVideoCtrl', function(ApiService, AppConfig, $sce, $stateParams) { /* received all API from videogular when html was loaded*/ this.API = null; var publicUrl = ApiService.SHOST + "/public/img/"; this.onPlayerReady = function (API) { this.API = API; }; var file = $stateParams.file; function getMediaUrl(){ return $sce.trustAsResourceUrl(publicUrl + encodeURI(file + ".mp4")); }; this.helpvideo=getMediaUrl(); //control function to generate above API structure this.helpVideoConfig = { sources: [ { // will fill in {src: ..., type: ...} } ], theme: AppConfig.videogular_theme, }; this.toggledrop=function(){ if($scope.dropdown){ $scope.dropdown=false; }else{ $scope.dropdown=true; } } var file = $stateParams.file; if (file) { var publicUrl = ApiService.SHOST + "/public/img/"; var url = publicUrl + file + ".mp4"; this.helpVideoConfig.sources[0].src = url; this.helpVideoConfig.sources[0].type = 'video/mp4'; } });