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

mediaelement

Package Overview
Dependencies
Maintainers
2
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mediaelement - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

demo/chapters.vtt

1

build/lang/ca.js

@@ -29,2 +29,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Llegendes/Subtítols",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Ningú",

@@ -31,0 +32,0 @@ "mejs.mute-toggle": "Alternar silenci",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Titulky",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Žádný",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Vypnout/zapnout zvuk",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Überschriften/Untertitel",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Keine",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Stummschaltung umschalten",

@@ -30,2 +30,3 @@ /*!

"mejs.captions-subtitles": "Leyendas/Subtítulos",
"mejs.captions-chapters": "Capítulos",
"mejs.none": "Ninguno",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Alternar silencio",

@@ -31,2 +31,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Sous-titres",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Aucun",

@@ -33,0 +34,0 @@ "mejs.mute-toggle": "Activer/désactiver le son",

@@ -27,2 +27,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Opisi/Prijevodi",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Ništa",

@@ -29,0 +30,0 @@ "mejs.mute-toggle": "Uključi/isključi zvuk",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Képaláírás/Feliratok",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Nincs",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Némítás kapcsolója",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Acquisizioni/sottotitoli",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Nessuno",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Toggle muto",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "キャプション/字幕",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "なし",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "ミュートトグル",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "캡션/자막",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "없음",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "음소거 전환",

@@ -31,2 +31,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Bijschriften/ondertiteling",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Geen",

@@ -33,0 +34,0 @@ "mejs.mute-toggle": "Dempen schakelen",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Podpisy/napisy",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Brak",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Przełączanie wyciszania",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Legendas",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Sem legendas",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Alternar silêncio",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Legendas",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Nenhum",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Alternar silêncio",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Legende/Subtitrări",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Niciunul",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Comutare dezactivare sunet",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Титры/Субтитры",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Нет",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Без звука",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "Skryté titulky/Titulky",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Žiadne",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "Prepínač stlmenia",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "字幕/标题",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "无",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "静音切换",

@@ -30,2 +30,3 @@ 'use strict';/*!

"mejs.captions-subtitles": "字幕/標題",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "沒有",

@@ -32,0 +33,0 @@ "mejs.mute-toggle": "靜音切換",

### Version History
*3.1.2 (2017/02/10)*
* Expanded workflow to stop media loading completely when removing player @ron666
* Added more fixes to Flash audio shim (https://github.com/johndyer/mediaelement/pull/2054) @an1rk4
* Added security statements on almost all shims to allow to be played cross-domain @ron666
* Removed HAS_TOUCH flag considered unnecessary @ron666
* Fixed workflow to detect if libraries on HLS, DASH and FLV renderers were already loaded @ron666
* Reintegrated workflow to load source using flashvar `src` in audio (https://github.com/johndyer/mediaelement/pull/2059) @astr0junk
* Improved documentation for Installation and API @ron666
* Added workflow to sanitize HTML for captions due to potential XSS vulnerability @ron666
* Added muted workflow for audio Flash shim (https://github.com/johndyer/mediaelement/pull/2063) @an1rk4
* Added CDNjs badge for README @ron666
* Added validation to avoid Flash check on MS Edge due to issues with `plugins` element @ron666
* Added reference to "johndyer/mediaelement-plugins" (https://github.com/johndyer/mediaelement/pull/2067) @isantolin
* Standardized way to display chapters tracks using button and menu @ron666
*3.1.1 (2017/02/02)*

@@ -4,0 +20,0 @@

@@ -103,3 +103,19 @@ # API and Configuration

### Properties
All properties are listed in https://www.w3.org/2010/05/video/mediaevents.html; they can be accessed through an instance of player as described [here](usage.md).
Property | Description | GET | SET
-------- | ----------- | --- | ---
autoplay | Set or return whether the audio/video should start playing as soon as it is loaded | X | X
buffered | Return a TimeRanges object representing the buffered parts of the audio/video | X |
controls | Set or return whether the audio/video should display controls (like play/pause etc.) | X | X
currentSrc | Return the URL of the current audio/video | X |
currentTime | Set or return the current playback position in the audio/video (in seconds) | X | X
duration | Return the length of the current audio/video (in seconds); to determine it without playing media, `preload="auto"` must be set | X |
ended | Return whether the playback of the audio/video has ended or not | X |
error | Return a MediaError object representing the error state of the audio/video | X |
loop | Set or return whether the audio/video should start over again when finished | X | X
muted | Set or returns whether the audio/video is muted or not | X | X
paused | Return whether the audio/video is paused or not | X |
readyState | Return the current ready state of the audio/video | X |
seeking | Return whether the user is currently seeking in the audio/video | X |
src | Set or return the current source of the audio/video element | X | X
volume | Set or return the volume of the audio/video | X | X

@@ -116,5 +132,13 @@ <a id="methods"></a>

remove() | Destroy the video/audio player instance
canPlayType(type) | Determine whether current player can/cannot play a specific media type; `type` is MIME type and each renderer has a whitelist of them
setPlayerSize (width, height) | Set player's `width` and `height` also considering the `stretching` configuration
setPoster (url) | Add a `image` tag with the poster's `url` inside the player's layer
setMuted (muted) | Mute/unmute the player; `muted` is a boolean value
setCurrentTime (time) | Set a new current time for the player; `time` is either an integer or float number, and if negative, it will start from zero.
getCurrentTime () | Retrieve the current time of the media being played
setVolume (volume) | Set a volume level for the player; `volume` is a number between `0` and `1`
getVolume () | Retrieve the current volume level of the media being played
setSrc (src) | Set a new URL/path for the player; each renderer has a different mechanism to set it
getSrc () | Retrieve the media URL/path currently being played; each renderer has a different mechanism to return it
**Note:** `canPlayType()` method is used internally and accounts for other types of media to be played (such as HLS, RTMP, etc.); ```addTextTrack()``` is replaced also with more code to manage clsoed captioning and tracks. For that reason, they are not listed.
<a id="events"></a>

@@ -125,6 +149,6 @@ ### Events

----- | -----------
loadeddata | Media data is loaded
loadedmetadata | Meta data (like dimensions and duration) are loaded
progress | Browser is in the process of getting the media data
timeupdate | The playing position has changed (like when the user fast forwards to a different point in the media)
seeking | The seeking attribute is set to true indicating that seeking has started
seeked | The seeking attribute is set to false indicating that seeking has ended

@@ -137,5 +161,3 @@ canplay | A file is ready to start playing (when it has buffered enough to begin)

volumechange | Volume is changed (including setting the volume to "mute")
For a more comprehensive list of events and more detailed information about them, please check the [Event summary](https://www.w3.org/TR/html5/embedded-content-0.html#mediaevents) page.
________
[Back to Main](../README.md)

@@ -51,2 +51,4 @@ # Installation

**Do not** compress media (`mod_deflate` or `gzip`), since it can lead to unexpected results, like headers not being passed correctly.
<a id="install"></a>

@@ -53,0 +55,0 @@ ## 1. Install `MediaElementJS`

2

package.js
Package.describe({
name: 'johndyer:mediaelement',
summary: '*Official* MediaElement.js: <video> and <audio> made easy. One file. Any browser. Same UI.',
version: '3.1.1',
version: '3.1.2',
git: 'https://github.com/johndyer/mediaelement'

@@ -6,0 +6,0 @@ });

{
"name": "mediaelement",
"license": "MIT",
"version": "3.1.1",
"version": "3.1.2",
"main": "full.js",

@@ -6,0 +6,0 @@ "repository": {

@@ -17,2 +17,3 @@ # ![MediaElementJS](https://cloud.githubusercontent.com/assets/910829/22357262/e6cf32b4-e404-11e6-876b-59afa009f65c.png)

[![MIT License](https://img.shields.io/npm/l/mediaelement.svg)](https://johndyer.mit-license.org/)
[![CDNJS](https://img.shields.io/cdnjs/v/mediaelement.svg)](https://cdnjs.com/libraries/mediaelement)

@@ -76,2 +77,4 @@ # Table of Contents

Additional features can be found at https://github.com/johndyer/mediaelement-plugins
<a id="api"></a>

@@ -97,2 +100,2 @@ ## API and Configuration

New features and pending bugs can be found at [TODO list](TODO.md).
New features and pending bugs can be found at [TODO list](TODO.md).

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

// version number
mejs.version = '3.1.1';
mejs.version = '3.1.2';

@@ -12,0 +12,0 @@ // Basic HTML5 settings

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

import i18n from '../core/i18n';
import {IS_FIREFOX, HAS_TOUCH} from '../utils/constants';
import {IS_FIREFOX, IS_IOS, IS_ANDROID} from '../utils/constants';
import {secondsToTimeCode} from '../utils/time';

@@ -115,3 +115,3 @@

// position floating time box
if (!HAS_TOUCH) {
if (!IS_IOS && !IS_ANDROID) {
t.timefloat.css('left', pos);

@@ -305,3 +305,3 @@ t.timefloatcurrent.html(secondsToTimeCode(t.newTime, player.options.alwaysShowHours));

});
if (t.timefloat !== undefined && !HAS_TOUCH) {
if (t.timefloat !== undefined && !IS_IOS && !IS_ANDROID) {
t.timefloat.show();

@@ -308,0 +308,0 @@ }

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

import {secondsToTimeCode, convertSMPTEtoSeconds} from '../utils/time';
import {sanitizeHTML} from '../utils/general';

@@ -32,2 +33,6 @@ /**

/**
* @type {String}
*/
chaptersText: '',
/**
* Avoid to screen reader speak captions over an audio track.

@@ -70,3 +75,3 @@ *

*/
buildtracks: function (player, controls, layers, media) {
buildtracks: function (player, controls, layers, media) {
if (player.tracks.length === 0) {

@@ -80,5 +85,6 @@ return;

tracksTitle = t.options.tracksText ? t.options.tracksText : i18n.t('mejs.captions-subtitles'),
chaptersTitle = t.options.chaptersText ? t.options.chaptersText : i18n.t('mejs.captions-chapters'),
i,
kind
;
;

@@ -93,35 +99,40 @@ // If browser will do native captions, prefer mejs captions, loop through tracks and hide

t.cleartracks(player);
player.chapters = $(`<div class="${t.options.classPrefix}chapters ${t.options.classPrefix}layer"></div>`)
.prependTo(layers).hide();
player.captions =
$(`<div class="${t.options.classPrefix}captions-layer ${t.options.classPrefix}layer">` +
`<div class="${t.options.classPrefix}captions-position ${t.options.classPrefix}captions-position-hover"${attr}>` +
`<span class="${t.options.classPrefix}captions-text"></span>` +
`</div>` +
`</div>`)
.prependTo(layers).hide();
player.captions = $(`<div class="${t.options.classPrefix}captions-layer ${t.options.classPrefix}layer">` +
`<div class="${t.options.classPrefix}captions-position ${t.options.classPrefix}captions-position-hover"${attr}>` +
`<span class="${t.options.classPrefix}captions-text"></span>` +
`</div>` +
`</div>`)
.prependTo(layers).hide();
player.captionsText = player.captions.find(`.${t.options.classPrefix}captions-text`);
player.captionsButton =
$(`<div class="${t.options.classPrefix}button ${t.options.classPrefix}captions-button">` +
`<button type="button" aria-controls="${t.id}" title="${tracksTitle}" aria-label="${tracksTitle}"></button>` +
`<div class="${t.options.classPrefix}captions-selector ${t.options.classPrefix}offscreen">` +
`<ul class="${t.options.classPrefix}captions-selector-list">` +
`<li class="${t.options.classPrefix}captions-selector-list-item">` +
`<input type="radio" class="${t.options.classPrefix}captions-selector-input" ` +
`name="${player.id}_captions" id="${player.id}_captions_none" ` +
`value="none" checked="checked" />` +
`<label class="${t.options.classPrefix}captions-selector-label ` +
`${t.options.classPrefix}captions-selected" ` +
`for="${player.id}_captions_none">${i18n.t('mejs.none')}</label>` +
`</li>` +
`</ul>` +
`</div>` +
`</div>`)
.appendTo(controls);
player.captionsButton = $(`<div class="${t.options.classPrefix}button ${t.options.classPrefix}captions-button">` +
`<button type="button" aria-controls="${t.id}" title="${tracksTitle}" aria-label="${tracksTitle}"></button>` +
`<div class="${t.options.classPrefix}captions-selector ${t.options.classPrefix}offscreen">` +
`<ul class="${t.options.classPrefix}captions-selector-list">` +
`<li class="${t.options.classPrefix}captions-selector-list-item">` +
`<input type="radio" class="${t.options.classPrefix}captions-selector-input" ` +
`name="${player.id}_captions" id="${player.id}_captions_none" ` +
`value="none" checked="checked" />` +
`<label class="${t.options.classPrefix}captions-selector-label ` +
`${t.options.classPrefix}captions-selected" ` +
`for="${player.id}_captions_none">${i18n.t('mejs.none')}</label>` +
`</li>` +
`</ul>` +
`</div>` +
`</div>`)
.appendTo(controls);
player.chaptersButton = $(`<div class="${t.options.classPrefix}button ${t.options.classPrefix}chapters-button">` +
`<button type="button" aria-controls="${t.id}" title="${chaptersTitle}" aria-label="${chaptersTitle}"></button>` +
`<div class="${t.options.classPrefix}chapters-selector ${t.options.classPrefix}offscreen">` +
`<ul class="${t.options.classPrefix}chapters-selector-list" aria-role="menu"></ul>` +
`</div>` +
`</div>`);
let
subtitleCount = 0,
total = player.tracks.length
;
;

@@ -132,2 +143,4 @@ for (i = 0; i < total; i++) {

subtitleCount++;
} else if (kind === 'chapters' && !controls.find(`.${t.options.classPrefix}chapter-selector`).length) {
player.chaptersButton.appendTo(controls);
}

@@ -149,7 +162,7 @@ }

player.captionsButton
.on('mouseenter focusin', function() {
.on('mouseenter focusin', function () {
$(this).find(`.${t.options.classPrefix}captions-selector`)
.removeClass(`${t.options.classPrefix}offscreen`);
})
.on('mouseleave focusout', function() {
.on('mouseleave focusout', function () {
$(this).find(`.${t.options.classPrefix}captions-selector`)

@@ -159,3 +172,3 @@ .addClass(`${t.options.classPrefix}offscreen`);

// handle clicks to the language radio buttons
.on('click', 'input[type=radio]', function() {
.on('click', 'input[type=radio]', function () {
// value is trackId, same as the actual id, and we're using it here

@@ -166,3 +179,3 @@ // because the "none" checkbox doesn't have a trackId

})
.on('click', `.${t.options.classPrefix}captions-selector-label`, function() {
.on('click', `.${t.options.classPrefix}captions-selector-label`, function () {
$(this).siblings('input[type="radio"]').trigger('click');

@@ -176,2 +189,45 @@ })

player.chaptersButton
.on('mouseenter focusin', function () {
const
self = $(this),
chapters = self.find(`.${t.options.classPrefix}chapters-selector-list`).children().length
;
if (chapters) {
self.find(`.${t.options.classPrefix}chapters-selector`)
.removeClass(`${t.options.classPrefix}offscreen`);
}
})
.on('mouseleave focusout', function () {
$(this).find(`.${t.options.classPrefix}chapters-selector`)
.addClass(`${t.options.classPrefix}offscreen`);
})
// handle clicks to the chapters radio buttons
.on('click', 'input[type=radio]', function () {
const self = $(this);
player.chaptersButton.find('li').attr('aria-checked', false)
.end()
.find(`.${t.options.classPrefix}chapters-selected`)
.removeClass(`${t.options.classPrefix}chapters-selected`);
self.prop('checked', true)
.siblings(`.${t.options.classPrefix}chapters-selector-label`)
.addClass(`${t.options.classPrefix}chapters-selected`)
.end()
.parent().attr('aria-checked', true);
media.setCurrentTime(parseFloat(self.val()));
if (media.paused) {
media.play();
}
})
.on('click', `.${t.options.classPrefix}chapters-selector-label`, function () {
$(this).siblings('input[type="radio"]').trigger('click');
})
//Allow up/down arrow to change the selected radio without changing the volume.
.on('keydown', (e) => {
e.stopPropagation();
});
if (!player.options.alwaysShowControls) {

@@ -183,3 +239,3 @@ // move with controls

player.container.find(`.${t.options.classPrefix}captions-position`)
.addClass(`${t.options.classPrefix}captions-position-hover`);
.addClass(`${t.options.classPrefix}captions-position-hover`);

@@ -191,3 +247,3 @@ })

player.container.find(`.${t.options.classPrefix}captions-position`)
.removeClass(`${t.options.classPrefix}captions-position-hover`);
.removeClass(`${t.options.classPrefix}captions-position-hover`);
}

@@ -197,3 +253,3 @@ });

player.container.find(`.${t.options.classPrefix}captions-position`)
.addClass(`${t.options.classPrefix}captions-position-hover`);
.addClass(`${t.options.classPrefix}captions-position-hover`);
}

@@ -229,38 +285,5 @@

media.addEventListener('loadedmetadata', () => {
player.displayChapters();
}, false);
player.container.hover(
function() {
// chapters
if (player.hasChapters) {
player.chapters.removeClass(`${t.options.classPrefix}offscreen`);
player.chapters.fadeIn(200, function() {
let self = $(this);
self.height(self.find(`.${t.options.classPrefix}chapter`).outerHeight());
});
}
},
function() {
if (player.hasChapters) {
if (media.paused) {
player.chapters.fadeOut(200, function() {
$(this).addClass(`${t.options.classPrefix}offscreen`);
});
} else {
player.chapters.show();
}
}
});
t.container.on('controlsresize', () => {
t.adjustLanguageBox();
});
// check for autoplay
if (player.node.getAttribute('autoplay') !== null) {
player.chapters.addClass(`${t.options.classPrefix}offscreen`);
}
},

@@ -274,3 +297,3 @@

*/
cleartracks: function (player) {
cleartracks: function (player) {
if (player) {

@@ -292,3 +315,3 @@ if (player.captions) {

rebuildtracks: function () {
rebuildtracks: function () {
let t = this;

@@ -299,3 +322,3 @@ t.findTracks();

findTracks: function () {
findTracks: function () {
let

@@ -330,7 +353,7 @@ t = this,

*/
setTrack: function (trackId) {
setTrack: function (trackId) {
let
t = this,
i
;
;

@@ -371,3 +394,3 @@ t.captionsButton

*/
loadNextTrack: function () {
loadNextTrack: function () {
let t = this;

@@ -391,3 +414,3 @@

*/
loadTrack: function (index) {
loadTrack: function (index) {
let

@@ -405,3 +428,3 @@ t = this,

}
;
;

@@ -412,3 +435,3 @@ if (track !== undefined && (track.src !== undefined || track.src !== "")) {

dataType: 'text',
success: function (d) {
success: function (d) {

@@ -424,15 +447,12 @@ // parse the loaded file

if (track.kind === 'chapters') {
t.media.addEventListener('play', () => {
if (t.media.duration > 0) {
t.displayChapters();
}
}, false);
}
if (track.kind === 'slides') {
t.setupSlides(track);
}
// Load by default the first track with `chapters` kind
else if (track.kind === 'chapters' && !t.hasChapters) {
t.drawChapters(track);
t.hasChapters = true;
}
},
error: function () {
error: function () {
t.removeTrackButton(track.trackId);

@@ -449,3 +469,3 @@ t.loadNextTrack();

*/
enableTrackButton: function (track) {
enableTrackButton: function (track) {
let

@@ -463,3 +483,3 @@ t = this,

target.prop('disabled', false)
.siblings(`.${t.options.classPrefix}captions-selector-label`).html(label);
.siblings(`.${t.options.classPrefix}captions-selector-label`).html(label);

@@ -478,3 +498,3 @@ // auto select

*/
removeTrackButton: function (trackId) {
removeTrackButton: function (trackId) {
let t = this;

@@ -493,3 +513,3 @@

*/
addTrackButton: function (trackId, lang, label) {
addTrackButton: function (trackId, lang, label) {
let t = this;

@@ -520,3 +540,3 @@ if (label === '') {

*/
adjustLanguageBox: function () {
adjustLanguageBox: function () {
let t = this;

@@ -533,7 +553,7 @@ // adjust the size of the outer box

*/
checkForTracks: function () {
checkForTracks: function () {
let
t = this,
hasSubtitles = false
;
;

@@ -560,3 +580,3 @@ // check if any subtitles

*/
displayCaptions: function () {
displayCaptions: function () {

@@ -570,3 +590,36 @@ if (this.tracks === undefined) {

track = t.selectedTrack,
i
i,
sanitize = (html) => {
const div = document.createElement('div');
div.innerHTML = html;
// Remove all `<script>` tags first
const scripts = div.getElementsByTagName('script');
let i = scripts.length;
while (i--) {
scripts[i].parentNode.removeChild(scripts[i]);
}
// Loop the elements and remove anything that contains value="javascript:" or an `on*` attribute
// (`onerror`, `onclick`, etc.)
const allElements = div.getElementsByTagName('*');
for (let i = 0, n = allElements.length; i < n; i++) {
const
attributesObj = allElements[i].attributes,
attributes = Array.prototype.slice.call(attributesObj)
;
for (let j = 0, total = attributes.length; j < total; j++) {
if (attributes[j].name.startsWith('on') || attributes[j].value.startsWith('javascript')) {
allElements[i].parentNode.removeChild(allElements[i]);
} else if (attributes[j].name === 'style') {
allElements[i].removeAttribute(attributes[j].name);
}
}
}
return div.innerHTML;
}
;

@@ -578,4 +631,4 @@

// Set the line before the timecode as a class so the cue can be targeted if needed
t.captionsText.html(track.entries[i].text)
.attr('class', `${t.options.classPrefix}captions-text ${(track.entries[i].identifier || '')}`);
t.captionsText.html(sanitize(track.entries[i].text))
.attr('class', `${t.options.classPrefix}captions-text ${(track.entries[i].identifier || '')}`);
t.captions.show().height(0);

@@ -595,3 +648,3 @@ return; // exit out if one is visible;

*/
setupSlides: function (track) {
setupSlides: function (track) {
let t = this;

@@ -609,3 +662,3 @@

*/
showSlide: function (index) {
showSlide: function (index) {
if (this.tracks === undefined || this.slidesContainer === undefined) {

@@ -624,10 +677,10 @@ return;

t.slides.entries[index].imgs = img = $(`<img src="${url}">`)
.on('load', () => {
img.appendTo(t.slidesContainer)
.hide()
.fadeIn()
.siblings(':visible')
.fadeOut();
.on('load', () => {
img.appendTo(t.slidesContainer)
.hide()
.fadeIn()
.siblings(':visible')
.fadeOut();
});
});

@@ -638,4 +691,4 @@ } else {

img.fadeIn()
.siblings(':visible')
.fadeOut();
.siblings(':visible')
.fadeOut();
}

@@ -649,3 +702,3 @@ }

*/
displaySlides: function () {
displaySlides: function () {

@@ -670,64 +723,32 @@ if (this.slides === undefined) {

*
*/
displayChapters: function () {
let t = this;
for (let i = 0, total = t.tracks.length; i < total; i++) {
if (t.tracks[i].kind === 'chapters' && t.tracks[i].isLoaded) {
t.drawChapters(t.tracks[i]);
t.hasChapters = true;
break;
}
}
},
/**
*
* @param {Object} chapters
*/
drawChapters: function (chapters) {
drawChapters: function (chapters) {
let
t = this,
i,
dur,
percent = 0,
usedPercent = 0,
total = chapters.entries.length
;
t.chapters.empty();
if (!total) {
return;
}
t.chaptersButton.find('ul').empty();
for (i = 0; i < total; i++) {
dur = chapters.entries[i].stop - chapters.entries[i].start;
percent = Math.floor(dur / t.media.duration * 100);
// too large or not going to fill it in
if (percent + usedPercent > 100 ||
i === chapters.entries.length - 1 && percent + usedPercent < 100) {
percent = 100 - usedPercent;
}
t.chapters.append($(
`<div class="${t.options.classPrefix}chapter" rel="${chapters.entries[i].start}" style="left: ${usedPercent.toString()}%; width: ${percent.toString()}%;">` +
`<div class="${t.options.classPrefix}chapter-block` +
`${(i === chapters.entries.length - 1) ? ` ${t.options.classPrefix}chapter-block-last` : ''}">` +
`<span class="ch-title">${chapters.entries[i].text}</span>` +
`<span class="ch-time">` +
`${secondsToTimeCode(chapters.entries[i].start, t.options.alwaysShowHours)}` +
`&ndash;` +
`${secondsToTimeCode(chapters.entries[i].stop, t.options.alwaysShowHours)}` +
`</span>` +
`</div>` +
`</div>`));
usedPercent += percent;
t.chaptersButton.find('ul').append($(`<li class="${t.options.classPrefix}chapters-selector-list-item" ` +
`role="menuitemcheckbox" aria-live="polite" aria-disabled="false" aria-checked="false">` +
`<input type="radio" class="${t.options.classPrefix}captions-selector-input"` +
`name="${t.id}_chapters" value="${chapters.entries[i].start}" disabled>` +
`<label class="${t.options.classPrefix}chapters-selector-label">${chapters.entries[i].text}</label>` +
`</li>`));
}
t.chapters.find(`.${t.options.classPrefix}chapter`).click(function() {
t.media.setCurrentTime(parseFloat($(this).attr('rel')));
if (t.media.paused) {
t.media.play();
}
$.each(t.chaptersButton.find('input[type="radio"]'), function() {
$(this).prop({
disabled: false,
checked: false
});
});
t.chapters.show();
},

@@ -741,3 +762,3 @@ /**

*/
searchTrackPosition: function (tracks, currentTime) {
searchTrackPosition: function (tracks, currentTime) {
let

@@ -863,3 +884,3 @@ lo = 0,

*/
parse: function (trackText) {
parse: function (trackText) {
let

@@ -908,3 +929,3 @@ i = 0,

*/
parse: function (trackText) {
parse: function (trackText) {
trackText = $(trackText).filter('tt');

@@ -918,3 +939,3 @@ let

i
;
;

@@ -941,3 +962,3 @@

}
;
;

@@ -981,3 +1002,3 @@ if (lines.eq(i).attr('begin')) {

*/
split2: function (text, regex) {
split2: function (text, regex) {
// normal version for compliant browsers

@@ -1008,4 +1029,2 @@ // see below for IE fix

};
}
}

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

"mejs.captions-subtitles": "Llegendes/Subtítols",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Ningú",

@@ -53,0 +54,0 @@

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

"mejs.captions-subtitles": "Titulky",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Žádný",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Überschriften/Untertitel",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Keine",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Captions/Subtitles",
"mejs.captions-chapters": "Chapters",
"mejs.none": "None",

@@ -52,0 +53,0 @@

@@ -52,2 +52,3 @@ /*!

"mejs.captions-subtitles": "Leyendas/Subtítulos",
"mejs.captions-chapters": "Capítulos",
"mejs.none": "Ninguno",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Sous-titres",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Aucun",

@@ -55,0 +56,0 @@

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

"mejs.captions-subtitles": "Opisi/Prijevodi",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Ništa",

@@ -53,0 +54,0 @@

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

"mejs.captions-subtitles": "Képaláírás/Feliratok",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Nincs",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Acquisizioni/sottotitoli",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Nessuno",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "キャプション/字幕",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "なし",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "캡션/자막",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "없음",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Bijschriften/ondertiteling",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Geen",

@@ -55,0 +56,0 @@

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

"mejs.captions-subtitles": "Podpisy/napisy",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Brak",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Legendas",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Sem legendas",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Legendas",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Nenhum",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Legende/Subtitrări",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Niciunul",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Титры/Субтитры",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Нет",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "Skryté titulky/Titulky",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "Žiadne",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "字幕/标题",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "无",

@@ -54,0 +55,0 @@

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

"mejs.captions-subtitles": "字幕/標題",
// "mejs.captions-chapters": "Chapters",
"mejs.none": "沒有",

@@ -54,0 +55,0 @@

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

IS_IOS,
HAS_TOUCH,
HAS_MS_NATIVE_FULLSCREEN,

@@ -22,2 +21,3 @@ HAS_TRUE_NATIVE_FULLSCREEN

import {isNodeAfter} from './utils/dom';
import {getTypeFromFile} from './utils/media';

@@ -697,3 +697,3 @@ mejs.mepIndex = 0;

if (HAS_TOUCH && !t.options.alwaysShowControls) {
if ((IS_ANDROID || IS_IOS) && !t.options.alwaysShowControls) {

@@ -1267,3 +1267,5 @@ // for touch devices (iOS, Android)

t.rail.siblings().each((index, object) => {
siblingsWidth += parseFloat($(object).outerWidth(true));
if ($(object).is(':visible')) {
siblingsWidth += parseFloat($(object).outerWidth(true));
}
});

@@ -1617,2 +1619,10 @@

// Stop completely media playing
if (!t.media.paused) {
t.media.pause();
}
const src = t.media.originalNode.getAttribute('src');
t.media.setSrc('');
// invoke features cleanup

@@ -1644,2 +1654,10 @@ for (let featureIndex in t.options.features) {

t.$node.attr('id', t.$node.attr('id').replace('_from_mejs', ''));
// Remove `autoplay` (not worth bringing it back once player is destroyed)
t.$node.removeProp('autoplay');
// Reintegrate file if it can be played
if (t.media.canPlayType(getTypeFromFile(src))) {
t.$node.attr('src', src);
}
t.$node.clone().insertBefore(t.container).show();

@@ -1664,2 +1682,3 @@ t.$node.remove();

t.globalUnbind();
delete t.node.player;

@@ -1666,0 +1685,0 @@ }

@@ -50,30 +50,30 @@ 'use strict';

loadScript: (settings) => {
if (!NativeDash.isScriptLoaded) {
if (typeof dashjs !== 'undefined') {
NativeDash.createInstance(settings);
} else {
// Skip script loading since it is already loaded
if (typeof dashjs !== 'undefined') {
NativeDash.createInstance(settings);
} else if (!NativeDash.isScriptLoaded) {
settings.options.path = typeof settings.options.path === 'string' ?
settings.options.path : '//cdn.dashjs.org/latest/dash.mediaplayer.min.js';
settings.options.path = typeof settings.options.path === 'string' ?
settings.options.path : '//cdn.dashjs.org/latest/dash.mediaplayer.min.js';
let
script = document.createElement('script'),
firstScriptTag = document.getElementsByTagName('script')[0],
done = false;
let
script = document.createElement('script'),
firstScriptTag = document.getElementsByTagName('script')[0],
done = false;
script.src = settings.options.path;
script.src = settings.options.path;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === undefined ||
this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true;
NativeDash.mediaReady();
script.onload = script.onreadystatechange = null;
}
};
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === undefined ||
this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true;
NativeDash.mediaReady();
script.onload = script.onreadystatechange = null;
}
};
firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
}
firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
NativeDash.isScriptLoaded = true;

@@ -80,0 +80,0 @@ }

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

import {createEvent} from '../utils/dom';
import {NAV, IS_IE, HAS_MSE, SUPPORTS_NATIVE_HLS} from '../utils/constants';
import {NAV, IS_IE, IS_EDGE, HAS_MSE, SUPPORTS_NATIVE_HLS} from '../utils/constants';
import {typeChecks, absolutizeUrl} from '../utils/media';

@@ -76,4 +76,4 @@

// Firefox, Webkit, Opera
if (NAV.plugins !== undefined && typeof NAV.plugins[pluginName] === 'object') {
// Firefox, Webkit, Opera; avoid MS Edge since `plugins` cannot be accessed
if (!IS_EDGE && NAV.plugins !== null && NAV.plugins !== undefined && typeof NAV.plugins[pluginName] === 'object') {
description = NAV.plugins[pluginName].description;

@@ -246,2 +246,10 @@ if (description && !(typeof NAV.mimeTypes !== 'undefined' && NAV.mimeTypes[mimeType] && !NAV.mimeTypes[mimeType].enabledPlugin)) {

// give initial events like in others renderers
let initEvents = ['rendererready', 'loadeddata', 'loadedmetadata', 'canplay'];
for (i = 0, il = initEvents.length; i < il; i++) {
let event = createEvent(initEvents[i], flash);
mediaElement.dispatchEvent(event);
}
// add a ready method that Flash can call to

@@ -253,5 +261,2 @@ window[`__ready__${flash.id}`] = () => {

let event = createEvent('rendererready', flash);
mediaElement.dispatchEvent(event);
// do call stack

@@ -296,2 +301,6 @@ if (flash.flashApiStack.length) {

if (!!mediaElement.originalNode.currentSrc.length) {
flashVars.push(`src=${mediaElement.originalNode.currentSrc}`);
}
if (flash.options.enablePseudoStreaming === true) {

@@ -406,3 +415,2 @@ flashVars.push(`pseudostreamstart=${flash.options.pseudoStreamingStartQueryParam}`);

flash.setSrc(mediaFiles[i].src);
flash.load();
break;

@@ -444,2 +452,3 @@ }

}
});

@@ -446,0 +455,0 @@

@@ -54,30 +54,29 @@ 'use strict';

loadScript: (settings) => {
if (!NativeFlv.isMediaStarted) {
if (typeof flvjs !== 'undefined') {
NativeFlv.createInstance(settings);
} else {
// Skip script loading since it is already loaded
if (typeof flvjs !== 'undefined') {
NativeFlv.createInstance(settings);
} else if (!NativeFlv.isMediaStarted) {
settings.options.path = typeof settings.options.path === 'string' ?
settings.options.path : '//cdnjs.cloudflare.com/ajax/libs/flv.js/1.1.0/flv.min.js';
settings.options.path = typeof settings.options.path === 'string' ?
settings.options.path : '//cdnjs.cloudflare.com/ajax/libs/flv.js/1.1.0/flv.min.js';
let
script = document.createElement('script'),
firstScriptTag = document.getElementsByTagName('script')[0],
done = false;
let
script = document.createElement('script'),
firstScriptTag = document.getElementsByTagName('script')[0],
done = false;
script.src = settings.options.path;
script.src = settings.options.path;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === undefined ||
this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true;
NativeFlv.mediaReady();
script.onload = script.onreadystatechange = null;
}
};
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function () {
if (!done && (!this.readyState || this.readyState === undefined ||
this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true;
NativeFlv.mediaReady();
script.onload = script.onreadystatechange = null;
}
};
firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
}
firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
NativeFlv.isMediaStarted = true;

@@ -169,3 +168,3 @@ }

il
;
;

@@ -181,3 +180,3 @@ node = originalNode.cloneNode(true);

node[`get${capName}`] = () => flvPlayer !== null ? node[propName] : null;
node[`get${capName}`] = () => flvPlayer !== null ? node[propName] : null;

@@ -202,3 +201,3 @@ node[`set${capName}`] = (value) => {

}
;
;

@@ -254,3 +253,3 @@ for (i = 0, il = props.length; i < il; i++) {

}
;
;

@@ -257,0 +256,0 @@ events = events.concat(['click', 'mouseover', 'mouseout']);

@@ -54,30 +54,29 @@ 'use strict';

loadScript: (settings) => {
if (!NativeHls.isMediaStarted) {
if (typeof Hls !== 'undefined') {
NativeHls.createInstance(settings);
} else {
// Skip script loading since it is already loaded
if (typeof Hls !== 'undefined') {
NativeHls.createInstance(settings);
} else if (!NativeHls.isMediaStarted) {
settings.options.path = typeof settings.options.path === 'string' ?
settings.options.path : '//cdn.jsdelivr.net/hls.js/latest/hls.min.js';
settings.options.path = typeof settings.options.path === 'string' ?
settings.options.path : '//cdn.jsdelivr.net/hls.js/latest/hls.min.js';
let
script = document.createElement('script'),
firstScriptTag = document.getElementsByTagName('script')[0],
done = false;
let
script = document.createElement('script'),
firstScriptTag = document.getElementsByTagName('script')[0],
done = false;
script.src = settings.options.path;
script.src = settings.options.path;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState === undefined ||
this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true;
NativeHls.mediaReady();
script.onload = script.onreadystatechange = null;
}
};
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function () {
if (!done && (!this.readyState || this.readyState === undefined ||
this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true;
NativeHls.mediaReady();
script.onload = script.onreadystatechange = null;
}
};
firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
}
firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
NativeHls.isMediaStarted = true;

@@ -196,3 +195,3 @@ }

il
;
;

@@ -208,3 +207,3 @@ node = originalNode.cloneNode(true);

node[`get${capName}`] = () => hlsPlayer !== null ? node[propName] : null;
node[`get${capName}`] = () => hlsPlayer !== null ? node[propName] : null;

@@ -238,3 +237,3 @@ node[`set${capName}`] = (value) => {

}
;
;

@@ -295,3 +294,3 @@ for (i = 0, il = props.length; i < il; i++) {

}
;
;

@@ -298,0 +297,0 @@ events = events.concat(['click', 'mouseover', 'mouseout']);

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

export const IS_IE = (NAV.appName.toLowerCase().includes('microsoft') || NAV.appName.toLowerCase().match(/trident/gi) !== null);
export const IS_EDGE = ('msLaunchUri' in NAV && !('documentMode' in document));
export const IS_CHROME = (UA.match(/chrome/gi) !== null);

@@ -21,3 +22,2 @@ export const IS_FIREFOX = (UA.match(/firefox/gi) !== null);

export const HAS_TOUCH = !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch);
export const HAS_MSE = ('MediaSource' in window);

@@ -157,2 +157,3 @@ export const SUPPORT_POINTER_EVENTS = (() => {

mejs.Features.isIE = IS_IE;
mejs.Features.isEdge = IS_EDGE;
mejs.Features.isChrome = IS_CHROME;

@@ -162,3 +163,2 @@ mejs.Features.isFirefox = IS_FIREFOX;

mejs.Features.isStockAndroid = IS_STOCK_ANDROID;
mejs.Features.hasTouch = HAS_TOUCH;
mejs.Features.hasMSE = HAS_MSE;

@@ -165,0 +165,0 @@ mejs.Features.supportsMediaTag = SUPPORTS_MEDIA_TAG;

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

setMedia = function(player, src) {
player.pause();
player.setSrc(src.replace('&amp;', '&'));

@@ -13,0 +14,0 @@ player.load();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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

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