diff --git a/src/dash-adapter.ts b/src/dash-adapter.ts index 372c20c..1a0dcdd 100644 --- a/src/dash-adapter.ts +++ b/src/dash-adapter.ts @@ -88,6 +88,9 @@ export default class DashAdapter extends BaseMediaSourceAdapter { * @static */ protected static _logger = BaseMediaSourceAdapter.getLogger(DashAdapter.id); + + public static textContainerClass = "shaka-text-container"; + /** * The supported mime type by the dash adapter * @member {string} _dashMimeType @@ -230,6 +233,16 @@ export default class DashAdapter extends BaseMediaSourceAdapter { private _selectedVideoTrack: VideoTrack | undefined | null = null; private _playbackActualUri: string | undefined; + public applyTextTrackStyles(sheet: CSSStyleSheet, styles: any, containerId: string): void { + const flexAlignment = { + left: 'flex-start', + center: 'center', + right: 'flex-end', + } + sheet.insertRule(`#${containerId} .${DashAdapter.textContainerClass} { align-items: ${flexAlignment[styles.textAlign]}!important; }`, 0); + sheet.insertRule(`#${containerId} .${DashAdapter.textContainerClass} > * { ${styles.toCSS()} }`, 0); + } + /** * Factory method to create media source adapter. * @function createAdapter