Skip to content

Commit dbfbbe3

Browse files
committed
make the generateId less collision prone
1 parent cf9ef30 commit dbfbbe3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/quality/quality.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ Object.assign(MediaElementPlayer.prototype, {
198198
currentQuality = defaultValue;
199199

200200
// Get initial quality
201-
const generateId = Math.floor(Math.random() * 100);
201+
const generateId = Date.now() + '.' + Math.floor(Math.random() * 100);
202+
202203
const iconHtml = `<svg xmlns="http://www.w3.org/2000/svg" id="${generateId}" class="${t.options.classPrefix}" aria-hidden="true" focusable="false">
203204
<use xlink:href="${t.options.iconPathQuality}#default-icon"></use></svg>`;
204205
player.qualitiesContainer = document.createElement('div');

0 commit comments

Comments
 (0)