Skip to content

Commit

Permalink
fix(ADA-6): v7 player (accessibility) - Frames for Video Players Aren…
Browse files Browse the repository at this point in the history
…'t Labeled (#787)

Issue:
Iframe elements are labeled with uiConf/xxxxxx (the last parameter in the src url) in iframe lists (on screen readers) and not name.

Solution:
Add title element with the entry name

Solves ADA-6
  • Loading branch information
Tzipi-kaltura authored Jul 1, 2024
1 parent 827e3bb commit d4ffe97
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,7 @@ export default class Player extends FakeEventTarget {
this._eventManager.listen(this._engine, CustomEventType.DRM_LICENSE_LOADED, (event: FakeEvent) => this.dispatchEvent(event));
this._eventManager.listen(this._engine, CustomEventType.MANIFEST_LOADED, (event: FakeEvent) => this.dispatchEvent(event));
this._eventManager.listen(this._engine, CustomEventType.MEDIA_RECOVERED, () => this._handleRecovered());
this._eventManager.listen(this, CustomEventType.CHANGE_SOURCE_ENDED, () => this._addTitleOnIframe());
this._eventManager.listen(this, Html5EventType.PLAY, this._onPlay.bind(this));
this._eventManager.listen(this, Html5EventType.PAUSE, this._onPause.bind(this));
this._eventManager.listen(this, Html5EventType.PLAYING, this._onPlaying.bind(this));
Expand Down Expand Up @@ -2006,6 +2007,23 @@ export default class Player extends FakeEventTarget {
}
}

/**
* In iframe embed add title element with the entry name
* @returns {void}
* @private
*/
private _addTitleOnIframe(): void {
if (window.self !== window.top) {
const head = Utils.Dom.getElementBySelector('head');
let title = head.querySelector('title');
if (!title){
title = Utils.Dom.createElement('title');
head.appendChild(title);
}
title.innerHTML = this._sources.metadata.name ? this._sources.metadata.name : '';
}
}

/**
* if the media was recovered (after a media failure) then initiate play again (if that was the state before)
* @returns {void}
Expand Down

0 comments on commit d4ffe97

Please sign in to comment.