bigscreen-player
Advanced tools
Comparing version 2.7.1 to 2.8.0
{ | ||
"name": "bigscreen-player", | ||
"version": "2.7.1", | ||
"version": "2.8.0", | ||
"description": "Simplified media playback for bigscreen devices.", | ||
@@ -5,0 +5,0 @@ "main": "script/bigscreenplayer.js", |
@@ -16,3 +16,2 @@ require( | ||
var mockDevice; | ||
var mockLogger = 'logger'; | ||
var mockConfig = 'config'; | ||
@@ -38,6 +37,2 @@ | ||
mockDevice.getLogger.and.returnValue( | ||
mockLogger | ||
); | ||
mockDevice.getConfig.and.returnValue( | ||
@@ -67,3 +62,3 @@ mockConfig | ||
expect(html5player).toHaveBeenCalledWith(mockLogger); | ||
expect(html5player).toHaveBeenCalledWith(mockConfig); | ||
@@ -77,3 +72,3 @@ expect(mockLegacyAdapter).toHaveBeenCalledWith(windowType, mediaKind, timeData, playbackElement, isUHD, mockConfig, mediaPlayer); | ||
expect(html5player).toHaveBeenCalledWith(mockLogger); | ||
expect(html5player).toHaveBeenCalledWith(mockConfig); | ||
expect(livePlayer).toHaveBeenCalledWith(mediaPlayer, mockConfig, WindowTypes.GROWING, timeData); | ||
@@ -88,3 +83,3 @@ | ||
expect(html5player).toHaveBeenCalledWith(mockLogger); | ||
expect(html5player).toHaveBeenCalledWith(mockConfig); | ||
expect(livePlayer).toHaveBeenCalledWith(mediaPlayer, mockConfig, WindowTypes.SLIDING, timeData); | ||
@@ -91,0 +86,0 @@ |
@@ -38,3 +38,4 @@ define('bigscreenplayer/playbackstrategy/legacyplayeradapter', | ||
var setSourceOpts = { | ||
disableSentinels: !!isUHD && windowType !== WindowTypes.STATIC && config.streaming && config.streaming.liveUhdDisableSentinels | ||
disableSentinels: !!isUHD && windowType !== WindowTypes.STATIC && config.streaming && config.streaming.liveUhdDisableSentinels, | ||
disableSeekSentinel: window.bigscreenPlayer.disableSeekSentinel | ||
}; | ||
@@ -118,7 +119,28 @@ | ||
function onSeekAttempted (event) { | ||
showCurtain(); | ||
if (requiresLiveCurtain()) { | ||
var doNotForceBeginPlaybackToEndOfWindow = { | ||
forceBeginPlaybackToEndOfWindow: false | ||
}; | ||
var streaming = config.streaming || { | ||
overrides: doNotForceBeginPlaybackToEndOfWindow | ||
}; | ||
var overrides = streaming.overrides || doNotForceBeginPlaybackToEndOfWindow; | ||
var shouldShowCurtain = windowType !== WindowTypes.STATIC && (hasStartTime || overrides.forceBeginPlaybackToEndOfWindow); | ||
if (shouldShowCurtain) { | ||
liveGlitchCurtain = new LiveGlitchCurtain(playbackElement); | ||
liveGlitchCurtain.showCurtain(); | ||
} | ||
} | ||
} | ||
function onSeekFinished (event) { | ||
hideCurtain(); | ||
if (requiresLiveCurtain()) { | ||
if (liveGlitchCurtain) { | ||
liveGlitchCurtain.hideCurtain(); | ||
} | ||
} | ||
} | ||
@@ -197,27 +219,6 @@ | ||
function showCurtain () { | ||
var doNotForceBeginPlaybackToEndOfWindow = { | ||
forceBeginPlaybackToEndOfWindow: false | ||
}; | ||
var streaming = config.streaming || { | ||
overrides: doNotForceBeginPlaybackToEndOfWindow | ||
}; | ||
var overrides = streaming.overrides || doNotForceBeginPlaybackToEndOfWindow; | ||
var shouldShowCurtain = windowType !== WindowTypes.STATIC && (hasStartTime || overrides.forceBeginPlaybackToEndOfWindow); | ||
if (shouldShowCurtain) { | ||
liveGlitchCurtain = new LiveGlitchCurtain(playbackElement); | ||
liveGlitchCurtain.showCurtain(); | ||
} | ||
function requiresLiveCurtain () { | ||
return !!window.bigscreenPlayer.showLiveCurtain; | ||
} | ||
function hideCurtain () { | ||
if (liveGlitchCurtain) { | ||
liveGlitchCurtain.hideCurtain(); | ||
} | ||
} | ||
function reset () { | ||
@@ -224,0 +225,0 @@ if (transitions.canBeStopped()) { |
@@ -9,3 +9,3 @@ define( | ||
function Player (logger) { | ||
function Player (deviceConfig) { | ||
var eventCallback; | ||
@@ -29,4 +29,9 @@ var eventCallbacks = []; | ||
var targetSeekTime; | ||
var seekFinished; | ||
var count; | ||
var timeoutHappened; | ||
var disableSentinels; | ||
var disableSeekSentinel; | ||
var hasSentinelTimeChangedWithinTolerance; | ||
@@ -204,3 +209,3 @@ var enterBufferingSentinelAttemptCount; | ||
function shouldBeSeekedSentinel () { | ||
if (sentinelSeekTime === undefined) { | ||
if (sentinelSeekTime === undefined || disableSeekSentinel) { | ||
return false; | ||
@@ -300,3 +305,2 @@ } | ||
function reportError (errorMessage) { | ||
logger.error(errorMessage); | ||
emitEvent(MediaPlayerBase.EVENT.ERROR); | ||
@@ -354,4 +358,2 @@ } | ||
}; | ||
} else { | ||
logger.warn('No \'duration\' or \'seekable\' on media element'); | ||
} | ||
@@ -400,2 +402,38 @@ } | ||
function emitSeekAttempted () { | ||
if (getState() === MediaPlayerBase.STATE.EMPTY) { | ||
emitEvent(MediaPlayerBase.EVENT.SEEK_ATTEMPTED); | ||
seekFinished = false; | ||
} | ||
count = 0; | ||
timeoutHappened = false; | ||
if (deviceConfig.restartTimeout) { | ||
setTimeout(function () { | ||
timeoutHappened = true; | ||
}, deviceConfig.restartTimeout); | ||
} else { | ||
timeoutHappened = true; | ||
} | ||
} | ||
function emitSeekFinishedAtCorrectStartingPoint () { | ||
var isAtCorrectStartingPoint = Math.abs(getCurrentTime() - sentinelSeekTime) <= seekSentinelTolerance; | ||
if (sentinelSeekTime === undefined) { | ||
isAtCorrectStartingPoint = true; | ||
} | ||
var isPlayingAtCorrectTime = getState() === MediaPlayerBase.STATE.PLAYING && isAtCorrectStartingPoint; | ||
if (isPlayingAtCorrectTime && count >= 5 && timeoutHappened && !seekFinished) { | ||
emitEvent(MediaPlayerBase.EVENT.SEEK_FINISHED); | ||
seekFinished = true; | ||
} else if (isPlayingAtCorrectTime) { | ||
count++; | ||
} else { | ||
count = 0; | ||
} | ||
} | ||
function onStatus () { | ||
@@ -405,2 +443,4 @@ if (getState() === MediaPlayerBase.STATE.PLAYING) { | ||
} | ||
emitSeekFinishedAtCorrectStartingPoint(); | ||
} | ||
@@ -527,8 +567,3 @@ | ||
function getClampedTimeForPlayFrom (seconds) { | ||
var clampedTime = getClampedTime(seconds); | ||
var range = getSeekableRange(); | ||
if (clampedTime !== seconds) { | ||
logger.debug('play From ' + seconds + ' clamped to ' + clampedTime + ' - seekable range is { start: ' + range.start + ', end: ' + range.end + ' }'); | ||
} | ||
return clampedTime; | ||
return getClampedTime(seconds); | ||
} | ||
@@ -609,2 +644,3 @@ | ||
disableSentinels = opts.disableSentinels; | ||
disableSeekSentinel = opts.disableSeekSentinel; | ||
mediaType = type; | ||
@@ -615,2 +651,4 @@ source = url; | ||
emitSeekAttempted(); | ||
if (getState() === MediaPlayerBase.STATE.EMPTY) { | ||
@@ -844,3 +882,2 @@ var idSuffix = 'Video'; | ||
toPlaying: toPlaying | ||
}; | ||
@@ -847,0 +884,0 @@ } |
@@ -6,6 +6,5 @@ define( | ||
'bigscreenplayer/models/windowtypes', | ||
'bigscreenplayer/dynamicwindowutils', | ||
'bigscreenplayer/debugger/debugtool' | ||
'bigscreenplayer/dynamicwindowutils' | ||
], | ||
function (MediaPlayerBase, WindowTypes, DynamicWindowUtils, DebugTool) { | ||
function (MediaPlayerBase, WindowTypes, DynamicWindowUtils) { | ||
'use strict'; | ||
@@ -12,0 +11,0 @@ |
@@ -11,6 +11,5 @@ define('bigscreenplayer/playbackstrategy/nativestrategy', | ||
var mediaPlayer; | ||
var logger = device.getLogger(); | ||
var tempConfig = device.getConfig(); | ||
mediaPlayer = Html5Player(logger); | ||
mediaPlayer = Html5Player(tempConfig); | ||
if (windowType !== WindowTypes.STATIC) { | ||
@@ -17,0 +16,0 @@ mediaPlayer = LivePlayer(mediaPlayer, tempConfig, windowType, timeData); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73148
7633022