mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-10 10:06:15 -08:00
refactor: improve error handling
This commit is contained in:
1 parent
2130fe309d
commit
96cd35be4d
2 files changed
+12
-10
No files matched your search
@@ -48,15 +48,17 @@ export class HtmlVideoPlayerComponent implements OnChanges, OnDestroy {
|
||||
*/
|
||||
playChannel(channel: Channel): void {
|
||||
if (this.hls) this.hls.destroy();
|
||||
const url = channel.url + channel.epgParams;
|
||||
if (Hls && Hls.isSupported()) {
|
||||
console.log('... switching channel to ', channel.name, url);
|
||||
this.hls = new Hls();
|
||||
this.hls.attachMedia(this.videoPlayer.nativeElement);
|
||||
this.hls.loadSource(url);
|
||||
this.handlePlayOperation();
|
||||
} else {
|
||||
console.error('something wrong with hls.js init...');
|
||||
if (channel.url) {
|
||||
const url = channel.url + channel.epgParams;
|
||||
if (Hls && Hls.isSupported()) {
|
||||
console.log('... switching channel to ', channel.name, url);
|
||||
this.hls = new Hls();
|
||||
this.hls.attachMedia(this.videoPlayer.nativeElement);
|
||||
this.hls.loadSource(url);
|
||||
this.handlePlayOperation();
|
||||
} else {
|
||||
console.error('something wrong with hls.js init...');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ export class VideoPlayerComponent implements OnInit, OnDestroy {
|
||||
/** Active selected channel */
|
||||
activeChannel$ = this.store
|
||||
.select(selectActive)
|
||||
.pipe(filter((channel) => Boolean(channel)));
|
||||
.pipe(filter((channel) => Boolean(channel?.url)));
|
||||
|
||||
/** Channels list */
|
||||
channels$!: Observable<Channel[]>;
|
||||
|
||||
Reference in new issue
Block a user