Files
iptvnator/apps/web/jest.config.ts
T
4grayandClaude Fable 5 b1e9aeaf7b feat(playback): add Shaka DASH source engine with ClearKey support
Introduces ShakaVideoSession (libs/ui/playback/src/lib/shaka-engine/): a
lazily imported shaka-player engine (separate lazy chunk, ~217 KB transfer)
owning attach/configure/load with an operation queue and generation guard
against channel-switch races. Channel ClearKey config maps to
drm.clearKeys; channels with an unsupported license type emit a
DrmOrEncryption diagnostic without starting an engine. Shaka errors are
classified into the existing playback diagnostics
(PlaybackDiagnosticSource.Shaka).

Wires the engine into both built-in players like hls.js/mpegts.js:
- HTML5: extension === 'mpd' branch in playChannel(); hls/mpegts/native
  glue extracted to helpers to keep the component within the size budget
- ArtPlayer: customType 'mpd' in ArtPlayerSourceSession (+ getDrm seam)
- Shared controls: WebVideoControlsSource kind 'shaka' +
  WebVideoShakaControls using the Shaka 5 text model (selectTextTrack(null)
  hides subtitles; Player.setTextTrackVisibility no longer exists)

Adds a CJS shaka-player jest stub (video.js precedent) for web specs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 19:16:37 +02:00

53 lines
1.7 KiB
TypeScript

import { nxPreset } from '@nx/jest/preset.js';
import { createEsmPreset } from 'jest-preset-angular/presets/index.js';
const angularEsmPreset = createEsmPreset({
diagnostics: false,
tsconfig: '<rootDir>/tsconfig.spec.json',
});
const coverageReporters = ['json', 'json-summary', 'lcovonly', 'text-summary'];
const collectCoverageFrom = [
'src/**/*.{ts,js,mjs,html}',
'!src/**/*.{spec,test}.ts',
'!src/**/test-setup.ts',
'!src/**/test-stubs/**',
'!src/**/*.generated.*',
'!src/**/environments/**',
'!src/**/index.ts',
];
export default {
...nxPreset,
...angularEsmPreset,
displayName: 'web',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../coverage/apps/web',
resolver: nxPreset.resolver,
moduleFileExtensions: Array.from(
new Set([
...(nxPreset.moduleFileExtensions ?? []),
...(angularEsmPreset.moduleFileExtensions ?? []),
])
),
testMatch: nxPreset.testMatch,
testEnvironmentOptions: {},
snapshotSerializers: angularEsmPreset.snapshotSerializers,
moduleNameMapper: {
...(angularEsmPreset.moduleNameMapper ?? {}),
tslib: 'tslib/tslib.es6.js',
'^iptv-playlist-parser$':
'<rootDir>/src/test-stubs/iptv-playlist-parser.mjs',
'^shaka-player$': '<rootDir>/src/test-stubs/shaka-player.js',
'^video.js$': '<rootDir>/src/test-stubs/video-js.js',
'^rxjs': '<rootDir>/../../node_modules/rxjs/dist/bundles/rxjs.umd.js',
'^uuid$': '<rootDir>/../../node_modules/uuid/wrapper.mjs',
},
transform: angularEsmPreset.transform,
transformIgnorePatterns: [],
extensionsToTreatAsEsm: angularEsmPreset.extensionsToTreatAsEsm,
coverageReporters,
collectCoverageFrom,
};