+ this.searchStream = new Subject()
+
+ this.searchStream
+ .pipe(
+ debounceTime(400),
+ distinctUntilChanged()
+ )
+ .subscribe(search => {
+ this.search = search
+ this.reloadVideos()
+ })
+ }
+
+ onSearch (event: Event) {
+ const target = event.target as HTMLInputElement
+ this.searchStream.next(target.value)
+ }
+
+ resetSearch () {
+ const searchInput = document.getElementById('history-search') as HTMLInputElement
+ searchInput.value = ''
+ this.searchStream.next('')