+ const obs = this.videoExistsInPlaylistObservable
+ .pipe(
+ map(existsResult => existsResult[ videoId ]),
+ filter(r => !!r),
+ tap(result => this.videoExistsCache[ videoId ] = result)
+ )
+
+ this.videoExistsObservableCache[ videoId ] = obs
+ return obs
+ }
+
+ runPlaylistCheck (videoId: number) {
+ logger('Running playlist check.')
+
+ if (this.videoExistsCache[videoId]) {
+ logger('Found cache for %d.', videoId)
+
+ return this.videoExistsInPlaylistCacheSubject.next({ [videoId]: this.videoExistsCache[videoId] })
+ }
+
+ logger('Fetching from network for %d.', videoId)
+ return this.videoExistsInPlaylistNotifier.next(videoId)