From f0a3988066f72a28bb44520af072f18d91d77dde Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 7 Mar 2019 17:06:00 +0100 Subject: Add to playlist dropdown --- client/src/app/shared/video/video.service.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'client/src/app/shared/video') diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 960846e21..ef489648c 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts @@ -31,6 +31,8 @@ import { ServerService } from '@app/core' import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service' import { VideoChannel } from '@app/shared/video-channel/video-channel.model' import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' +import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' export interface VideosProvider { getVideos ( @@ -170,6 +172,23 @@ export class VideoService implements VideosProvider { ) } + getPlaylistVideos ( + videoPlaylistId: number | string, + videoPagination: ComponentPagination + ): Observable<{ videos: Video[], totalVideos: number }> { + const pagination = this.restService.componentPaginationToRestPagination(videoPagination) + + let params = new HttpParams() + params = this.restService.addRestGetParams(params, pagination) + + return this.authHttp + .get>(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylistId + '/videos', { params }) + .pipe( + switchMap(res => this.extractVideos(res)), + catchError(err => this.restExtractor.handleError(err)) + ) + } + getUserSubscriptionVideos ( videoPagination: ComponentPagination, sort: VideoSortField -- cgit v1.2.3