Socket
Socket
Sign inDemoInstall

videojs-playlist-ui

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videojs-playlist-ui - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

27

dist/videojs-playlist-ui.js

@@ -1,2 +0,2 @@

/*! videojs-playlist-ui - v1.0.2 - 2015-06-25
/*! videojs-playlist-ui - v1.0.3 - 2015-08-03
* Copyright (c) 2015 Brightcove; Licensed Apache-2.0 */

@@ -75,14 +75,14 @@

videojs.PlaylistMenuItem = videojs.Component.extend({
init: function init(player, options) {
init: function init(player, playlistItem, settings) {
var _this = this;
if (!options.item) {
if (!playlistItem.item) {
throw new Error("Cannot construct a PlaylistMenuItem without an item option");
}
// stub out the element so Component doesn't construct one
options.el = true;
videojs.Component.call(this, player, options);
this.el_ = this.createEl(options.item);
playlistItem.el = true;
videojs.Component.call(this, player, playlistItem);
this.el_ = this.createEl(playlistItem.item);
this.item = options.item;
this.item = playlistItem.item;
this.emitTapEvents();

@@ -92,2 +92,5 @@

player.playlist.currentItem(indexOf(player.playlist(), _this.item));
if (settings.playOnSelect) {
player.play();
}
});

@@ -132,3 +135,3 @@ },

videojs.PlaylistMenu = videojs.Component.extend({
init: function init(player, options) {
init: function init(player, settings) {
var _this = this;

@@ -140,4 +143,2 @@

var settings = videojs.util.mergeOptions(defaults, options);
if (!settings.el) {

@@ -158,3 +159,3 @@ this.el_ = document.createElement("ol");

this.createPlaylist_();
this.createPlaylist_(settings);

@@ -178,3 +179,3 @@ if (!videojs.TOUCH_ENABLED) {

},
createPlaylist_: function createPlaylist_() {
createPlaylist_: function createPlaylist_(settings) {
var playlist = this.player_.playlist() || [];

@@ -196,3 +197,3 @@

item: playlist[i]
});
}, settings);
this.items.push(item);

@@ -199,0 +200,0 @@ this.addChild(item);

@@ -1,3 +0,3 @@

/*! videojs-playlist-ui - v1.0.2 - 2015-06-25
/*! videojs-playlist-ui - v1.0.3 - 2015-08-03
* Copyright (c) 2015 Brightcove; Licensed Apache-2.0 */
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},e=function(){var a=document.createElement("x");return a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents}(),f={className:"vjs-playlist",supportsCssPointerEvents:e},g=function(a){if(!a){var b=document.createElement("div");return b.className="vjs-playlist-thumbnail",b}var c=document.createElement("picture");if(c.className="vjs-playlist-thumbnail","string"==typeof a){var d=document.createElement("img");d.src=a,c.appendChild(d)}else{for(var e=0;e<a.length-1;e++){var f=a[e],g=document.createElement("source");for(var h in f)g[h]=f[h];c.appendChild(g)}var i=a[a.length-1],d=document.createElement("img");for(var h in i)d[h]=i[h];c.appendChild(d)}return c};videojs.PlaylistMenuItem=videojs.Component.extend({init:function(a,b){var c=this;if(!b.item)throw new Error("Cannot construct a PlaylistMenuItem without an item option");b.el=!0,videojs.Component.call(this,a,b),this.el_=this.createEl(b.item),this.item=b.item,this.emitTapEvents(),this.on(["click","tap"],function(b){a.playlist.currentItem(d(a.playlist(),c.item))})},createEl:function(a){var b=document.createElement("li");if(b.className="vjs-playlist-item",b.appendChild(g(a.thumbnail)),a.duration){var c=document.createElement("time"),d=videojs.formatTime(a.duration);c.className="vjs-playlist-duration",c.setAttribute("datetime","PT0H0M"+a.duration+"S"),c.appendChild(document.createTextNode(d)),b.appendChild(c)}var e=document.createElement("cite"),f=a.name||this.localize("Untitled Video");if(e.className="vjs-playlist-name",e.appendChild(document.createTextNode(f)),e.setAttribute("title",f),b.appendChild(e),a.description){var h=document.createElement("p");h.className="vjs-playlist-description",h.appendChild(document.createTextNode(a.description)),h.setAttribute("title",a.description),b.appendChild(h)}return b}}),videojs.PlaylistMenu=videojs.Component.extend({init:function(a,b){var c=this;if(!a.playlist)throw new Error("videojs-playlist is required for the playlist component");var d=videojs.util.mergeOptions(f,b);d.el||(this.el_=document.createElement("ol"),this.el_.className=d.className,d.el=this.el_),videojs.Component.call(this,a,d),d.supportsCssPointerEvents&&this.addClass("vjs-csspointerevents"),this.createPlaylist_(),videojs.TOUCH_ENABLED||this.addClass("vjs-mouse"),a.on(["loadstart","playlistchange"],function(a){c.update()}),a.on("adstart",function(){c.addClass("vjs-ad-playing")}),a.on("adend",function(){c.removeClass("vjs-ad-playing")})},createPlaylist_:function(){for(var a=this.player_.playlist()||[],b=0;b<this.items.length;b++)this.removeChild(this.items[b]);this.items.length=0;var c=this.el_.querySelector(".vjs-playlist-ad-overlay");c&&c.parentNode.removeChild(c);for(var b=0;b<a.length;b++){var d=new videojs.PlaylistMenuItem(this.player_,{item:a[b]});this.items.push(d),this.addChild(d)}c=document.createElement("li"),c.className="vjs-playlist-ad-overlay",this.el_.appendChild(c);var e=this.player_.playlist.currentItem();this.items.length&&e>=0&&this.items[e].addClass("vjs-selected")},items:[],update:function(){var a=this.player_.playlist();if(this.items.length!==a.length)return void this.createPlaylist_();for(var b=0;b<this.items.length;b++)if(this.items[b].item!==a[b])return void this.createPlaylist_();for(var c=this.player_.playlist.currentItem(),b=0;b<this.items.length;b++)b===c?this.items[b].addClass("vjs-selected"):this.items[b].removeClass("vjs-selected")}});var h=function(a){var b=this,c=void 0,d=void 0;if(!b.playlist)throw new Error("videojs-playlist is required for the playlist component");"undefined"!=typeof HTMLElement&&a instanceof HTMLElement||a&&1===a.nodeType?(d=a,c=videojs.util.mergeOptions(f)):(c=videojs.util.mergeOptions(f,a),d=document.querySelector("."+c.className)),c.el=d,b.playlistMenu=new videojs.PlaylistMenu(b,c)};videojs.plugin("playlistUi",h)},{}]},{},[1]);
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(){"use strict";var a=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},b=function(){var a=document.createElement("x");return a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents}(),c={className:"vjs-playlist",supportsCssPointerEvents:b},d=function(a){if(!a){var b=document.createElement("div");return b.className="vjs-playlist-thumbnail",b}var c=document.createElement("picture");if(c.className="vjs-playlist-thumbnail","string"==typeof a){var d=document.createElement("img");d.src=a,c.appendChild(d)}else{for(var e=0;e<a.length-1;e++){var f=a[e],g=document.createElement("source");for(var h in f)g[h]=f[h];c.appendChild(g)}var i=a[a.length-1],d=document.createElement("img");for(var h in i)d[h]=i[h];c.appendChild(d)}return c};videojs.PlaylistMenuItem=videojs.Component.extend({init:function(b,c,d){var e=this;if(!c.item)throw new Error("Cannot construct a PlaylistMenuItem without an item option");c.el=!0,videojs.Component.call(this,b,c),this.el_=this.createEl(c.item),this.item=c.item,this.emitTapEvents(),this.on(["click","tap"],function(){b.playlist.currentItem(a(b.playlist(),e.item)),d.playOnSelect&&b.play()})},createEl:function(a){var b=document.createElement("li");if(b.className="vjs-playlist-item",b.appendChild(d(a.thumbnail)),a.duration){var c=document.createElement("time"),e=videojs.formatTime(a.duration);c.className="vjs-playlist-duration",c.setAttribute("datetime","PT0H0M"+a.duration+"S"),c.appendChild(document.createTextNode(e)),b.appendChild(c)}var f=document.createElement("cite"),g=a.name||this.localize("Untitled Video");if(f.className="vjs-playlist-name",f.appendChild(document.createTextNode(g)),f.setAttribute("title",g),b.appendChild(f),a.description){var h=document.createElement("p");h.className="vjs-playlist-description",h.appendChild(document.createTextNode(a.description)),h.setAttribute("title",a.description),b.appendChild(h)}return b}}),videojs.PlaylistMenu=videojs.Component.extend({init:function(a,b){var c=this;if(!a.playlist)throw new Error("videojs-playlist is required for the playlist component");b.el||(this.el_=document.createElement("ol"),this.el_.className=b.className,b.el=this.el_),videojs.Component.call(this,a,b),b.supportsCssPointerEvents&&this.addClass("vjs-csspointerevents"),this.createPlaylist_(b),videojs.TOUCH_ENABLED||this.addClass("vjs-mouse"),a.on(["loadstart","playlistchange"],function(){c.update()}),a.on("adstart",function(){c.addClass("vjs-ad-playing")}),a.on("adend",function(){c.removeClass("vjs-ad-playing")})},createPlaylist_:function(a){for(var b=this.player_.playlist()||[],c=0;c<this.items.length;c++)this.removeChild(this.items[c]);this.items.length=0;var d=this.el_.querySelector(".vjs-playlist-ad-overlay");d&&d.parentNode.removeChild(d);for(var c=0;c<b.length;c++){var e=new videojs.PlaylistMenuItem(this.player_,{item:b[c]},a);this.items.push(e),this.addChild(e)}d=document.createElement("li"),d.className="vjs-playlist-ad-overlay",this.el_.appendChild(d);var f=this.player_.playlist.currentItem();this.items.length&&f>=0&&this.items[f].addClass("vjs-selected")},items:[],update:function(){var a=this.player_.playlist();if(this.items.length!==a.length)return void this.createPlaylist_();for(var b=0;b<this.items.length;b++)if(this.items[b].item!==a[b])return void this.createPlaylist_();for(var c=this.player_.playlist.currentItem(),b=0;b<this.items.length;b++)b===c?this.items[b].addClass("vjs-selected"):this.items[b].removeClass("vjs-selected")}});var e=function(a){var b=this,d=void 0,e=void 0;if(!b.playlist)throw new Error("videojs-playlist is required for the playlist component");"undefined"!=typeof HTMLElement&&a instanceof HTMLElement||a&&1===a.nodeType?(e=a,d=videojs.util.mergeOptions(c)):(d=videojs.util.mergeOptions(c,a),e=document.querySelector("."+d.className)),d.el=e,b.playlistMenu=new videojs.PlaylistMenu(b,d)};videojs.plugin("playlistUi",e)},{}]},{},[1]);

@@ -70,12 +70,12 @@ /*! videojs-playlist-ui - v0.0.0 - 2015-3-12

videojs.PlaylistMenuItem = videojs.Component.extend({
init: function(player, options) {
if (!options.item) {
init: function(player, playlistItem, settings) {
if (!playlistItem.item) {
throw new Error('Cannot construct a PlaylistMenuItem without an item option');
}
// stub out the element so Component doesn't construct one
options.el = true;
videojs.Component.call(this, player, options);
this.el_ = this.createEl(options.item);
playlistItem.el = true;
videojs.Component.call(this, player, playlistItem);
this.el_ = this.createEl(playlistItem.item);
this.item = options.item;
this.item = playlistItem.item;
this.emitTapEvents();

@@ -85,2 +85,5 @@

player.playlist.currentItem(indexOf(player.playlist(), this.item));
if (settings.playOnSelect) {
player.play();
}
});

@@ -125,3 +128,3 @@ },

videojs.PlaylistMenu = videojs.Component.extend({
init (player, options) {
init (player, settings) {
if (!player.playlist) {

@@ -131,4 +134,2 @@ throw new Error('videojs-playlist is required for the playlist component');

let settings = videojs.util.mergeOptions(defaults, options);
if (!settings.el) {

@@ -149,3 +150,3 @@ this.el_ = document.createElement('ol');

this.createPlaylist_();
this.createPlaylist_(settings);

@@ -169,3 +170,3 @@ if (!videojs.TOUCH_ENABLED) {

},
createPlaylist_() {
createPlaylist_(settings) {
const playlist = this.player_.playlist() || [];

@@ -187,3 +188,3 @@

item: playlist[i]
});
}, settings);
this.items.push(item);

@@ -190,0 +191,0 @@ this.addChild(item);

{
"name": "videojs-playlist-ui",
"version": "1.0.2",
"version": "1.0.3",
"author": "Brightcove",

@@ -5,0 +5,0 @@ "description": "A playlist video picker for video.js",

@@ -52,2 +52,8 @@ [![Build Status](https://travis-ci.org/brightcove/videojs-playlist-ui.svg?branch=master)](https://travis-ci.org/brightcove/videojs-playlist-ui)

#### playOnSelect
Type: `Boolean`
Default: false
The default behavior is that the play state is expected to stay the same between videos, if playing continue playing and if paused stay paused when playlist menu items are clicked. When this boolean is set to true, clicking on the playlist menu items will always play the video.
## Playlists and Advertisements

@@ -54,0 +60,0 @@

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