Socket
Socket
Sign inDemoInstall

bigscreen-player

Package Overview
Dependencies
Maintainers
3
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bigscreen-player - npm Package Compare versions

Comparing version 2.12.0 to 3.0.0

docs/example-app/package-lock.json

2

package.json
{
"name": "bigscreen-player",
"version": "2.12.0",
"version": "3.0.0",
"description": "Simplified media playback for bigscreen devices.",

@@ -5,0 +5,0 @@ "main": "script/bigscreenplayer.js",

@@ -223,3 +223,2 @@ require(

stateType: PluginEnums.TYPE.ERROR,
properties: {error_mssg: 'test error'},
isBufferingTimeoutError: true,

@@ -226,0 +225,0 @@ cdn: 'supplier1',

@@ -143,13 +143,5 @@ require(

it('should fire error cleared on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'device'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -161,6 +153,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -370,15 +358,6 @@

describe('on playing', function () {
// playout logic
it('should fire error cleared on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'device'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -390,6 +369,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -402,3 +377,2 @@

// playout logic
it('should clear error timeout', function () {

@@ -422,3 +396,2 @@ jasmine.clock().install();

// playout logic
it('should clear fatal error timeout', function () {

@@ -443,17 +416,9 @@ jasmine.clock().install();

// playout logic
it('should fire buffering cleared on the plugins', function () {
var bufferingProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'device'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.BUFFERING,
properties: bufferingProperties,
isBufferingTimeoutError: false,
cdn: undefined,
newCdn: undefined,
isInitialPlay: true,

@@ -463,6 +428,2 @@ timeStamp: jasmine.any(Object)

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -493,3 +454,2 @@

// playout logic
it('should clear error timeout', function () {

@@ -514,3 +474,2 @@ jasmine.clock().install();

// playout logic
it('should clear fatal error timeout', function () {

@@ -535,15 +494,6 @@ jasmine.clock().install();

// playout logic
it('should fire error cleared on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'device'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -555,6 +505,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -567,15 +513,6 @@

// playout logic
it('should fire buffering cleared on the plugins', function () {
var bufferingProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'device'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.BUFFERING,
properties: bufferingProperties,
isBufferingTimeoutError: false,

@@ -587,6 +524,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -612,13 +545,5 @@

var bufferingProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'timeout'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.BUFFERING,
properties: bufferingProperties,
isBufferingTimeoutError: false,

@@ -630,6 +555,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -647,13 +568,5 @@

it('should fire error cleared on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'device'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -665,6 +578,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -678,12 +587,5 @@

it('should fire on buffering on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100
};
var pluginData = {
status: PluginEnums.STATUS.STARTED,
stateType: PluginEnums.TYPE.BUFFERING,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -695,6 +597,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -709,3 +607,2 @@

describe('on ended', function () {
// playout logic
it('should clear error timeout', function () {

@@ -730,3 +627,2 @@ jasmine.clock().install();

// playout logic
it('should clear fatal error timeout', function () {

@@ -751,15 +647,6 @@ jasmine.clock().install();

// playout logic
it('should fire error cleared on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'device'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -771,6 +658,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -783,15 +666,6 @@

// playout logic
it('should fire buffering cleared on the plugins', function () {
var bufferingProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'device'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.BUFFERING,
properties: bufferingProperties,
isBufferingTimeoutError: false,

@@ -803,6 +677,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -836,13 +706,5 @@

it('should fire buffering cleared on the plugins', function () {
var bufferingProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'error'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.BUFFERING,
properties: bufferingProperties,
isBufferingTimeoutError: false,

@@ -854,6 +716,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -899,13 +757,5 @@

it('should fire on error on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
code: '2110'
};
var pluginData = {
status: PluginEnums.STATUS.STARTED,
stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -917,6 +767,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
setUpPlayerComponent();

@@ -932,3 +778,2 @@

describe('cdn failover', function () {
var errorProperties;
var fatalErrorPluginData;

@@ -942,8 +787,2 @@ var currentTime;

jasmine.clock().install();
errorProperties = {
seekable_range: '0 to 100',
current_time: 50,
duration: 100,
error_mssg: 'Fatal error'
};

@@ -953,3 +792,2 @@ fatalErrorPluginData = {

stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -1067,3 +905,2 @@ cdn: undefined,

// playout logic
it('should clear buffering timeout error timeout', function () {

@@ -1084,3 +921,2 @@ setUpPlayerComponent();

// playout logic
it('should clear fatal error timeout', function () {

@@ -1099,15 +935,6 @@ setUpPlayerComponent();

// playout logic
it('should fire error cleared on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 50,
duration: 100,
dismissed_by: 'teardown'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -1128,15 +955,6 @@ cdn: undefined,

// playout logic
it('should fire buffering cleared on the plugins', function () {
var bufferingProperties = {
seekable_range: '0 to 100',
current_time: 50,
duration: 100,
dismissed_by: 'teardown'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.BUFFERING,
properties: bufferingProperties,
isBufferingTimeoutError: false,

@@ -1169,3 +987,2 @@ cdn: undefined,

// playout logic
it('should clear error timeout', function () {

@@ -1190,3 +1007,2 @@ jasmine.clock().install();

// playout logic
it('should clear fatal error timeout', function () {

@@ -1211,15 +1027,6 @@ jasmine.clock().install();

// playout logic
it('should fire error cleared on the plugins', function () {
var errorProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'teardown'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.ERROR,
properties: errorProperties,
isBufferingTimeoutError: false,

@@ -1233,6 +1040,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
playerComponent.tearDown();

@@ -1243,15 +1046,6 @@

// playout logic
it('should fire buffering cleared on the plugins', function () {
var bufferingProperties = {
seekable_range: '0 to 100',
current_time: 10,
duration: 100,
dismissed_by: 'teardown'
};
var pluginData = {
status: PluginEnums.STATUS.DISMISSED,
stateType: PluginEnums.TYPE.BUFFERING,
properties: bufferingProperties,
isBufferingTimeoutError: false,

@@ -1265,6 +1059,2 @@ cdn: undefined,

spyOn(mockStrategy, 'getSeekableRange').and.returnValue({start: 0, end: 100});
spyOn(mockStrategy, 'getCurrentTime').and.returnValue(10);
spyOn(mockStrategy, 'getDuration').and.returnValue(100);
playerComponent.tearDown();

@@ -1271,0 +1061,0 @@

@@ -24,3 +24,2 @@ define(

var subtitlesEnabled;
var userInteracted = false;
var stateUpdateCallback = callback;

@@ -47,3 +46,3 @@ var playbackStrategy;

bubbleErrorCleared(createPlaybackProperties());
bubbleErrorCleared();

@@ -55,3 +54,2 @@ setSubtitlesEnabled(enableSubtitles || false);

function play () {
userInteracted = true;
playbackStrategy.play();

@@ -66,3 +64,2 @@ }

opts = opts || {};
userInteracted = true;
if (transitions().canBePaused()) {

@@ -126,3 +123,2 @@ var disableAutoResume = windowType === WindowTypes.GROWING ? true : opts.disableAutoResume;

function setCurrentTime (time) {
userInteracted = true;
if (transitions().canBeginSeek()) {

@@ -158,5 +154,5 @@ isNativeHLSRestartable() ? reloadMediaElement(time) : playbackStrategy.setCurrentTime(time);

var onError = function (errorMessage) {
var onError = function () {
tearDownMediaElement();
bubbleFatalError(createPlaybackErrorProperties(event), false);
bubbleFatalError(false);
};

@@ -172,5 +168,3 @@

function tearDownMediaElement () {
var playbackProperties = createPlaybackProperties();
playbackProperties.dismissed_by = 'teardown';
playout(playbackProperties);
clearTimeouts();
playbackStrategy.reset();

@@ -197,3 +191,3 @@ }

function onPlaying () {
playout(createPlaybackProperties());
clearTimeouts();
publishMediaStateUpdate(MediaState.PLAYING, {});

@@ -205,3 +199,3 @@ isInitialPlay = false;

publishMediaStateUpdate(MediaState.PAUSED);
playout(createPlaybackProperties());
clearTimeouts();
}

@@ -211,11 +205,9 @@

publishMediaStateUpdate(MediaState.WAITING);
var playbackProperties = createPlaybackProperties();
startBufferingErrorTimeout(playbackProperties);
bubbleErrorCleared(playbackProperties);
bubbleBufferingRaised(playbackProperties);
userInteracted = false;
startBufferingErrorTimeout();
bubbleErrorCleared();
bubbleBufferingRaised();
}
function onEnded () {
playout(createPlaybackProperties());
clearTimeouts();
publishMediaStateUpdate(MediaState.ENDED);

@@ -229,30 +221,23 @@ }

function onError (event) {
var playbackProperties = createPlaybackProperties();
playbackProperties.dismissed_by = 'error';
bubbleBufferingCleared(playbackProperties);
var playbackErrorProperties = createPlaybackErrorProperties(event);
raiseError(playbackErrorProperties);
bubbleBufferingCleared();
raiseError();
}
function startBufferingErrorTimeout (properties) {
function startBufferingErrorTimeout () {
var bufferingTimeout = isInitialPlay ? 30000 : 20000;
var bufferingClearedProperties = PlaybackUtils.clone(properties);
clearBufferingErrorTimeout();
errorTimeoutID = setTimeout(function () {
bufferingClearedProperties.dismissed_by = 'timeout';
bubbleBufferingCleared(bufferingClearedProperties);
properties.error_mssg = 'Buffering timed out';
attemptCdnFailover(properties, true);
bubbleBufferingCleared();
attemptCdnFailover(true);
}, bufferingTimeout);
}
function raiseError (properties) {
function raiseError () {
clearBufferingErrorTimeout();
publishMediaStateUpdate(MediaState.WAITING);
bubbleErrorRaised(properties);
startFatalErrorTimeout(properties);
bubbleErrorRaised();
startFatalErrorTimeout();
}
function startFatalErrorTimeout (errorProperties) {
function startFatalErrorTimeout () {
if (!fatalErrorTimeout && !fatalError) {

@@ -262,4 +247,3 @@ fatalErrorTimeout = setTimeout(function () {

fatalError = true;
errorProperties.error_mssg = 'Fatal error';
attemptCdnFailover(errorProperties, false);
attemptCdnFailover(false);
}, 5000);

@@ -269,3 +253,3 @@ }

function attemptCdnFailover (errorProperties, bufferingTimeoutError) {
function attemptCdnFailover (bufferingTimeoutError) {
var time = getCurrentTime();

@@ -275,3 +259,3 @@ var oldWindowStartTime = getWindowStartTime();

var failoverParams = {
errorMessage: errorProperties.error_mssg,
errorMessage: bufferingTimeoutError ? 'bufferingTimeoutError' : 'fatalError',
isBufferingTimeoutError: bufferingTimeoutError,

@@ -291,3 +275,3 @@ currentTime: getCurrentTime(),

var doErrorCallback = function () {
bubbleFatalError(errorProperties, bufferingTimeoutError);
bubbleFatalError(bufferingTimeoutError);
};

@@ -312,49 +296,32 @@

function playout (playbackProperties) {
function clearTimeouts () {
clearBufferingErrorTimeout();
clearFatalErrorTimeout();
fatalError = false;
bubbleBufferingCleared(playbackProperties);
bubbleErrorCleared(playbackProperties);
userInteracted = false;
bubbleBufferingCleared();
bubbleErrorCleared();
}
function bubbleErrorCleared (playbackProperties) {
var errorProperties = PlaybackUtils.clone(playbackProperties);
if (!errorProperties.dismissed_by) {
if (userInteracted) {
errorProperties.dismissed_by = 'other';
} else {
errorProperties.dismissed_by = 'device';
}
}
var evt = new PluginData({ status: PluginEnums.STATUS.DISMISSED, stateType: PluginEnums.TYPE.ERROR, properties: errorProperties });
function bubbleErrorCleared () {
var evt = new PluginData({ status: PluginEnums.STATUS.DISMISSED, stateType: PluginEnums.TYPE.ERROR });
Plugins.interface.onErrorCleared(evt);
}
function bubbleErrorRaised (errorProperties) {
var evt = new PluginData({ status: PluginEnums.STATUS.STARTED, stateType: PluginEnums.TYPE.ERROR, properties: errorProperties, isBufferingTimeoutError: false });
function bubbleErrorRaised () {
var evt = new PluginData({ status: PluginEnums.STATUS.STARTED, stateType: PluginEnums.TYPE.ERROR, isBufferingTimeoutError: false });
Plugins.interface.onError(evt);
}
function bubbleBufferingRaised (playbackProperties) {
var evt = new PluginData({ status: PluginEnums.STATUS.STARTED, stateType: PluginEnums.TYPE.BUFFERING, properties: playbackProperties });
function bubbleBufferingRaised () {
var evt = new PluginData({ status: PluginEnums.STATUS.STARTED, stateType: PluginEnums.TYPE.BUFFERING });
Plugins.interface.onBuffering(evt);
}
function bubbleBufferingCleared (playbackProperties) {
var bufferingProperties = PlaybackUtils.clone(playbackProperties);
if (!bufferingProperties.dismissed_by) {
if (userInteracted) {
bufferingProperties.dismissed_by = 'other';
} else {
bufferingProperties.dismissed_by = 'device';
}
}
var evt = new PluginData({ status: PluginEnums.STATUS.DISMISSED, stateType: PluginEnums.TYPE.BUFFERING, properties: bufferingProperties, isInitialPlay: isInitialPlay });
function bubbleBufferingCleared () {
var evt = new PluginData({ status: PluginEnums.STATUS.DISMISSED, stateType: PluginEnums.TYPE.BUFFERING, isInitialPlay: isInitialPlay });
Plugins.interface.onBufferingCleared(evt);
}
function bubbleFatalError (errorProperties, bufferingTimeoutError) {
var evt = new PluginData({ status: PluginEnums.STATUS.FATAL, stateType: PluginEnums.TYPE.ERROR, properties: errorProperties, isBufferingTimeoutError: bufferingTimeoutError });
function bubbleFatalError (bufferingTimeoutError) {
var evt = new PluginData({ status: PluginEnums.STATUS.FATAL, stateType: PluginEnums.TYPE.ERROR, isBufferingTimeoutError: bufferingTimeoutError });
Plugins.interface.onFatalError(evt);

@@ -364,16 +331,2 @@ publishMediaStateUpdate(MediaState.FATAL_ERROR, { isBufferingTimeoutError: bufferingTimeoutError });

function createPlaybackProperties () {
var playbackProperties = {};
playbackProperties.seekable_range = getSeekableRange().start + ' to ' + getSeekableRange().end;
playbackProperties.current_time = getCurrentTime();
playbackProperties.duration = getDuration();
return playbackProperties;
}
function createPlaybackErrorProperties (event) {
return PlaybackUtils.merge(createPlaybackProperties(), event.errorProperties);
}
function publishMediaStateUpdate (state, opts) {

@@ -410,3 +363,2 @@ var mediaData = {};

function tearDown () {
userInteracted = false;
tearDownMediaElement();

@@ -429,3 +381,2 @@

subtitlesEnabled = undefined;
userInteracted = undefined;
stateUpdateCallback = undefined;

@@ -432,0 +383,0 @@ mediaMetaData = undefined;

@@ -9,3 +9,2 @@ define(

this.stateType = args.stateType;
this.properties = args.properties || {};
this.isBufferingTimeoutError = args.isBufferingTimeoutError || false;

@@ -12,0 +11,0 @@ this.isInitialPlay = args.isInitialPlay;

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