Last active
March 13, 2016 13:25
-
-
Save keyserfaty/da14abaf0592c9ada516 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class StreamingService { | |
| constructor($q, iamatService, iamatConfig) { | |
| this.$q = $q; | |
| this.iamatService = iamatService; | |
| this.iamatConfig = iamatConfig; | |
| this.getMenu = function () { | |
| return $q(function (resolve, reject) { | |
| iamatService.client.getAtcode().load(iamatConfig.atcodeName) | |
| .then(function (data) { | |
| resolve(data.menu); | |
| }, function (err) { | |
| reject(err); | |
| }); | |
| }); | |
| }; | |
| } | |
| getTags() { | |
| let { $q, getMenu, iamatService } = this; | |
| iamatService.onConnected(function() { | |
| getMenu().then(function (menu) { | |
| return menu.map(function (elem) { | |
| if (elem.id === 'videoRecorder') { | |
| return elem.parameters.tags; | |
| } | |
| }); | |
| }); | |
| }); | |
| } | |
| getStreaming() { | |
| let { $q, getMenu, iamatService } = this; | |
| iamatService.onConnected(function () { | |
| getMenu() | |
| .then(function (menu) { | |
| return menu.map(function (elem) { | |
| if (elem.id === 'live') { | |
| return elem.livestream[0]; | |
| } | |
| }); | |
| }); | |
| }); | |
| } | |
| } | |
| StreamingService.$inject = ['$q', 'iamatService', 'iamatConfig']; | |
| export default angular.module('services.streaming-service', []) | |
| .service('streamingService', StreamingService) | |
| .name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment