Skip to content

Commit eedaa59

Browse files
author
Rosari Harlan
committed
feature(Buttons): Update description of the generate icon function, and the version of MediaElementJS in the demo file
1 parent 18e582b commit eedaa59

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
## *3.0.0 (2024/03/06)*
44
### QUALITY PLUGIN
55
#### New Feature: Inline SVG icons for quality button
6-
* Using `iconSpritePath`: By setting the `iconSpritePath` option, you can specify the path to your SVG icon sprite. Once set, an inline SVG icon will be dynamically generated and displayed on the quality button. Further information can be found [here](docs/quality.md).
7-
* Default Behavior: If you choose not to utilize the `iconSpritePath` option, the quality button will continue to operate as before, displaying the default quality value as its text.
6+
* Using `iconPath`: By setting the `iconPath` option, you can specify the path to your SVG icon. Once set, an inline SVG icon will be dynamically generated and displayed on the quality button. Further information can be found [here](docs/quality.md).
7+
* Default Behavior: If you choose not to utilize the `iconPath` option, the quality button will continue to operate as before, displaying the default quality value as its text.
88

99
### A11Y PLUGIN
1010
#### New Feature: Inline SVG icons for audio and video description buttons

demo/a11y.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<link rel="icon" href="favicon.ico" type="image/x-icon">
99

1010
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
11-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/5.0.1/mediaelementplayer.css">
11+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/7.0.3/mediaelementplayer.css">
1212
<link rel="stylesheet" href="../dist/a11y/a11y.css">
1313
<link rel="stylesheet" href="demo.css">
1414
</head>

docs/quality.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ Parameter | Type | Default | Description
1717
defaultQuality | string | `null` | Initial media quality; if `null`, it will take the first available source
1818
qualityText | string | `null` | Title for Quality button for WARIA purposes
1919
qualityChangeCallback | callback | | Action that will be executed as soon as the user change video quality; passes 3 arguments: media (the wrapper that mimics all the native events/properties/methods for all renderers), node (the original HTML video, audio or iframe tag where the media was loaded originally and string newQuality
20-
iconSpritePath | string | `mejs-quality-icon.svg` | Path for the SVG icon sprite file
20+
iconPath | string | `mejs-quality-icon.svg` | Path for the SVG icon file

src/a11y/a11y.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ Object.assign(MediaElementPlayer.prototype, {
9595
/**
9696
* Generates an HTML for an SVG icon.
9797
* @private
98-
* @param {String} id
99-
* @param {String} classPrefix
100-
* @param {String} iconSpritePath
101-
* @param {String} iconId
102-
* @returns {String}
98+
* @param {String} id - ID of the MediaElement player
99+
* @param {String} classPrefix - Prefix for the class attribute
100+
* @param {String} iconSpritePath - Path to the SVG sprite containing icons
101+
* @param {String} iconId - Specific ID of the icon within the SVG sprite
102+
* @returns {String} The complete HTML string for the SVG element
103103
*/
104104
_generateIconHtml(id, classPrefix, iconSpritePath, iconId) {
105105
return `<svg xmlns="http://www.w3.org/2000/svg" id="${id}" class="${classPrefix}${iconId}" aria-hidden="true" focusable="false">

src/quality/quality.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ Object.assign(mejs.MepDefaults, {
3737
*/
3838
qualityChangeCallback: null,
3939
/**
40-
* The path where the icon sprite is located
40+
* The path where the icon file is located
4141
* @type {String}
4242
*/
43-
iconSpritePath: 'mejs-quality.svg',
43+
iconPath: 'mejs-quality.svg',
4444
});
4545

4646
Object.assign(MediaElementPlayer.prototype, {
@@ -157,11 +157,11 @@ Object.assign(MediaElementPlayer.prototype, {
157157
// Get initial quality
158158
const generateId = Math.floor(Math.random() * 100);
159159
const iconHtml = `<svg xmlns="http://www.w3.org/2000/svg" id="${generateId}" class="${t.options.classPrefix}" aria-hidden="true" focusable="false">
160-
<use xlink:href="${t.options.iconSpritePath}#default-icon"></use></svg>`;
160+
<use xlink:href="${t.options.iconPath}#default-icon"></use></svg>`;
161161
player.qualitiesContainer = document.createElement('div');
162162
player.qualitiesContainer.className = `${t.options.classPrefix}button ${t.options.classPrefix}qualities-button`;
163163
player.qualitiesContainer.innerHTML = `<button type="button" title="${qualityTitle}" aria-label="${qualityTitle}" aria-controls="qualitieslist-${generateId}" aria-expanded="false">
164-
${t.options.iconSpritePath ? iconHtml : defaultValue}</button>` +
164+
${t.options.iconPath ? iconHtml : defaultValue}</button>` +
165165
`<div class="${t.options.classPrefix}qualities-selector ${t.options.classPrefix}offscreen">` +
166166
`<ul class="${t.options.classPrefix}qualities-selector-list" id="qualitieslist-${generateId}" tabindex="-1"></ul></div>`;
167167

0 commit comments

Comments
 (0)