perf: destroy hls instance after view change

This commit is contained in:
4gray committed 2021-01-17 23:37:50 +01:00
1 parent 14a42ddccc
commit 2e3681c36e
1 file changed
+9 -1
@@ -3,6 +3,7 @@ import {
ElementRef, ElementRef,
Input, Input,
OnChanges, OnChanges,
OnDestroy,
SimpleChanges, SimpleChanges,
ViewChild, ViewChild,
} from '@angular/core'; } from '@angular/core';
@@ -14,7 +15,7 @@ import * as Hls from 'hls.js';
templateUrl: './html-video-player.component.html', templateUrl: './html-video-player.component.html',
styleUrls: ['./html-video-player.component.scss'], styleUrls: ['./html-video-player.component.scss'],
}) })
export class HtmlVideoPlayerComponent implements OnChanges { export class HtmlVideoPlayerComponent implements OnChanges, OnDestroy {
/** Channel to play */ /** Channel to play */
@Input() channel: Channel; @Input() channel: Channel;
@@ -58,4 +59,11 @@ export class HtmlVideoPlayerComponent implements OnChanges {
); );
} }
} }
/**
* Destroy hls instance on component destroy
*/
ngOnDestroy(): void {
this.hls.destroy();
}
} }