Skip to content

Commit

Permalink
feat(FEC-13664): address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
semarche committed Mar 12, 2024
1 parent ba25819 commit e0acfb6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/engines/html5/html5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class Html5 extends FakeEventTarget implements IEngine {
* @type {?IMediaSourceAdapter}
* @private
*/
private _mediaSourceAdapter!: IMediaSourceAdapter | null;
_mediaSourceAdapter!: IMediaSourceAdapter | null;

Check failure on line 47 in src/engines/html5/html5.ts

View workflow job for this annotation

GitHub Actions / lint / running-tests (ubuntu-latest)

Missing accessibility modifier on class property _mediaSourceAdapter
/**
* The player config object.
* @type {Object}
Expand Down
5 changes: 5 additions & 0 deletions src/engines/html5/media-source/base-media-source-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Error from '../../../error/error';
import { CustomEventType, Html5EventType } from '../../../event/event-type';
import getLogger from '../../../utils/logger';
import Track from '../../../track/track';
import TextStyle from '../../../track/text-style';
import VideoTrack from '../../../track/video-track';
import AudioTrack from '../../../track/audio-track';
import PKTextTrack from '../../../track/text-track';
Expand Down Expand Up @@ -177,6 +178,10 @@ export default class BaseMediaSourceAdapter extends FakeEventTarget implements I
return BaseMediaSourceAdapter._throwNotImplementedError('static canPlayType');
}

public applyTextTrackStyles(sheet: CSSStyleSheet, styles: TextStyle, containerId: string, engineClassName?: string): void {

Check failure on line 181 in src/engines/html5/media-source/base-media-source-adapter.ts

View workflow job for this annotation

GitHub Actions / lint / running-tests (ubuntu-latest)

'sheet' is defined but never used

Check failure on line 181 in src/engines/html5/media-source/base-media-source-adapter.ts

View workflow job for this annotation

GitHub Actions / lint / running-tests (ubuntu-latest)

'styles' is defined but never used

Check failure on line 181 in src/engines/html5/media-source/base-media-source-adapter.ts

View workflow job for this annotation

GitHub Actions / lint / running-tests (ubuntu-latest)

'containerId' is defined but never used

Check failure on line 181 in src/engines/html5/media-source/base-media-source-adapter.ts

View workflow job for this annotation

GitHub Actions / lint / running-tests (ubuntu-latest)

'engineClassName' is defined but never used
return BaseMediaSourceAdapter._throwNotImplementedError('applyTextTrackStyles');
}

public load(): Promise<{ tracks: Track[] }> {
return BaseMediaSourceAdapter._throwNotImplementedError('load');
}
Expand Down
2 changes: 0 additions & 2 deletions src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1708,8 +1708,6 @@ export default class Player extends FakeEventTarget {
} else if (this._config.text.useShakaTextTrackDisplay) {
resetSubtitleStyleSheet(this._playerId);
const sheet = getSubtitleStyleSheet(this._playerId);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this._engine._mediaSourceAdapter?.applyTextTrackStyles?.(sheet, this._textStyle, containerId);
}
} catch (e) {
Expand Down
2 changes: 2 additions & 0 deletions src/types/interfaces/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {PKDrmDataObject} from '../drm-data';
import {PKABRRestrictionObject} from '../restrictions-types';
import Track from '../../track/track';
import {PKTextTrack} from '../../track/text-track';
import {IMediaSourceAdapter} from '../../types';

export interface IEngineStatic {
id: string;
Expand Down Expand Up @@ -86,4 +87,5 @@ export interface IEngine extends FakeEventTarget {
crossOrigin: string | null
targetBuffer: number;
availableBuffer: number;
_mediaSourceAdapter: IMediaSourceAdapter | null;
}
21 changes: 11 additions & 10 deletions src/types/interfaces/media-source-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

import VideoTrack from '../../track/video-track';
import AudioTrack from '../../track/audio-track';
import { PKTextTrack} from '../../track/text-track';
import {PKDrmConfigObject} from '../drm-config';
import {PKMediaSourceCapabilities} from '../media-source-capabilities';
import {PKMediaSourceObject} from '../media-source';
import { PKTextTrack } from '../../track/text-track';
import { PKDrmConfigObject } from '../drm-config';
import { PKMediaSourceCapabilities } from '../media-source-capabilities';
import { PKMediaSourceObject } from '../media-source';
import ImageTrack from '../../track/image-track';
import {PKDrmDataObject} from '../drm-data';
import { PKDrmDataObject } from '../drm-data';
import { FakeEventTarget } from '../../event/fake-event-target';
import {ThumbnailInfo} from '../../thumbnail/thumbnail-info';
import { ThumbnailInfo } from '../../thumbnail/thumbnail-info';
import Track from '../../track/track';
import {PKABRRestrictionObject} from '../restrictions-types';
import TextStyle from '../../track/text-style';
import { PKABRRestrictionObject } from '../restrictions-types';

export interface IMediaSourceAdapterStatic {
id: string;
Expand All @@ -26,7 +26,7 @@ export interface IMediaSourceAdapter extends FakeEventTarget {
liveDuration: number;
capabilities: PKMediaSourceCapabilities;
targetBuffer: number;
load(startTime?: number): Promise<{tracks: Track[]}>;
load(startTime?: number): Promise<{ tracks: Track[] }>;
handleMediaError(error?: MediaError): boolean;
destroy(): Promise<any>;
selectVideoTrack(videoTrack: VideoTrack): void;
Expand All @@ -45,7 +45,8 @@ export interface IMediaSourceAdapter extends FakeEventTarget {
detachMediaSource(): void;
getSegmentDuration(): number;
disableNativeTextTracks(): void;
getThumbnail(time: number): ThumbnailInfo | null
getThumbnail(time: number): ThumbnailInfo | null;
getDrmInfo(): PKDrmDataObject | null;
applyABRRestriction(restriction: PKABRRestrictionObject): void;
applyTextTrackStyles(sheet: CSSStyleSheet, styles: TextStyle, containerId: string, engineClassName?: string): void;
}

0 comments on commit e0acfb6

Please sign in to comment.