diff options
Diffstat (limited to 'client/src/app/shared/video-playlist')
-rw-r--r-- | client/src/app/shared/video-playlist/video-playlist.service.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts index fc5eb5337..bae6f9e04 100644 --- a/client/src/app/shared/video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/video-playlist/video-playlist.service.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { bufferTime, catchError, filter, map, share, switchMap, tap } from 'rxjs/operators' | 1 | import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators' |
2 | import { Injectable } from '@angular/core' | 2 | import { Injectable, NgZone } from '@angular/core' |
3 | import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs' | 3 | import { asyncScheduler, merge, Observable, of, ReplaySubject, Subject } from 'rxjs' |
4 | import { RestExtractor } from '../rest/rest-extractor.service' | 4 | import { RestExtractor } from '../rest/rest-extractor.service' |
5 | import { HttpClient, HttpParams } from '@angular/common/http' | 5 | import { HttpClient, HttpParams } from '@angular/common/http' |
6 | import { ResultList, VideoPlaylistElementCreate, VideoPlaylistElementUpdate } from '../../../../../shared' | 6 | import { ResultList, VideoPlaylistElementCreate, VideoPlaylistElementUpdate } from '../../../../../shared' |
@@ -23,6 +23,7 @@ import { VideoPlaylistElement as ServerVideoPlaylistElement } from '@shared/mode | |||
23 | import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' | 23 | import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' |
24 | import { uniq } from 'lodash-es' | 24 | import { uniq } from 'lodash-es' |
25 | import * as debug from 'debug' | 25 | import * as debug from 'debug' |
26 | import { enterZone, leaveZone } from '@app/shared/rxjs/zone' | ||
26 | 27 | ||
27 | const logger = debug('peertube:playlists:VideoPlaylistService') | 28 | const logger = debug('peertube:playlists:VideoPlaylistService') |
28 | 29 | ||
@@ -49,13 +50,16 @@ export class VideoPlaylistService { | |||
49 | private authHttp: HttpClient, | 50 | private authHttp: HttpClient, |
50 | private serverService: ServerService, | 51 | private serverService: ServerService, |
51 | private restExtractor: RestExtractor, | 52 | private restExtractor: RestExtractor, |
52 | private restService: RestService | 53 | private restService: RestService, |
54 | private ngZone: NgZone | ||
53 | ) { | 55 | ) { |
54 | this.videoExistsInPlaylistObservable = merge( | 56 | this.videoExistsInPlaylistObservable = merge( |
55 | this.videoExistsInPlaylistNotifier.pipe( | 57 | this.videoExistsInPlaylistNotifier.pipe( |
56 | bufferTime(500), | 58 | // We leave Angular zone so Protractor does not get stuck |
59 | bufferTime(500, leaveZone(this.ngZone, asyncScheduler)), | ||
57 | filter(videoIds => videoIds.length !== 0), | 60 | filter(videoIds => videoIds.length !== 0), |
58 | map(videoIds => uniq(videoIds)), | 61 | map(videoIds => uniq(videoIds)), |
62 | observeOn(enterZone(this.ngZone, asyncScheduler)), | ||
59 | switchMap(videoIds => this.doVideosExistInPlaylist(videoIds)), | 63 | switchMap(videoIds => this.doVideosExistInPlaylist(videoIds)), |
60 | share() | 64 | share() |
61 | ), | 65 | ), |