X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-video-playlist%2Fvideo-playlist.service.ts;h=1b87e0b2add12e743f2493265988e5334322b7ae;hb=28eeb811c40325a28208231324f66f4032e5cf67;hp=5c7eed647d3d59f7c2ecb87f873e54698313a018;hpb=60ea8f7a31121ed900620bd970d8b0284a4e1f32;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts index 5c7eed647..1b87e0b2a 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts @@ -1,7 +1,7 @@ import * as debug from 'debug' import { uniq } from 'lodash-es' import { asyncScheduler, merge, Observable, of, ReplaySubject, Subject } from 'rxjs' -import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators' +import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap, distinctUntilChanged } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable, NgZone } from '@angular/core' import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core' @@ -53,6 +53,7 @@ export class VideoPlaylistService { ) { this.videoExistsInPlaylistObservable = merge( this.videoExistsInPlaylistNotifier.pipe( + distinctUntilChanged(), // We leave Angular zone so Protractor does not get stuck bufferTime(500, leaveZone(this.ngZone, asyncScheduler)), filter(videoIds => videoIds.length !== 0), @@ -215,10 +216,13 @@ export class VideoPlaylistService { map(this.restExtractor.extractDataBool), tap(() => { const existsResult = this.videoExistsCache[videoId] - const elem = existsResult.find(e => e.playlistElementId === playlistElementId) - elem.startTimestamp = body.startTimestamp - elem.stopTimestamp = body.stopTimestamp + if (existsResult) { + const elem = existsResult.find(e => e.playlistElementId === playlistElementId) + + elem.startTimestamp = body.startTimestamp + elem.stopTimestamp = body.stopTimestamp + } this.runPlaylistCheck(videoId) }),