Skip to content

Commit

Permalink
fix: minor changes and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
wseymour15 committed Jan 15, 2025
1 parent fc31141 commit 4b4f852
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {
NetworkConfiguration,
PlayerConfiguration,
PlayerEmeConfiguration,
PlayerHlsConfiguration,
PlayerMseConfiguration,
PlayerNetworkConfiguration,
Expand All @@ -24,6 +25,12 @@ export const getPlayerNetworkConfigurationDefaults = (): PlayerNetworkConfigurat
[RequestType.MediaSegment]: getNetworkConfigurationDefaults(),
});

export const getPlayerEmeConfigurationDefaults = (): PlayerEmeConfiguration => ({
reusePersistentKeySessions: false,
audioRobustness: '',
videoRobustness: '',
});

export const getPlayerMseConfigurationDefaults = (): PlayerMseConfiguration => ({
useManagedMediaSourceIfAvailable: true,
requiredBufferDuration: 30,
Expand All @@ -40,4 +47,5 @@ export const getPlayerConfigurationDefaults = (): PlayerConfiguration => ({
network: getPlayerNetworkConfigurationDefaults(),
mse: getPlayerMseConfigurationDefaults(),
hls: getPlayerHlsConfigurationDefaults(),
eme: getPlayerEmeConfigurationDefaults(),
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { StoreNode } from '../../utils/store';
import type { PlayerConfiguration } from '../../types/configuration.declarations';
import PlayerMseConfigurationImpl from './player-mse-configuration-node';
import PlayerHlsConfigurationImpl from './player-hls-configuration-node';
import PlayerEmeConfigurationImpl from './player-eme-configuration-node';

export default class PlayerConfigurationImpl extends StoreNode<PlayerConfiguration> {
public static default(): PlayerConfigurationImpl {
return new PlayerConfigurationImpl({
network: PlayerNetworkConfigurationImpl.default(),
mse: PlayerMseConfigurationImpl.default(),
hls: PlayerHlsConfigurationImpl.default(),
eme: PlayerEmeConfigurationImpl.default(),
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StoreNode } from '../../utils/store';
import type { PlayerEmeConfiguration } from '../../types/configuration.declarations';
import { getPlayerEmeConfigurationDefaults } from '../configuration-defaults';

export default class PlayerEmeConfigurationImpl extends StoreNode<PlayerEmeConfiguration> {
public static default(): PlayerEmeConfigurationImpl {
return new PlayerEmeConfigurationImpl(getPlayerEmeConfigurationDefaults());
}
}
7 changes: 0 additions & 7 deletions packages/playback/src/lib/consts/eme-robustness.ts

This file was deleted.

5 changes: 3 additions & 2 deletions packages/playback/src/lib/player/base/base-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
NetworkRequestAttemptFailedEvent,
NetworkRequestAttemptStartedEvent,
} from '../../events/network-events';
import type { IEmeManager, IEmeManagerDependencies } from '../../types/eme-manager.declarations';
import type { IEmeManager, IEmeManagerDependencies, IEmeApiAdapter } from '../../types/eme-manager.declarations';
import { EncryptedEvent, WaitingForKeyEvent } from '../../events/eme-events';
import type { PipelineLoaderFactoryStorage } from './pipeline-loader-factory-storage';

Expand Down Expand Up @@ -205,7 +205,8 @@ export abstract class BasePlayer {
}

// TODO: create adapter type
public registerEmeApiAdapter(adapter: any): void {
// eslint-disable-next-line
public registerEmeApiAdapter(adapter: IEmeApiAdapter): void {
// TODO: implement functionality to register adapter
// For example, this will be used for legacy fairplay.
}

Check warning on line 212 in packages/playback/src/lib/player/base/base-player.ts

View check run for this annotation

Codecov / codecov/patch

packages/playback/src/lib/player/base/base-player.ts#L212

Added line #L212 was not covered by tests
Expand Down
14 changes: 7 additions & 7 deletions packages/playback/src/lib/types/configuration.declarations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { CustomTagMap, TransformTagValue, TransformTagAttributes } from '@videojs/hls-parser';
import type { RequestType } from '../consts/request-type';
import type { RobustnessLevel } from '../consts/eme-robustness';

export interface NetworkConfiguration {
/**
Expand Down Expand Up @@ -62,27 +61,28 @@ export interface PlayerHlsConfiguration {
customTagMap: CustomTagMap;
transformTagValue: TransformTagValue;
transformTagAttributes: TransformTagAttributes;

}

export interface PlayerEmeConfiguration {
/**
* Allows for using stored sessions. We store the session IDs internally.
* defaults to false
* When enabled, the player will save a mapping of the keyId to persistentSessionId
* to the localStorage. It will attempt to load it if encounters the same keyId and
* and the session is still valid.
* Defaults to false.
*/
enablePersistentKeySessions: boolean;
reusePersistentKeySessions: boolean;

/**
* The video robustness level associated with the content type.
* Defults to an empty string.
*/
videoRobustness?: RobustnessLevel;
videoRobustness: string;

/**
* The audio robustness level associated with the content type.
* Defaults to an emptry string.
*/
audioRobustness?: RobustnessLevel;
audioRobustness: string;
}

export interface PlayerConfiguration {
Expand Down
5 changes: 5 additions & 0 deletions packages/playback/src/lib/types/eme-manager.declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ export interface IEmeManager {
handleWaitingForKey(): void;
setInitData(type: string, data: ArrayBuffer): void;
}

export interface IEmeApiAdapter {
// TODO: implement this adapter type
id: string;
}

0 comments on commit 4b4f852

Please sign in to comment.