@@ -31,7 +31,9 @@ Object.assign(mejs.MepDefaults, {
3131
3232 isVoiceover : false ,
3333
34- audioDescriptionCanPlay : false
34+ audioDescriptionCanPlay : false ,
35+
36+ iconSpritePath : 'mejs-a11y-icons.svg'
3537} ) ;
3638
3739Object . assign ( MediaElementPlayer . prototype , {
@@ -67,13 +69,16 @@ Object.assign(MediaElementPlayer.prototype, {
6769 return node . className . indexOf ( className ) > - 1 ;
6870 } ) ;
6971 } ,
72+ _generateIconHtml : function _generateIconHtml ( id , classPrefix , iconSpritePath , iconId ) {
73+ return '<svg xmlns="http://www.w3.org/2000/svg" id="' + id + '" class="' + classPrefix + iconId + '" aria-hidden="true" focusable="false">\n <use xlink:href="' + iconSpritePath + '#' + iconId + '"></use></svg>' ;
74+ } ,
7075 _createAudioDescription : function _createAudioDescription ( ) {
7176 var t = this ;
72-
77+ var iconHtml = t . _generateIconHtml ( t . id , t . options . classPrefix , t . options . iconSpritePath , 'icon-audio' ) ;
7378 var audioDescriptionTitle = mejs . i18n . t ( 'mejs.a11y-audio-description' ) ;
7479 var audioDescriptionButton = document . createElement ( 'div' ) ;
7580 audioDescriptionButton . className = t . options . classPrefix + 'button ' + t . options . classPrefix + 'audio-description-button' ;
76- audioDescriptionButton . innerHTML = '<button type="button" aria-controls="' + t . id + '" title="' + audioDescriptionTitle + '" aria-label="' + audioDescriptionTitle + '" tabindex="0"></button>' ;
81+ audioDescriptionButton . innerHTML = '<button type="button" aria-controls="' + t . id + '" title="' + audioDescriptionTitle + '" aria-label="' + audioDescriptionTitle + '" tabindex="0">' + iconHtml + ' </button>';
7782
7883 t . addControlElement ( audioDescriptionButton , 'audio-description' ) ;
7984
@@ -86,10 +91,11 @@ Object.assign(MediaElementPlayer.prototype, {
8691 } ,
8792 _createVideoDescription : function _createVideoDescription ( ) {
8893 var t = this ;
94+ var iconHtml = t . _generateIconHtml ( t . id , t . options . classPrefix , t . options . iconSpritePath , 'icon-video' ) ;
8995 var videoDescriptionTitle = mejs . i18n . t ( 'mejs.a11y-video-description' ) ;
9096 var videoDescriptionButton = document . createElement ( 'div' ) ;
9197 videoDescriptionButton . className = t . options . classPrefix + 'button ' + t . options . classPrefix + 'video-description-button' ;
92- videoDescriptionButton . innerHTML = '<button type="button" aria-controls="' + t . id + '" title="' + videoDescriptionTitle + '" aria-label="' + videoDescriptionTitle + '" tabindex="0"></button>' ;
98+ videoDescriptionButton . innerHTML = '<button type="button" aria-controls="' + t . id + '" title="' + videoDescriptionTitle + '" aria-label="' + videoDescriptionTitle + '" tabindex="0">' + iconHtml + ' </button>';
9399 t . addControlElement ( videoDescriptionButton , 'video-description' ) ;
94100
95101 videoDescriptionButton . addEventListener ( 'click' , function ( ) {
0 commit comments