Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mediaelement-plugins

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mediaelement-plugins - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

demo/speed.html

4

changelog.md
# Version History
## *4.0.1 (2024/09/09)*
### SPEED PLUGIN
* Fix always controlling the first player on the page via keyboard when multiple players exist.
## *4.0.0 (2024/03/11)*

@@ -4,0 +8,0 @@ This release marks a major version update to address and correct previous versioning inaccuracies. The transition from version 3.0.0 to 3.0.1 introduced changes that, upon further review, have been identified as breaking. These changes warranted a more significant version increment to reflect their impact accurately.

16

dist/speed/speed.js

@@ -103,2 +103,4 @@ /*!

player.speedRadioButtons = radios;
for (var _i2 = 0, _total2 = inEvents.length; _i2 < _total2; _i2++) {

@@ -158,5 +160,6 @@ player.speedButton.addEventListener(inEvents[_i2], function () {

for (var _i7 = 0; _i7 < radios.length - 1; _i7++) {
if (radios[_i7].checked) {
var nextRadio = radios[_i7 + 1];
var _radios = player.speedRadioButtons;
for (var _i7 = 0; _i7 < _radios.length - 1; _i7++) {
if (_radios[_i7].checked) {
var nextRadio = _radios[_i7 + 1];
nextRadio.dispatchEvent(mejs.Utils.createEvent('click', nextRadio));

@@ -172,5 +175,6 @@ break;

for (var _i8 = 1; _i8 < radios.length; _i8++) {
if (radios[_i8].checked) {
var prevRadio = radios[_i8 - 1];
var _radios = player.speedRadioButtons;
for (var _i8 = 1; _i8 < _radios.length; _i8++) {
if (_radios[_i8].checked) {
var prevRadio = _radios[_i8 - 1];
prevRadio.dispatchEvent(mejs.Utils.createEvent('click', prevRadio));

@@ -177,0 +181,0 @@ break;

@@ -12,2 +12,2 @@ /*!

*/
!function r(i,l,a){function d(t,e){if(!l[t]){if(!i[t]){var s="function"==typeof require&&require;if(!e&&s)return s(t,!0);if(p)return p(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var n=l[t]={exports:{}};i[t][0].call(n.exports,function(e){return d(i[t][1][e]||e)},n,n.exports,r,i,l,a)}return l[t].exports}for(var p="function"==typeof require&&require,e=0;e<a.length;e++)d(a[e]);return d}({1:[function(e,t,s){"use strict";mejs.i18n.en["mejs.speed-rate"]="Speed Rate",Object.assign(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x",speedText:null}),Object.assign(MediaElementPlayer.prototype,{buildspeed:function(l,e,t,a){var d=this;if(null!==d.media.rendererName&&/(native|html5)/i.test(d.media.rendererName)){for(var o=[],s=mejs.Utils.isString(d.options.speedText)?d.options.speedText:mejs.i18n.t("mejs.speed-rate"),p=function(e){for(var t=0,s=o.length;t<s;t++)if(o[t].value===e)return o[t].name},c=void 0,n=!1,r=0,i=d.options.speeds.length;r<i;r++){var u=d.options.speeds[r];"string"==typeof u?(o.push({name:""+u+d.options.speedChar,value:u}),u===d.options.defaultSpeed&&(n=!0)):(o.push(u),u.value===d.options.defaultSpeed&&(n=!0))}n||o.push({name:d.options.defaultSpeed+d.options.speedChar,value:d.options.defaultSpeed}),o.sort(function(e,t){return parseFloat(t.value)-parseFloat(e.value)}),d.cleanspeed(l),l.speedButton=document.createElement("div"),l.speedButton.className=d.options.classPrefix+"button "+d.options.classPrefix+"speed-button",l.speedButton.innerHTML='<button type="button" aria-controls="'+d.id+'" title="'+s+'" aria-label="'+s+'" tabindex="0">'+p(d.options.defaultSpeed)+'</button><div class="'+d.options.classPrefix+"speed-selector "+d.options.classPrefix+'offscreen"><ul class="'+d.options.classPrefix+'speed-selector-list"></ul></div>',d.addControlElement(l.speedButton,"speed");for(var f=0,v=o.length;f<v;f++){var h=d.id+"-speed-"+o[f].value;l.speedButton.querySelector("ul").innerHTML+='<li class="'+d.options.classPrefix+'speed-selector-list-item"><input class="'+d.options.classPrefix+'speed-selector-input" type="radio" name="'+d.id+'_speed"disabled="disabled" value="'+o[f].value+'" id="'+h+'" '+(o[f].value===d.options.defaultSpeed?' checked="checked"':"")+'/><label for="'+h+'" class="'+d.options.classPrefix+"speed-selector-label"+(o[f].value===d.options.defaultSpeed?" "+d.options.classPrefix+"speed-selected":"")+'">'+o[f].name+"</label></li>"}c=d.options.defaultSpeed,l.speedSelector=l.speedButton.querySelector("."+d.options.classPrefix+"speed-selector");for(var m=["mouseenter","focusin"],S=["mouseleave","focusout"],x=l.speedButton.querySelectorAll('input[type="radio"]'),b=l.speedButton.querySelectorAll("."+d.options.classPrefix+"speed-selector-label"),y=0,g=m.length;y<g;y++)l.speedButton.addEventListener(m[y],function(){mejs.Utils.removeClass(l.speedSelector,d.options.classPrefix+"offscreen"),l.speedSelector.style.height=l.speedSelector.querySelector("ul").offsetHeight,l.speedSelector.style.top=-1*parseFloat(l.speedSelector.offsetHeight)+"px"});for(var k=0,P=S.length;k<P;k++)l.speedSelector.addEventListener(S[k],function(){mejs.Utils.addClass(this,d.options.classPrefix+"offscreen")});for(var j=0,E=x.length;j<E;j++){var B=x[j];B.disabled=!1,B.addEventListener("click",function(){var e=this.value;c=e,a.playbackRate=parseFloat(e),l.speedButton.querySelector("button").innerHTML=p(e);for(var t=l.speedButton.querySelectorAll("."+d.options.classPrefix+"speed-selected"),s=0,o=t.length;s<o;s++)mejs.Utils.removeClass(t[s],d.options.classPrefix+"speed-selected");this.checked=!0;for(var n=mejs.Utils.siblings(this,function(e){return mejs.Utils.hasClass(e,d.options.classPrefix+"speed-selector-label")}),r=0,i=n.length;r<i;r++)mejs.Utils.addClass(n[r],d.options.classPrefix+"speed-selected")})}for(var U=0,C=b.length;U<C;U++)b[U].addEventListener("click",function(){var e=mejs.Utils.siblings(this,function(e){return"INPUT"===e.tagName})[0],t=mejs.Utils.createEvent("click",e);e.dispatchEvent(t)});d.options.keyActions.push({keys:[60,188],action:function(e,t,s,o){if("<"==o.key)for(var n=0;n<x.length-1;n++)if(x[n].checked){var r=x[n+1];r.dispatchEvent(mejs.Utils.createEvent("click",r));break}}},{keys:[62,190],action:function(e,t,s,o){if(">"==o.key)for(var n=1;n<x.length;n++)if(x[n].checked){var r=x[n-1];r.dispatchEvent(mejs.Utils.createEvent("click",r));break}}}),l.speedSelector.addEventListener("keydown",function(e){e.stopPropagation()}),a.addEventListener("loadedmetadata",function(){c&&(a.playbackRate=parseFloat(c))})}},cleanspeed:function(e){e&&(e.speedButton&&e.speedButton.parentNode.removeChild(e.speedButton),e.speedSelector&&e.speedSelector.parentNode.removeChild(e.speedSelector))}})},{}]},{},[1]);
!function r(i,l,a){function d(t,e){if(!l[t]){if(!i[t]){var s="function"==typeof require&&require;if(!e&&s)return s(t,!0);if(p)return p(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var n=l[t]={exports:{}};i[t][0].call(n.exports,function(e){return d(i[t][1][e]||e)},n,n.exports,r,i,l,a)}return l[t].exports}for(var p="function"==typeof require&&require,e=0;e<a.length;e++)d(a[e]);return d}({1:[function(e,t,s){"use strict";mejs.i18n.en["mejs.speed-rate"]="Speed Rate",Object.assign(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x",speedText:null}),Object.assign(MediaElementPlayer.prototype,{buildspeed:function(l,e,t,a){var d=this;if(null!==d.media.rendererName&&/(native|html5)/i.test(d.media.rendererName)){for(var o=[],s=mejs.Utils.isString(d.options.speedText)?d.options.speedText:mejs.i18n.t("mejs.speed-rate"),p=function(e){for(var t=0,s=o.length;t<s;t++)if(o[t].value===e)return o[t].name},c=void 0,n=!1,r=0,i=d.options.speeds.length;r<i;r++){var u=d.options.speeds[r];"string"==typeof u?(o.push({name:""+u+d.options.speedChar,value:u}),u===d.options.defaultSpeed&&(n=!0)):(o.push(u),u.value===d.options.defaultSpeed&&(n=!0))}n||o.push({name:d.options.defaultSpeed+d.options.speedChar,value:d.options.defaultSpeed}),o.sort(function(e,t){return parseFloat(t.value)-parseFloat(e.value)}),d.cleanspeed(l),l.speedButton=document.createElement("div"),l.speedButton.className=d.options.classPrefix+"button "+d.options.classPrefix+"speed-button",l.speedButton.innerHTML='<button type="button" aria-controls="'+d.id+'" title="'+s+'" aria-label="'+s+'" tabindex="0">'+p(d.options.defaultSpeed)+'</button><div class="'+d.options.classPrefix+"speed-selector "+d.options.classPrefix+'offscreen"><ul class="'+d.options.classPrefix+'speed-selector-list"></ul></div>',d.addControlElement(l.speedButton,"speed");for(var f=0,v=o.length;f<v;f++){var h=d.id+"-speed-"+o[f].value;l.speedButton.querySelector("ul").innerHTML+='<li class="'+d.options.classPrefix+'speed-selector-list-item"><input class="'+d.options.classPrefix+'speed-selector-input" type="radio" name="'+d.id+'_speed"disabled="disabled" value="'+o[f].value+'" id="'+h+'" '+(o[f].value===d.options.defaultSpeed?' checked="checked"':"")+'/><label for="'+h+'" class="'+d.options.classPrefix+"speed-selector-label"+(o[f].value===d.options.defaultSpeed?" "+d.options.classPrefix+"speed-selected":"")+'">'+o[f].name+"</label></li>"}c=d.options.defaultSpeed,l.speedSelector=l.speedButton.querySelector("."+d.options.classPrefix+"speed-selector");var m=["mouseenter","focusin"],S=["mouseleave","focusout"],x=l.speedButton.querySelectorAll('input[type="radio"]'),b=l.speedButton.querySelectorAll("."+d.options.classPrefix+"speed-selector-label");l.speedRadioButtons=x;for(var y=0,g=m.length;y<g;y++)l.speedButton.addEventListener(m[y],function(){mejs.Utils.removeClass(l.speedSelector,d.options.classPrefix+"offscreen"),l.speedSelector.style.height=l.speedSelector.querySelector("ul").offsetHeight,l.speedSelector.style.top=-1*parseFloat(l.speedSelector.offsetHeight)+"px"});for(var k=0,P=S.length;k<P;k++)l.speedSelector.addEventListener(S[k],function(){mejs.Utils.addClass(this,d.options.classPrefix+"offscreen")});for(var j=0,B=x.length;j<B;j++){var E=x[j];E.disabled=!1,E.addEventListener("click",function(){var e=this.value;c=e,a.playbackRate=parseFloat(e),l.speedButton.querySelector("button").innerHTML=p(e);for(var t=l.speedButton.querySelectorAll("."+d.options.classPrefix+"speed-selected"),s=0,o=t.length;s<o;s++)mejs.Utils.removeClass(t[s],d.options.classPrefix+"speed-selected");this.checked=!0;for(var n=mejs.Utils.siblings(this,function(e){return mejs.Utils.hasClass(e,d.options.classPrefix+"speed-selector-label")}),r=0,i=n.length;r<i;r++)mejs.Utils.addClass(n[r],d.options.classPrefix+"speed-selected")})}for(var U=0,C=b.length;U<C;U++)b[U].addEventListener("click",function(){var e=mejs.Utils.siblings(this,function(e){return"INPUT"===e.tagName})[0],t=mejs.Utils.createEvent("click",e);e.dispatchEvent(t)});d.options.keyActions.push({keys:[60,188],action:function(e,t,s,o){if("<"==o.key)for(var n=e.speedRadioButtons,r=0;r<n.length-1;r++)if(n[r].checked){var i=n[r+1];i.dispatchEvent(mejs.Utils.createEvent("click",i));break}}},{keys:[62,190],action:function(e,t,s,o){if(">"==o.key)for(var n=e.speedRadioButtons,r=1;r<n.length;r++)if(n[r].checked){var i=n[r-1];i.dispatchEvent(mejs.Utils.createEvent("click",i));break}}}),l.speedSelector.addEventListener("keydown",function(e){e.stopPropagation()}),a.addEventListener("loadedmetadata",function(){c&&(a.playbackRate=parseFloat(c))})}},cleanspeed:function(e){e&&(e.speedButton&&e.speedButton.parentNode.removeChild(e.speedButton),e.speedSelector&&e.speedSelector.parentNode.removeChild(e.speedSelector))}})},{}]},{},[1]);
{
"name": "mediaelement-plugins",
"version": "4.0.0",
"version": "4.0.1",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

@@ -35,7 +35,8 @@

git add --all
git commit -am "release 4.X.X"
git push
```
git add --all
git commit -am "release 4.X.X"
git push
```
**********************

@@ -42,0 +43,0 @@ PREPARING A RELEASE - second step on github.com

@@ -144,2 +144,9 @@ 'use strict';

/**
* Store a reference to the radio buttons to prevent a scope bug in keyboard events
* when multiple MediaElement players are on the same page. Otherwise these keyboard
* events would always control the first speed button instance on the page.
*/
player.speedRadioButtons = radios;
// hover or keyboard focus

@@ -206,5 +213,6 @@ for (let i = 0, total = inEvents.length; i < total; i++) {

for (let i = 0; i < radios.length - 1; i++) {
if (radios[i].checked) {
const nextRadio = radios[i+1];
const _radios = player.speedRadioButtons;
for (let i = 0; i < _radios.length - 1; i++) {
if (_radios[i].checked) {
const nextRadio = _radios[i+1];
nextRadio.dispatchEvent(mejs.Utils.createEvent('click', nextRadio));

@@ -221,5 +229,6 @@ break;

for (let i = 1; i < radios.length; i++) {
if (radios[i].checked) {
const prevRadio = radios[i-1];
const _radios = player.speedRadioButtons;
for (let i = 1; i < _radios.length; i++) {
if (_radios[i].checked) {
const prevRadio = _radios[i-1];
prevRadio.dispatchEvent(mejs.Utils.createEvent('click', prevRadio));

@@ -226,0 +235,0 @@ break;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc