Skip to content

Commit

Permalink
test: update mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
4gray committed Dec 8, 2023
1 parent ba718b0 commit 68dd17e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ describe('HtmlVideoPlayerComponent', () => {
group: {
title: 'News group',
},
http: {
'user-agent': 'localhost',
},
};

beforeEach(waitForAsync(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
} from '@angular/core';
import Hls from 'hls.js';
import { Channel } from '../../../../../shared/channel.interface';
import { CHANNEL_SET_USER_AGENT } from '../../../../../shared/ipc-commands';
import { getExtensionFromUrl } from '../../../../../shared/playlist.utils';
import { DataService } from '../../../services/data.service';
import { CHANNEL_SET_USER_AGENT } from '../../../../../shared/ipc-commands';

/**
* This component contains the implementation of HTML5 based video player
Expand All @@ -26,7 +26,7 @@ export class HtmlVideoPlayerComponent implements OnChanges, OnDestroy {
/** Channel to play */
@Input() channel: Channel;
dataService: DataService; // Declare the dataService property

constructor(dataService: DataService) {
this.dataService = dataService; // Inject the DataService
}
Expand Down Expand Up @@ -60,6 +60,11 @@ export class HtmlVideoPlayerComponent implements OnChanges, OnDestroy {
if (channel.url) {
const url = channel.url + (channel.epgParams ?? '');
const extension = getExtensionFromUrl(channel.url);
this.dataService.sendIpcEvent(CHANNEL_SET_USER_AGENT, {
userAgent: channel.http['user-agent'],
referer: channel.http.referrer,
});

if (
extension !== 'mp4' &&
extension !== 'mpv' &&
Expand All @@ -70,10 +75,7 @@ export class HtmlVideoPlayerComponent implements OnChanges, OnDestroy {
this.hls = new Hls();
this.hls.attachMedia(this.videoPlayer.nativeElement);
this.hls.loadSource(url);
this.dataService.sendIpcEvent(CHANNEL_SET_USER_AGENT, {
userAgent: channel.http['user-agent'],
referer: channel.http.referrer,
});

this.handlePlayOperation();
} else {
console.error('something wrong with hls.js init...');
Expand All @@ -82,10 +84,6 @@ export class HtmlVideoPlayerComponent implements OnChanges, OnDestroy {
url,
'video/mp4'
);
this.dataService.sendIpcEvent(CHANNEL_SET_USER_AGENT, {
userAgent: channel.http['user-agent'],
referer: channel.http.referrer,
});
this.videoPlayer.nativeElement.play();
}
}
Expand Down

1 comment on commit 68dd17e

@vercel
Copy link

@vercel vercel bot commented on 68dd17e Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

iptvnator – ./

iptvnator.vercel.app
iptvnator-git-electron-4gray.vercel.app
iptvnator-4gray.vercel.app

Please sign in to comment.