Skip to content

Commit

Permalink
perf: destroy hls instance after view change
Browse files Browse the repository at this point in the history
  • Loading branch information
4gray committed Jan 17, 2021
1 parent 14a42dd commit 2e3681c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
ElementRef,
Input,
OnChanges,
OnDestroy,
SimpleChanges,
ViewChild,
} from '@angular/core';
Expand All @@ -14,7 +15,7 @@ import * as Hls from 'hls.js';
templateUrl: './html-video-player.component.html',
styleUrls: ['./html-video-player.component.scss'],
})
export class HtmlVideoPlayerComponent implements OnChanges {
export class HtmlVideoPlayerComponent implements OnChanges, OnDestroy {
/** Channel to play */
@Input() channel: Channel;

Expand Down Expand Up @@ -58,4 +59,11 @@ export class HtmlVideoPlayerComponent implements OnChanges {
);
}
}

/**
* Destroy hls instance on component destroy
*/
ngOnDestroy(): void {
this.hls.destroy();
}
}

0 comments on commit 2e3681c

Please sign in to comment.