@@ -31,7 +31,9 @@ Object.assign(mejs.MepDefaults, {
31
31
32
32
isVoiceover : false ,
33
33
34
- audioDescriptionCanPlay : false
34
+ audioDescriptionCanPlay : false ,
35
+
36
+ iconSpritePath : 'mejs-a11y-icons.svg'
35
37
} ) ;
36
38
37
39
Object . assign ( MediaElementPlayer . prototype , {
@@ -67,13 +69,16 @@ Object.assign(MediaElementPlayer.prototype, {
67
69
return node . className . indexOf ( className ) > - 1 ;
68
70
} ) ;
69
71
} ,
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
+ } ,
70
75
_createAudioDescription : function _createAudioDescription ( ) {
71
76
var t = this ;
72
-
77
+ var iconHtml = t . _generateIconHtml ( t . id , t . options . classPrefix , t . options . iconSpritePath , 'icon-audio' ) ;
73
78
var audioDescriptionTitle = mejs . i18n . t ( 'mejs.a11y-audio-description' ) ;
74
79
var audioDescriptionButton = document . createElement ( 'div' ) ;
75
80
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>';
77
82
78
83
t . addControlElement ( audioDescriptionButton , 'audio-description' ) ;
79
84
@@ -86,10 +91,11 @@ Object.assign(MediaElementPlayer.prototype, {
86
91
} ,
87
92
_createVideoDescription : function _createVideoDescription ( ) {
88
93
var t = this ;
94
+ var iconHtml = t . _generateIconHtml ( t . id , t . options . classPrefix , t . options . iconSpritePath , 'icon-video' ) ;
89
95
var videoDescriptionTitle = mejs . i18n . t ( 'mejs.a11y-video-description' ) ;
90
96
var videoDescriptionButton = document . createElement ( 'div' ) ;
91
97
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>';
93
99
t . addControlElement ( videoDescriptionButton , 'video-description' ) ;
94
100
95
101
videoDescriptionButton . addEventListener ( 'click' , function ( ) {
0 commit comments