mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 11:06:16 -08:00
fix(playback): guard Video.js Tech access
This commit is contained in:
1 parent
877d632255
commit
4952f3b8aa
2 files changed
+7
-2
No files matched your search
@@ -32,11 +32,16 @@ describe('getVideoJsTechVideo', () => {
|
||||
|
||||
describe('hasActiveVhsSourceHandler', () => {
|
||||
it('detects the documented Video.js Tech VHS runtime property', () => {
|
||||
const tech = jest.fn(() => ({ vhs: {} }));
|
||||
|
||||
expect(
|
||||
hasActiveVhsSourceHandler({
|
||||
tech: () => ({ vhs: {} }),
|
||||
tech,
|
||||
} as unknown as VideoJsPlayer)
|
||||
).toBe(true);
|
||||
expect(tech).toHaveBeenCalledWith({
|
||||
IWillNotUseThisInPlugins: true,
|
||||
});
|
||||
expect(
|
||||
hasActiveVhsSourceHandler({
|
||||
tech: () => ({ el: () => document.createElement('video') }),
|
||||
|
||||
@@ -102,7 +102,7 @@ export function hasActiveVhsSourceHandler(
|
||||
player: Pick<VideoJsPlayer, 'tech'>
|
||||
): boolean {
|
||||
try {
|
||||
const vhs = player.tech()?.vhs;
|
||||
const vhs = player.tech({ IWillNotUseThisInPlugins: true })?.vhs;
|
||||
return typeof vhs === 'object' && vhs !== null;
|
||||
} catch {
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user