UNPKG

unserver-unify

Version:

49 lines (43 loc) 1.39 kB
'use strict'; angular.module('bamboo.help') .controller('HelpItemCtrl', function($scope, ApiService, AppConfig,$sce, $stateParams) { var self = this; this.id = $stateParams.id; this.help = {}; var schoolId = ApiService.gid; var imgurl = ApiService.SHOST + '/helpfile/' + schoolId + "/"; this.mp4config = { sources: [{ // will fill in {src: ..., type: ...} }], theme: AppConfig.videogular_theme, }; $scope.oneAtATime = true; function configVideo() { //console.log(self.mp4url); //console.log(self.chapter); // get the video src and config for videogular // TODO: multi src support self.mp4config.sources[0].src = imgurl + self.help.file; self.mp4config.sources[0].type = 'video/mp4'; // TODO get the poster for this video // self.config.plugins.poster = console.log(self.mp4config); }; this.getMediaUrl = function() { return $sce.trustAsResourceUrl(imgurl + encodeURI(self.help.file)); }; function getInfo() { ApiService.get("/help/" + self.id).then(function(result) { // console.log( '-Starting auth session result: '); if (result.data.success) { self.help = result.data.data; console.log(self.help); if (self.help.media == "mp4") { configVideo(); } } }); } getInfo(); });