Skip to content

Commit

Permalink
fix(FEC-14080): Accessibility fix for the top bar and the bottom bar
Browse files Browse the repository at this point in the history
### Description of the Changes

Add video-filter div for use by ui when rendering bar gradients
Add class to indicate when native adapter displays native captions
  • Loading branch information
SivanA-Kaltura authored Sep 16, 2024
1 parent 002d5a9 commit 79975d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/engines/html5/media-source/adapters/native-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const NUDGE_SEEK_AFTER_FOCUS: number = 0.1;
const SAFARI_BUFFERED_SEGMENTS_COUNT: number = 3;
const LIVE_DURATION_INTERVAL_MS = 1000;

const NATIVE_TEXT_CLASS = 'playkit-native-text';

/**
* An illustration of media source extension for progressive download
* @classdesc
Expand Down Expand Up @@ -220,6 +222,9 @@ export default class NativeAdapter extends BaseMediaSourceAdapter {
if (Utils.Object.hasPropertyPath(config, 'text.useNativeTextTrack')) {
adapterConfig.displayTextTrack = Utils.Object.getPropertyPath(config, 'text.useNativeTextTrack');
}
if (adapterConfig.displayTextTrack !== false) {
videoElement.classList.add(NATIVE_TEXT_CLASS);
}
if (Utils.Object.hasPropertyPath(config, 'sources.progressive')) {
adapterConfig.progressiveSources = Utils.Object.getPropertyPath(config, 'sources.progressive');
}
Expand Down Expand Up @@ -636,6 +641,7 @@ export default class NativeAdapter extends BaseMediaSourceAdapter {
this._maybeRemoveSourceTag();
super.destroy().then(
() => {
this._videoElement.classList.remove(NATIVE_TEXT_CLASS);
this._drmHandler && this._drmHandler.destroy();
this._waitingEventTriggered = false;
this._progressiveSources = [];
Expand Down
11 changes: 11 additions & 0 deletions src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ const CONTAINER_CLASS_NAME: string = 'playkit-container';
*/
const POSTER_CLASS_NAME: string = 'playkit-poster';

/**
* The video filter class name.
* @type {string}
* @const
*/
const VIDEO_FILTER_CLASS_NAME: string = 'playkit-video-filter';

/**
* The engine class name.
* @type {string}
Expand Down Expand Up @@ -1819,6 +1826,10 @@ export default class Player extends FakeEventTarget {
* @returns {void}
*/
private _appendDomElements(): void {
// Append playkit-video-filter
const videoFilter = Utils.Dom.createElement('div');
Utils.Dom.addClassName(videoFilter, VIDEO_FILTER_CLASS_NAME);
Utils.Dom.appendChild(this._el, videoFilter);
// Append playkit-black-cover
this._blackCoverEl = Utils.Dom.createElement('div');
Utils.Dom.addClassName(this._blackCoverEl, BLACK_COVER_CLASS_NAME);
Expand Down

0 comments on commit 79975d9

Please sign in to comment.