-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FEC-13664): apply text track styles in adapters
- Loading branch information
Showing
4 changed files
with
44 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './util'; | ||
export {ResizeWatcher} from './resize-watcher'; | ||
export {MultiMap} from './multi-map'; | ||
export {binarySearch} from './binary-search'; | ||
export { ResizeWatcher } from './resize-watcher'; | ||
export { MultiMap } from './multi-map'; | ||
export { binarySearch } from './binary-search'; | ||
export * from './styles'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as Utils from './util'; | ||
|
||
/** | ||
* The text style class name. | ||
* @type {string} | ||
* @const | ||
*/ | ||
const SUBTITLES_STYLE_CLASS_NAME: string = 'playkit-subtitles-style'; | ||
|
||
export const getSubtitleStyleSheet = (playerId: string): CSSStyleSheet => { | ||
let element = Utils.Dom.getElementBySelector(`.${playerId}.${SUBTITLES_STYLE_CLASS_NAME}`); | ||
if (!element) { | ||
element = Utils.Dom.createElement('style'); | ||
Utils.Dom.addClassName(element, playerId); | ||
Utils.Dom.addClassName(element, SUBTITLES_STYLE_CLASS_NAME); | ||
Utils.Dom.appendChild(document.head, element); | ||
} | ||
return element.sheet; | ||
}; | ||
|
||
export const resetSubtitleStyleSheet = (playerId: string): void => { | ||
const element = Utils.Dom.getElementBySelector(`.${playerId}.${SUBTITLES_STYLE_CLASS_NAME}`); | ||
element?.remove(); | ||
}; |