performance upgrade to timeline loader
+ make double click open the video in regular video playernode-20
parent
3981dd003c
commit
493ee9678f
|
|
@ -34,6 +34,7 @@ $(document).ready(function(){
|
||||||
var timeStripAutoScrollPositionStart = null;
|
var timeStripAutoScrollPositionStart = null;
|
||||||
var timeStripAutoScrollPositionEnd = null;
|
var timeStripAutoScrollPositionEnd = null;
|
||||||
var timeStripAutoScrollAmount = null;
|
var timeStripAutoScrollAmount = null;
|
||||||
|
var timeStripItemIncrement = 0;
|
||||||
var loadedVideosOnTimeStrip = []
|
var loadedVideosOnTimeStrip = []
|
||||||
var loadedVideosOnCanvas = {}
|
var loadedVideosOnCanvas = {}
|
||||||
var loadedVideoElsOnCanvas = {}
|
var loadedVideoElsOnCanvas = {}
|
||||||
|
|
@ -137,7 +138,7 @@ $(document).ready(function(){
|
||||||
var videos = await getVideosInGaps(gaps,timeStripSelectedMonitors)
|
var videos = await getVideosInGaps(gaps,timeStripSelectedMonitors)
|
||||||
videos = addVideoBeforeAndAfter(videos)
|
videos = addVideoBeforeAndAfter(videos)
|
||||||
loadedVideosOnTimeStrip.push(...videos)
|
loadedVideosOnTimeStrip.push(...videos)
|
||||||
if(currentVideosLength !== loadedVideosOnTimeStrip.length)resetTimelineItems(loadedVideosOnTimeStrip);
|
if(currentVideosLength !== loadedVideosOnTimeStrip.length)addTimelineItems(loadedVideosOnTimeStrip);
|
||||||
setLoadingMask(false)
|
setLoadingMask(false)
|
||||||
}
|
}
|
||||||
return loadedVideosOnTimeStrip
|
return loadedVideosOnTimeStrip
|
||||||
|
|
@ -162,7 +163,7 @@ $(document).ready(function(){
|
||||||
var preBufferHtml = ''
|
var preBufferHtml = ''
|
||||||
$.each(loadedMonitors,function(monitorId,monitor){
|
$.each(loadedMonitors,function(monitorId,monitor){
|
||||||
var itemColor = timeStripItemColors[monitorId];
|
var itemColor = timeStripItemColors[monitorId];
|
||||||
html += `<div class="timeline-video col-${timelineGridSizing} p-0 m-0 no-video" data-mid="${monitorId}" data-ke="${monitor.ke}" style="background-color:${itemColor}"></div>`
|
html += `<div class="timeline-video open-video col-${timelineGridSizing} p-0 m-0 no-video" data-mid="${monitorId}" data-ke="${monitor.ke}" style="background-color:${itemColor}"></div>`
|
||||||
preBufferHtml += `<div class="timeline-video-buffer" data-mid="${monitorId}" data-ke="${monitor.ke}"></div>`
|
preBufferHtml += `<div class="timeline-video-buffer" data-mid="${monitorId}" data-ke="${monitor.ke}"></div>`
|
||||||
})
|
})
|
||||||
timeStripVideoCanvas.html(html)
|
timeStripVideoCanvas.html(html)
|
||||||
|
|
@ -180,12 +181,11 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function formatVideosForTimeline(videos){
|
function formatVideosForTimeline(videos){
|
||||||
var i = 0;
|
|
||||||
var formattedVideos = (videos || []).map((item) => {
|
var formattedVideos = (videos || []).map((item) => {
|
||||||
var blockColor = timeStripItemColors[item.mid];
|
var blockColor = timeStripItemColors[item.mid];
|
||||||
++i;
|
++timeStripItemIncrement;
|
||||||
return {
|
return {
|
||||||
id: i,
|
id: timeStripItemIncrement,
|
||||||
content: ``,
|
content: ``,
|
||||||
style: `background-color: ${blockColor};border-color: ${blockColor}`,
|
style: `background-color: ${blockColor};border-color: ${blockColor}`,
|
||||||
start: item.time,
|
start: item.time,
|
||||||
|
|
@ -211,6 +211,10 @@ $(document).ready(function(){
|
||||||
timeStripVisItems.clear();
|
timeStripVisItems.clear();
|
||||||
timeStripVisItems.add(newVideos);
|
timeStripVisItems.add(newVideos);
|
||||||
}
|
}
|
||||||
|
function addTimelineItems(videos){
|
||||||
|
var newVideos = formatVideosForTimeline(videos)
|
||||||
|
timeStripVisItems.add(newVideos);
|
||||||
|
}
|
||||||
async function resetTimeline(clickTime){
|
async function resetTimeline(clickTime){
|
||||||
await getAndDrawVideosToTimeline(clickTime,true)
|
await getAndDrawVideosToTimeline(clickTime,true)
|
||||||
setTickDate(clickTime)
|
setTickDate(clickTime)
|
||||||
|
|
@ -219,6 +223,7 @@ $(document).ready(function(){
|
||||||
setHollowClickQueue()
|
setHollowClickQueue()
|
||||||
}
|
}
|
||||||
function createTimeline(){
|
function createTimeline(){
|
||||||
|
timeStripItemIncrement = 0;
|
||||||
var timeChangingTimeout = null
|
var timeChangingTimeout = null
|
||||||
var dateNow = new Date()
|
var dateNow = new Date()
|
||||||
var hour = 1000 * 60 * 60
|
var hour = 1000 * 60 * 60
|
||||||
|
|
@ -725,7 +730,9 @@ $(document).ready(function(){
|
||||||
})
|
})
|
||||||
timeStripVideoCanvas.on('dblclick','.timeline-video',function(){
|
timeStripVideoCanvas.on('dblclick','.timeline-video',function(){
|
||||||
var monitorId = $(this).attr('data-mid')
|
var monitorId = $(this).attr('data-mid')
|
||||||
openVideosTableView(monitorId)
|
var video = loadedVideosOnCanvas[monitorId];
|
||||||
|
createVideoPlayerTab(video)
|
||||||
|
setVideoStatus(video)
|
||||||
})
|
})
|
||||||
addOnTabOpen('timeline', async function () {
|
addOnTabOpen('timeline', async function () {
|
||||||
setColorReferences()
|
setColorReferences()
|
||||||
|
|
|
||||||
|
|
@ -627,6 +627,15 @@ function setVideoStatus(video,toStatus){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function getVideoInfoFromEl(_this){
|
||||||
|
var el = $(_this).parents('[data-mid]')
|
||||||
|
var monitorId = el.attr('data-mid')
|
||||||
|
var videoTime = el.attr('data-time')
|
||||||
|
return {
|
||||||
|
monitorId,
|
||||||
|
videoTime,
|
||||||
|
}
|
||||||
|
}
|
||||||
onWebSocketEvent(function(d){
|
onWebSocketEvent(function(d){
|
||||||
switch(d.f){
|
switch(d.f){
|
||||||
case'video_edit':case'video_archive':
|
case'video_edit':case'video_archive':
|
||||||
|
|
@ -653,10 +662,11 @@ $(document).ready(function(){
|
||||||
$('body')
|
$('body')
|
||||||
.on('click','.open-video',function(e){
|
.on('click','.open-video',function(e){
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
var el = $(this).parents('[data-mid]')
|
var {
|
||||||
var monitorId = el.attr('data-mid')
|
monitorId,
|
||||||
var videoTime = el.attr('data-time')
|
videoTime,
|
||||||
var video = loadedVideosInMemory[`${monitorId}${videoTime}${undefined}`]
|
video,
|
||||||
|
} = getVideoInfoFromEl(this)
|
||||||
createVideoPlayerTab(video)
|
createVideoPlayerTab(video)
|
||||||
setVideoStatus(video)
|
setVideoStatus(video)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue