+function populateAsyncUserVideoChannels (authService: AuthService, channel: any[]) {
+ return new Promise(res => {
+ authService.userInformationLoaded
+ .subscribe(
+ () => {
+ const user = authService.getUser()
+ if (!user) return
+
+ const videoChannels = user.videoChannels
+ if (Array.isArray(videoChannels) === false) return
+
+ videoChannels.forEach(c => channel.push({ id: c.id, label: c.displayName }))
+
+ return res()
+ }
+ )
+ })
+}
+
+function getAbsoluteAPIUrl () {
+ let absoluteAPIUrl = environment.apiUrl
+ if (!absoluteAPIUrl) {
+ // The API is on the same domain
+ absoluteAPIUrl = window.location.origin
+ }
+
+ return absoluteAPIUrl
+}
+