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

mediaelement-plugins

Package Overview
Dependencies
Maintainers
4
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 2.6.2 to 2.6.3

7

changelog.md
# Version History
## *2.6.3 (2022/11/18)*
### QUALITY PLUGIN
Improvements to the last quality-plugin update:
* Fixes the problem that it was not possible to switch between video qualities due to a bug (PR #229, Issue #196)
* Fixes some linting errors
## *2.6.2 (2021/11/04)*

@@ -4,0 +11,0 @@

6

dist/quality/quality.js

@@ -203,3 +203,3 @@ /*!

} else {
t.updateQualityButton(this, player, currentQuality);
currentQuality = t.updateQualityButton(this, player, currentQuality);

@@ -328,6 +328,5 @@ var currentTime = media.currentTime;

},
updateQualityButton: function updateQualityButton(self, player, currentQuality) {
updateQualityButton: function updateQualityButton(self, player) {
var t = this;
var newQuality = self.value;
currentQuality = newQuality;

@@ -350,2 +349,3 @@ var formerSelected = player.qualitiesContainer.querySelectorAll('.' + t.options.classPrefix + 'qualities-selected');

player.qualitiesContainer.querySelector('button').innerHTML = newQuality;
return newQuality;
},

@@ -352,0 +352,0 @@ getQualityFromHeight: function getQualityFromHeight(height) {

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

*/
!function n(l,o,r){function u(t,e){if(!o[t]){if(!l[t]){var i="function"==typeof require&&require;if(!e&&i)return i(t,!0);if(c)return c(t,!0);var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}var s=o[t]={exports:{}};l[t][0].call(s.exports,function(e){return u(l[t][1][e]||e)},s,s.exports,n,l,o,r)}return o[t].exports}for(var c="function"==typeof require&&require,e=0;e<r.length;e++)u(r[e]);return u}({1:[function(e,t,i){"use strict";mejs.i18n.en["mejs.quality-chooser"]="Quality Chooser",Object.assign(mejs.MepDefaults,{defaultQuality:"auto",qualityText:null,autoGenerate:!1,autoDash:!1,autoHLS:!1,qualityChangeCallback:null}),Object.assign(MediaElementPlayer.prototype,{buildquality:function(i,e,t,a){for(var s=this,n=s.mediaFiles?s.mediaFiles:s.node.children,l=new Map,o=0,r=n.length;o<r;o++){var u=n[o],c=u instanceof HTMLElement?u.getAttribute("data-quality"):u["data-quality"];if("undefined"===c&&(c="Auto",s.options.autoGenerate=!0),s.mediaFiles){var d=document.createElement("source");d.src=u.src,d.type=u.type,s.addValueToKey(l,c,d)}else"SOURCE"===u.nodeName&&s.addValueToKey(l,c,u)}if(!(l.size<=1)){var f=0;a.addEventListener("error",function(e){if("No renderer found"===e.message&&l.get("").length>f+1){f+=1;var t=l.get("")[f].src;a.setSrc(t),a.load()}}),a.addEventListener("loadedmetadata",function(){if(a.hlsPlayer){var e=a.hlsPlayer.levels;s.options.autoGenerate&&1<e.length&&(e.forEach(function(e){var t=e.height,i=s.getQualityFromHeight(t);s.addValueToKey(l,i,"")}),s.options.autoHLS=!0,s.generateQualityButton(s,i,a,l,""))}else if(a.dashPlayer){var t=a.dashPlayer.getBitrateInfoListFor("video");s.options.autoGenerate&&1<t.length&&(t.forEach(function(e){var t=e.height,i=s.getQualityFromHeight(t);s.addValueToKey(l,i,"")}),s.options.autoDash=!0,s.generateQualityButton(s,i,a,l,""))}}),s.generateQualityButton(s,i,a,l,"")}},generateQualityButton:function(n,l,i,a,s){n.cleanquality(l);var e=mejs.Utils.isString(n.options.qualityText)?n.options.qualityText:mejs.i18n.t("mejs.quality-chooser"),o=function(e){var t=void 0;t="auto"===e?n.keyExist(a,e)?e:n.getMapIndex(a,0).key:e;return t}(n.options.defaultQuality);s=o;var t=Math.floor(100*Math.random());l.qualitiesContainer=document.createElement("div"),l.qualitiesContainer.className=n.options.classPrefix+"button "+n.options.classPrefix+"qualities-button",l.qualitiesContainer.innerHTML='<button type="button" title="'+e+'" aria-label="'+e+'" aria-controls="qualitieslist-'+t+'" aria-expanded="false">'+o+'</button><div class="'+n.options.classPrefix+"qualities-selector "+n.options.classPrefix+'offscreen"><ul class="'+n.options.classPrefix+'qualities-selector-list" id="qualitieslist-'+t+'" tabindex="-1"></ul></div>',n.addControlElement(l.qualitiesContainer,"qualities"),a.forEach(function(e,t){if("map_keys_1"!==t){var i=e[0],a=t,s=n.id+"-qualities-"+a;l.qualitiesContainer.querySelector("ul").innerHTML+='<li class="'+n.options.classPrefix+'qualities-selector-list-item"><input class="'+n.options.classPrefix+"qualities-selector-input "+(a===o?n.options.classPrefix+"qualities-selected-input":"")+'" type="radio" name="'+n.id+'_qualities" disabled="disabled" value="'+a+'" id="'+s+'" '+(a===o?' checked="checked"':"")+' /><label for="'+s+'" class="'+n.options.classPrefix+"qualities-selector-label "+(a===o?" "+n.options.classPrefix+"qualities-selected":"")+'">'+(i.title||a)+" </label></li>"}});var r=!0,u=l.qualitiesContainer,c=l.qualitiesContainer.querySelector("button"),d=l.qualitiesContainer.querySelector("."+n.options.classPrefix+"qualities-selector"),f=l.qualitiesContainer.querySelector("."+n.options.classPrefix+"qualities-selector-list"),p=l.qualitiesContainer.querySelectorAll('input[type="radio"]'),y=l.qualitiesContainer.querySelectorAll("."+n.options.classPrefix+"qualities-selector-label");function h(){mejs.Utils.addClass(d,n.options.classPrefix+"offscreen"),c.setAttribute("aria-expanded","false"),c.focus(),r=!0}function q(){mejs.Utils.removeClass(d,n.options.classPrefix+"offscreen"),d.style.height=d.querySelector("ul").offsetHeight+"px",d.style.top=-1*parseFloat(d.offsetHeight)+"px",c.setAttribute("aria-expanded","true"),d.querySelector("."+n.options.classPrefix+"qualities-selected-input").focus(),r=!1}c.addEventListener("click",function(){!0===r?q():h()}),f.addEventListener("focusout",function(e){u.contains(e.relatedTarget)||h()}),c.addEventListener("mouseenter",function(){q()}),u.addEventListener("mouseleave",function(){h()}),u.addEventListener("keydown",function(e){"Escape"===e.key&&h(),e.stopPropagation()});for(var v=0,g=p.length;v<g;v++){var m=p[v];m.disabled=!1,m.addEventListener("change",function(){if(n.options.autoDash)n.updateQualityButton(this,l,s),n.switchDashQuality(l,i);else if(n.options.autoHLS)n.updateQualityButton(this,l,s),n.switchHLSQuality(l,i);else{n.updateQualityButton(this,l,s);var t=i.currentTime,e=i.paused;e||i.pause(),n.updateVideoSource(i,a,s),i.setSrc(a.get(s)[0].src),i.load(),i.dispatchEvent(mejs.Utils.createEvent("seeking",i)),e||i.play(),i.addEventListener("canplay",function e(){i.setCurrentTime(t),i.removeEventListener("canplay",e)})}n.options.qualityChangeCallback&&n.options.qualityChangeCallback(i,i.originalNode,newQuality)})}for(var x=0,C=y.length;x<C;x++)y[x].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)})},cleanquality:function(e){e&&e.qualitiesContainer&&e.qualitiesContainer.remove()},addValueToKey:function(e,t,i){e.has("map_keys_1")?e.get("map_keys_1").push(t):e.set("map_keys_1",[]),e.has(t)||e.set(t,[]),e.get(t).push(i)},updateVideoSource:function(i,e,t){this.cleanMediaSource(i);for(var a=e.get(t),s=function(e){var t=i.children[e];"VIDEO"===t.tagName&&a.forEach(function(e){t.appendChild(e)})},n=0;n<i.children.length;n++)s(n)},cleanMediaSource:function(e){for(var t=0;t<e.children.length;t++){var i=e.children[t];if("VIDEO"===i.tagName)for(;i.firstChild;)i.removeChild(i.firstChild)}},getMapIndex:function(e,i){var a=-1,s={};return e.forEach(function(e,t){a===i&&(s.key=t,s.value=e),a++}),s},keyExist:function(e,t){return-1<e.get("map_keys_1").indexOf(t)},switchDashQuality:function(e,t){for(var i=e.qualitiesContainer.querySelectorAll('input[type="radio"]'),a=0;a<i.length;a++)i[a].checked&&(0===a?t.dashPlayer.setAutoSwitchQuality(!0):(t.dashPlayer.setAutoSwitchQuality(!1),t.dashPlayer.setQualityFor("video",a-1)))},switchHLSQuality:function(e,t){for(var i=e.qualitiesContainer.querySelectorAll('input[type="radio"]'),a=0;a<i.length;a++)i[a].checked&&(t.hlsPlayer.currentLevel=0===a?-1:a-1)},updateQualityButton:function(e,t,i){var a=this,s=e.value;for(var n=t.qualitiesContainer.querySelectorAll("."+a.options.classPrefix+"qualities-selected"),l=0,o=n.length;l<o;l++)mejs.Utils.removeClass(n[l],a.options.classPrefix+"qualities-selected"),n[l].parentElement.querySelector("input").classList.remove(a.options.classPrefix+"qualities-selected-input");e.checked=!0;for(var r=mejs.Utils.siblings(e,function(e){return mejs.Utils.hasClass(e,a.options.classPrefix+"qualities-selector-label")}),u=0,c=r.length;u<c;u++)mejs.Utils.addClass(r[u],a.options.classPrefix+"qualities-selected"),r[u].parentElement.querySelector("input").classList.add(a.options.classPrefix+"qualities-selected-input");t.qualitiesContainer.querySelector("button").innerHTML=s},getQualityFromHeight:function(e){return 4320<=e?"8K UHD":2160<=e?"UHD":1440<=e?"QHD":1080<=e?"FHD":720<=e?"HD":"SD"}})},{}]},{},[1]);
!function n(l,o,r){function u(t,e){if(!o[t]){if(!l[t]){var i="function"==typeof require&&require;if(!e&&i)return i(t,!0);if(c)return c(t,!0);var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}var s=o[t]={exports:{}};l[t][0].call(s.exports,function(e){return u(l[t][1][e]||e)},s,s.exports,n,l,o,r)}return o[t].exports}for(var c="function"==typeof require&&require,e=0;e<r.length;e++)u(r[e]);return u}({1:[function(e,t,i){"use strict";mejs.i18n.en["mejs.quality-chooser"]="Quality Chooser",Object.assign(mejs.MepDefaults,{defaultQuality:"auto",qualityText:null,autoGenerate:!1,autoDash:!1,autoHLS:!1,qualityChangeCallback:null}),Object.assign(MediaElementPlayer.prototype,{buildquality:function(i,e,t,a){for(var s=this,n=s.mediaFiles?s.mediaFiles:s.node.children,l=new Map,o=0,r=n.length;o<r;o++){var u=n[o],c=u instanceof HTMLElement?u.getAttribute("data-quality"):u["data-quality"];if("undefined"===c&&(c="Auto",s.options.autoGenerate=!0),s.mediaFiles){var d=document.createElement("source");d.src=u.src,d.type=u.type,s.addValueToKey(l,c,d)}else"SOURCE"===u.nodeName&&s.addValueToKey(l,c,u)}if(!(l.size<=1)){var f=0;a.addEventListener("error",function(e){if("No renderer found"===e.message&&l.get("").length>f+1){f+=1;var t=l.get("")[f].src;a.setSrc(t),a.load()}}),a.addEventListener("loadedmetadata",function(){if(a.hlsPlayer){var e=a.hlsPlayer.levels;s.options.autoGenerate&&1<e.length&&(e.forEach(function(e){var t=e.height,i=s.getQualityFromHeight(t);s.addValueToKey(l,i,"")}),s.options.autoHLS=!0,s.generateQualityButton(s,i,a,l,""))}else if(a.dashPlayer){var t=a.dashPlayer.getBitrateInfoListFor("video");s.options.autoGenerate&&1<t.length&&(t.forEach(function(e){var t=e.height,i=s.getQualityFromHeight(t);s.addValueToKey(l,i,"")}),s.options.autoDash=!0,s.generateQualityButton(s,i,a,l,""))}}),s.generateQualityButton(s,i,a,l,"")}},generateQualityButton:function(n,l,i,a,s){n.cleanquality(l);var e=mejs.Utils.isString(n.options.qualityText)?n.options.qualityText:mejs.i18n.t("mejs.quality-chooser"),o=function(e){var t=void 0;t="auto"===e?n.keyExist(a,e)?e:n.getMapIndex(a,0).key:e;return t}(n.options.defaultQuality);s=o;var t=Math.floor(100*Math.random());l.qualitiesContainer=document.createElement("div"),l.qualitiesContainer.className=n.options.classPrefix+"button "+n.options.classPrefix+"qualities-button",l.qualitiesContainer.innerHTML='<button type="button" title="'+e+'" aria-label="'+e+'" aria-controls="qualitieslist-'+t+'" aria-expanded="false">'+o+'</button><div class="'+n.options.classPrefix+"qualities-selector "+n.options.classPrefix+'offscreen"><ul class="'+n.options.classPrefix+'qualities-selector-list" id="qualitieslist-'+t+'" tabindex="-1"></ul></div>',n.addControlElement(l.qualitiesContainer,"qualities"),a.forEach(function(e,t){if("map_keys_1"!==t){var i=e[0],a=t,s=n.id+"-qualities-"+a;l.qualitiesContainer.querySelector("ul").innerHTML+='<li class="'+n.options.classPrefix+'qualities-selector-list-item"><input class="'+n.options.classPrefix+"qualities-selector-input "+(a===o?n.options.classPrefix+"qualities-selected-input":"")+'" type="radio" name="'+n.id+'_qualities" disabled="disabled" value="'+a+'" id="'+s+'" '+(a===o?' checked="checked"':"")+' /><label for="'+s+'" class="'+n.options.classPrefix+"qualities-selector-label "+(a===o?" "+n.options.classPrefix+"qualities-selected":"")+'">'+(i.title||a)+" </label></li>"}});var r=!0,u=l.qualitiesContainer,c=l.qualitiesContainer.querySelector("button"),d=l.qualitiesContainer.querySelector("."+n.options.classPrefix+"qualities-selector"),f=l.qualitiesContainer.querySelector("."+n.options.classPrefix+"qualities-selector-list"),p=l.qualitiesContainer.querySelectorAll('input[type="radio"]'),y=l.qualitiesContainer.querySelectorAll("."+n.options.classPrefix+"qualities-selector-label");function h(){mejs.Utils.addClass(d,n.options.classPrefix+"offscreen"),c.setAttribute("aria-expanded","false"),c.focus(),r=!0}function q(){mejs.Utils.removeClass(d,n.options.classPrefix+"offscreen"),d.style.height=d.querySelector("ul").offsetHeight+"px",d.style.top=-1*parseFloat(d.offsetHeight)+"px",c.setAttribute("aria-expanded","true"),d.querySelector("."+n.options.classPrefix+"qualities-selected-input").focus(),r=!1}c.addEventListener("click",function(){!0===r?q():h()}),f.addEventListener("focusout",function(e){u.contains(e.relatedTarget)||h()}),c.addEventListener("mouseenter",function(){q()}),u.addEventListener("mouseleave",function(){h()}),u.addEventListener("keydown",function(e){"Escape"===e.key&&h(),e.stopPropagation()});for(var v=0,g=p.length;v<g;v++){var m=p[v];m.disabled=!1,m.addEventListener("change",function(){if(n.options.autoDash)n.updateQualityButton(this,l,s),n.switchDashQuality(l,i);else if(n.options.autoHLS)n.updateQualityButton(this,l,s),n.switchHLSQuality(l,i);else{s=n.updateQualityButton(this,l,s);var t=i.currentTime,e=i.paused;e||i.pause(),n.updateVideoSource(i,a,s),i.setSrc(a.get(s)[0].src),i.load(),i.dispatchEvent(mejs.Utils.createEvent("seeking",i)),e||i.play(),i.addEventListener("canplay",function e(){i.setCurrentTime(t),i.removeEventListener("canplay",e)})}n.options.qualityChangeCallback&&n.options.qualityChangeCallback(i,i.originalNode,newQuality)})}for(var x=0,C=y.length;x<C;x++)y[x].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)})},cleanquality:function(e){e&&e.qualitiesContainer&&e.qualitiesContainer.remove()},addValueToKey:function(e,t,i){e.has("map_keys_1")?e.get("map_keys_1").push(t):e.set("map_keys_1",[]),e.has(t)||e.set(t,[]),e.get(t).push(i)},updateVideoSource:function(i,e,t){this.cleanMediaSource(i);for(var a=e.get(t),s=function(e){var t=i.children[e];"VIDEO"===t.tagName&&a.forEach(function(e){t.appendChild(e)})},n=0;n<i.children.length;n++)s(n)},cleanMediaSource:function(e){for(var t=0;t<e.children.length;t++){var i=e.children[t];if("VIDEO"===i.tagName)for(;i.firstChild;)i.removeChild(i.firstChild)}},getMapIndex:function(e,i){var a=-1,s={};return e.forEach(function(e,t){a===i&&(s.key=t,s.value=e),a++}),s},keyExist:function(e,t){return-1<e.get("map_keys_1").indexOf(t)},switchDashQuality:function(e,t){for(var i=e.qualitiesContainer.querySelectorAll('input[type="radio"]'),a=0;a<i.length;a++)i[a].checked&&(0===a?t.dashPlayer.setAutoSwitchQuality(!0):(t.dashPlayer.setAutoSwitchQuality(!1),t.dashPlayer.setQualityFor("video",a-1)))},switchHLSQuality:function(e,t){for(var i=e.qualitiesContainer.querySelectorAll('input[type="radio"]'),a=0;a<i.length;a++)i[a].checked&&(t.hlsPlayer.currentLevel=0===a?-1:a-1)},updateQualityButton:function(e,t){for(var i=this,a=e.value,s=t.qualitiesContainer.querySelectorAll("."+i.options.classPrefix+"qualities-selected"),n=0,l=s.length;n<l;n++)mejs.Utils.removeClass(s[n],i.options.classPrefix+"qualities-selected"),s[n].parentElement.querySelector("input").classList.remove(i.options.classPrefix+"qualities-selected-input");e.checked=!0;for(var o=mejs.Utils.siblings(e,function(e){return mejs.Utils.hasClass(e,i.options.classPrefix+"qualities-selector-label")}),r=0,u=o.length;r<u;r++)mejs.Utils.addClass(o[r],i.options.classPrefix+"qualities-selected"),o[r].parentElement.querySelector("input").classList.add(i.options.classPrefix+"qualities-selected-input");return t.qualitiesContainer.querySelector("button").innerHTML=a},getQualityFromHeight:function(e){return 4320<=e?"8K UHD":2160<=e?"UHD":1440<=e?"QHD":1080<=e?"FHD":720<=e?"HD":"SD"}})},{}]},{},[1]);
{
"name": "mediaelement-plugins",
"version": "2.6.2",
"version": "2.6.3",
"repository": {

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

@@ -20,3 +20,3 @@ 'use strict';

*/
PiPTitle: null
PiPTitle: null
});

@@ -29,9 +29,4 @@

* Feature constructor.
*
* @param {MediaElementPlayer} player
* @param {HTMLElement} controls
* @param {HTMLElement} layers
* @param {HTMLElement} media
*/
buildpictureInPicture (player, controls, layers, media) {
buildpictureInPicture () {

@@ -50,3 +45,3 @@ const

if(video instanceof HTMLVideoElement) {
if(video instanceof HTMLVideoElement) {
// This is currently not a W3C standard (25-10-2018)

@@ -58,3 +53,3 @@ // https://wicg.github.io/picture-in-picture/

video.requestPictureInPicture()
.catch(error => {
.catch(() => {
// Handle error

@@ -65,3 +60,3 @@ });

document.exitPictureInPicture()
.catch(error => {
.catch(() => {
// Handle error

@@ -73,6 +68,6 @@ });

// Safari implmentation
else if (video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === "function") {
else if (video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === "function") {
// For more info https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls?language=javascript
// Toggle PiP when the user clicks the button.
button.addEventListener("click", function(event) {
button.addEventListener("click", function() {
video.webkitSetPresentationMode(video.webkitPresentationMode === "picture-in-picture" ? "inline" : "picture-in-picture");

@@ -79,0 +74,0 @@ });

@@ -351,5 +351,5 @@ 'use strict';

createPlayList_ () {
const t = this;
const t = this;
t.playlist = t.options.playlist.length ? t.options.playlist :
t.playlist = t.options.playlist.length ? t.options.playlist :
t.mediaFiles && t.mediaFiles.length ? t.mediaFiles : [];

@@ -356,0 +356,0 @@

@@ -99,2 +99,3 @@ 'use strict';

media.addEventListener('loadedmetadata', function () {
// eslint-disable-next-line
if (!!media.hlsPlayer) {

@@ -111,2 +112,3 @@ const levels = media.hlsPlayer.levels;

}
// eslint-disable-next-line
} else if (!!media.dashPlayer) {

@@ -247,3 +249,3 @@ const bitrates = media.dashPlayer.getBitrateInfoListFor("video");

} else {
t.updateQualityButton(this, player, currentQuality);
currentQuality = t.updateQualityButton(this, player, currentQuality);

@@ -425,5 +427,4 @@ let currentTime = media.currentTime;

* @param {MediaElementPlayer} player
* @param {String} currentQuality the label for the current quality selection
*/
updateQualityButton (self, player, currentQuality) {
updateQualityButton (self, player) {
const t = this;

@@ -433,3 +434,2 @@ const

;
currentQuality = newQuality;

@@ -450,8 +450,9 @@ const formerSelected = player.qualitiesContainer.querySelectorAll(`.${t.options.classPrefix}qualities-selected`);

player.qualitiesContainer.querySelector('button').innerHTML = newQuality;
return newQuality;
},
/**
* Returns the quality represnetaion base on the height of the loaded video
* @param {Number} height the pixel height of the video
**/
* Returns the quality represnetaion base on the height of the loaded video
* @param {Number} height the pixel height of the video
**/
getQualityFromHeight (height) {

@@ -458,0 +459,0 @@ if (height >= 4320) {

@@ -12,3 +12,3 @@ module.exports = function(grunt) {

*/
watch: {

@@ -36,6 +36,6 @@ js:{

js: {
files: {
'snapshot.min.js': ['snapshot.js']
}
}
files: {
'snapshot.min.js': ['snapshot.js']
}
}

@@ -58,10 +58,10 @@ },

// Load modules
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.loadNpmTasks('grunt-css');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.loadNpmTasks('grunt-css');
// Register the default tasks.
// Register the default tasks.
grunt.registerTask('default', ['watch']);
};
};

@@ -11,3 +11,5 @@ /*!

*
*/(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
*/
// eslint-disable-next-line
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
'use strict';

@@ -25,3 +27,3 @@

* @param snapQuality = between 0 & 1 (float)
* @param snapShot = bool true|false either to
* @param snapShot = bool true|false either to
*/

@@ -56,6 +58,6 @@

// skipTitle = mejs.Utils.isString(t.options.skipBackText) ? t.options.skipBackText.replace('%1', t.options.skipBackInterval) : defaultTitle,
// skipTitle = mejs.Utils.isString(t.options.skipBackText) ? t.options.skipBackText.replace('%1', t.options.skipBackInterval) : defaultTitle,
// Get a handle on the 2d context of the canvas element
video = media.firstChild,
canvas = document.querySelector('canvas'),

@@ -82,4 +84,4 @@ context = canvas.getContext('2d'),

// Set the canvas width and height to the values just calculated
canvas.width = w;

@@ -106,9 +108,9 @@ canvas.height = h;

* Callback error when media seeking or media not played yet
* Return
* Return
* Parameters
*/
if ( isFunction(snapSuccess) )
snapSuccess.call(this, snap(snapType, snapQuality) );
snapSuccess.call(this, snap(snapType, snapQuality) );

@@ -125,8 +127,8 @@ if ( true === snapShot ) {

* callback error when media seeking or media not played yet
* return
* return
* parameters
*/
if ( isFunction(snapError) )
return snapError.call(this);

@@ -144,3 +146,3 @@

var isFunction = (funcfunction) => {
return funcfunction && {}.toString.call(funcfunction) === '[object Function]';
return funcfunction && {}.toString.call(funcfunction) === '[object Function]';
}

@@ -152,16 +154,16 @@

var blobUrl = URL.createObjectURL(blob);
var blobUrl = URL.createObjectURL(blob);
var a = document.createElement("a");
document.body.appendChild(a);
var a = document.createElement("a");
document.body.appendChild(a);
a.setAttribute("href", blobUrl);
a.className = 'snapshot-download';
a.setAttribute("download", 'snapshot-' + Math.floor(media.currentTime) + '.' + t.options.snapType);
a.click();
URL.revokeObjectURL(blobUrl);
a.setAttribute("href", blobUrl);
a.className = 'snapshot-download';
a.setAttribute("download", 'snapshot-' + Math.floor(media.currentTime) + '.' + t.options.snapType);
a.click();
URL.revokeObjectURL(blobUrl);
}, 'image/' + t.options.snapType, t.options.snapQuality );
}, 'image/' + t.options.snapType, t.options.snapQuality );
};

@@ -179,4 +181,4 @@

var snapObject = {
'url': dataURL,
'type':'image/' + snapType,
'url': dataURL,
'type':'image/' + snapType,
'quality': snapQuality,

@@ -183,0 +185,0 @@ 'width': w,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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