Skip to content

Instantly share code, notes, and snippets.

@keyserfaty
Last active March 13, 2016 13:25
Show Gist options
  • Select an option

  • Save keyserfaty/da14abaf0592c9ada516 to your computer and use it in GitHub Desktop.

Select an option

Save keyserfaty/da14abaf0592c9ada516 to your computer and use it in GitHub Desktop.
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