Release v2.10.6
This commit is contained in:
@@ -53,18 +53,34 @@ async function renderSlideAtIndex(sourceSlides, targetIndex, options) {
|
||||
|
||||
index = currentIndex;
|
||||
var markup = buildSlideMarkup(slide);
|
||||
renderSlideMarkup(markup, !(options && options.skipFade) && currentPlaylistFadeBetweenSlides);
|
||||
var shouldFade = !(options && options.skipFade) && currentPlaylistFadeBetweenSlides;
|
||||
var mediaDelayMs = slide && slide.use_video_duration ? 0 : undefined;
|
||||
renderSlideMarkup(markup, shouldFade, mediaDelayMs);
|
||||
if (typeof scheduleSlideMarkupPreload === 'function') {
|
||||
scheduleSlideMarkupPreload(availableSlides, currentIndex);
|
||||
}
|
||||
sendCommandState(slide);
|
||||
if (!isPaused) {
|
||||
scheduleSlideAdvance(getSlideHoldDelay(Math.max(1, Number(slide.duration_seconds || 10)) * 1000));
|
||||
scheduleSlideAdvance(getSlideAdvanceDelay(slide));
|
||||
}
|
||||
lastRenderedViewKey = getCurrentRenderKey(availableSlides);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Calculate the configured time from slide entry to the next transition.
|
||||
function getSlideAdvanceDelay(slide) {
|
||||
var durationMs = Math.max(1, Number(slide && slide.duration_seconds || 10)) * 1000;
|
||||
if (slide && slide.use_video_duration) {
|
||||
return currentPlaylistFadeBetweenSlides
|
||||
? getSlideHoldDelay(Math.max(1, durationMs - slideFadeLengthMs))
|
||||
: getSlideHoldDelay(durationMs);
|
||||
}
|
||||
if (currentPlaylistFadeBetweenSlides) {
|
||||
return getSlideHoldDelay(Math.max(1, durationMs - slideFadeOffsetMs));
|
||||
}
|
||||
return getSlideHoldDelay(durationMs);
|
||||
}
|
||||
|
||||
// Promote a deferred playlist update at the next safe point.
|
||||
function applyPendingPlaylistUpdate() {
|
||||
if (!pendingPlaylistUpdate) {
|
||||
@@ -167,11 +183,16 @@ function refresh(applyImmediately) {
|
||||
return;
|
||||
}
|
||||
if (request.status === 304) {
|
||||
if (!initialData || !Array.isArray(initialData.apiSources) || !Array.isArray(initialData.weatherLocations)) {
|
||||
currentPlaylistEtag = '';
|
||||
refresh(applyImmediately);
|
||||
return;
|
||||
}
|
||||
logDebug('Playlist refresh completed with no changes.');
|
||||
markRefreshHealthy();
|
||||
setOfflineBannerVisible(false);
|
||||
if (lastRenderedSlide && getCurrentActiveSlides().length < 2) {
|
||||
scheduleSlideAdvance(getSlideHoldDelay(Math.max(1, Number(lastRenderedSlide.duration_seconds || 10)) * 1000));
|
||||
scheduleSlideAdvance(getSlideAdvanceDelay(lastRenderedSlide));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -198,6 +219,7 @@ function refresh(applyImmediately) {
|
||||
const nextActiveSlides = getActiveSlidesFrom(nextSlides);
|
||||
const nextFadeBetweenSlides = Boolean(data && data.playlist && data.playlist.fade_between_slides);
|
||||
const nextSkipUnavailableRtmp = Boolean(data && data.playlist && data.playlist.skip_unavailable_rtmp);
|
||||
const hadSourceData = !(typeof window !== 'undefined' && window.initialData === null);
|
||||
var refreshedInitialData = Object.assign({},
|
||||
typeof initialData !== 'undefined' && initialData ? initialData : (window.initialData || {}), {
|
||||
screen: data.screen || null,
|
||||
@@ -213,6 +235,11 @@ function refresh(applyImmediately) {
|
||||
initialData = refreshedInitialData;
|
||||
}
|
||||
window.initialData = refreshedInitialData;
|
||||
if (!hadSourceData) {
|
||||
slideMarkupCache = Object.create(null);
|
||||
templateLayoutCache = Object.create(null);
|
||||
templateRenderPlanCache = Object.create(null);
|
||||
}
|
||||
savePlaylistSnapshot({
|
||||
slides: nextSlides,
|
||||
signature: nextSignature,
|
||||
@@ -237,8 +264,12 @@ function refresh(applyImmediately) {
|
||||
return;
|
||||
}
|
||||
if (nextSignature === currentPlaylistSignature || (pendingPlaylistUpdate && nextSignature === pendingPlaylistUpdate.signature)) {
|
||||
if (!hadSourceData) {
|
||||
showCurrent({ skipFade: true });
|
||||
return;
|
||||
}
|
||||
if (currentActiveSlides.length < 2 && lastRenderedSlide) {
|
||||
scheduleSlideAdvance(getSlideHoldDelay(Math.max(1, Number(lastRenderedSlide.duration_seconds || 10)) * 1000));
|
||||
scheduleSlideAdvance(getSlideAdvanceDelay(lastRenderedSlide));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -300,7 +331,7 @@ function refresh(applyImmediately) {
|
||||
setOfflineBannerVisible(true);
|
||||
scheduleRefreshRetry();
|
||||
if (lastRenderedSlide && getCurrentActiveSlides().length < 2) {
|
||||
scheduleSlideAdvance(getSlideHoldDelay(Math.max(1, Number(lastRenderedSlide.duration_seconds || 10)) * 1000));
|
||||
scheduleSlideAdvance(getSlideAdvanceDelay(lastRenderedSlide));
|
||||
}
|
||||
};
|
||||
request.ontimeout = function () {
|
||||
@@ -312,7 +343,7 @@ function refresh(applyImmediately) {
|
||||
setOfflineBannerVisible(true);
|
||||
scheduleRefreshRetry();
|
||||
if (lastRenderedSlide && getCurrentActiveSlides().length < 2) {
|
||||
scheduleSlideAdvance(getSlideHoldDelay(Math.max(1, Number(lastRenderedSlide.duration_seconds || 10)) * 1000));
|
||||
scheduleSlideAdvance(getSlideAdvanceDelay(lastRenderedSlide));
|
||||
}
|
||||
};
|
||||
request.send();
|
||||
|
||||
Reference in New Issue
Block a user