add some info to "on" events for timeline

merge-requests/521/merge^2
Moe 2024-10-10 12:07:42 -07:00
parent 8aa8943244
commit 3902918c0d
1 changed files with 18 additions and 3 deletions

View File

@ -38,6 +38,7 @@ $(document).ready(function(){
var timeStripAutoScrollAmount = null; var timeStripAutoScrollAmount = null;
var timeStripItemIncrement = 0; var timeStripItemIncrement = 0;
var loadedVideosOnTimeStrip = [] var loadedVideosOnTimeStrip = []
var loadedMonitorsOnCanvas = []
var loadedVideosOnCanvas = {} var loadedVideosOnCanvas = {}
var loadedVideoElsOnCanvas = {} var loadedVideoElsOnCanvas = {}
var loadedVideoElsOnCanvasNextVideoTimeout = {} var loadedVideoElsOnCanvasNextVideoTimeout = {}
@ -296,7 +297,7 @@ $(document).ready(function(){
timeStripActionWithPausePlay().then((timeChanging) => { timeStripActionWithPausePlay().then((timeChanging) => {
if(!timeChanging){ if(!timeChanging){
resetTimeline(clickTime) resetTimeline(clickTime)
executeExtender('timelineTimeChange', [clickTime]) executeExtender('timelineTimeChange', [clickTime, loadedMonitorsOnCanvas])
} }
}) })
}); });
@ -317,7 +318,7 @@ $(document).ready(function(){
setTimeout(() => { setTimeout(() => {
timeChanging = false timeChanging = false
getAndDrawVideosToTimeline(clickTime) getAndDrawVideosToTimeline(clickTime)
executeExtender('timelineRangeChanged', [properties.start, properties.end, getTimestripDate()]) executeExtender('timelineRangeChanged', [properties.start, properties.end, getTimestripDate(), loadedMonitorsOnCanvas])
},500) },500)
},300) },300)
}) })
@ -394,6 +395,7 @@ $(document).ready(function(){
function selectAndDrawVideosToCanvas(theTime,redrawVideos){ function selectAndDrawVideosToCanvas(theTime,redrawVideos){
var selectedVideosForTime = selectVideosForCanvas(theTime,loadedVideosOnTimeStrip) var selectedVideosForTime = selectVideosForCanvas(theTime,loadedVideosOnTimeStrip)
loadedVideosOnCanvas = selectedVideosForTime; loadedVideosOnCanvas = selectedVideosForTime;
loadedMonitorsOnCanvas = Object.keys(loadedVideosOnCanvas)
if(redrawVideos){ if(redrawVideos){
drawVideosToCanvas(selectedVideosForTime) drawVideosToCanvas(selectedVideosForTime)
} }
@ -425,8 +427,17 @@ $(document).ready(function(){
jumpToNextVideo() jumpToNextVideo()
} }
} }
function setActiveMonitorIds(monitorId, toggle){
if(toggle){
if(loadedMonitorsOnCanvas.indexOf(monitorId) === -1)loadedMonitorsOnCanvas.push(monitorId)
}else{
const monitorIndex = loadedMonitorsOnCanvas.indexOf(monitorId);
if(monitorIndex > -1)loadedMonitorsOnCanvas.splice(monitorIndex, 1)
}
}
function clearVideoInCanvas(oldVideo){ function clearVideoInCanvas(oldVideo){
var monitorId = oldVideo.mid var monitorId = oldVideo.mid
setActiveMonitorIds(monitorId, false)
loadedVideosOnCanvas[monitorId] = null loadedVideosOnCanvas[monitorId] = null
loadedVideoElsOnCanvas[monitorId] = null loadedVideoElsOnCanvas[monitorId] = null
clearTimeout(loadedVideoEndingTimeouts[monitorId]) clearTimeout(loadedVideoEndingTimeouts[monitorId])
@ -459,6 +470,7 @@ $(document).ready(function(){
container, container,
objectContainer, objectContainer,
} }
setActiveMonitorIds(monitorId, true)
loadedVideosOnCanvas[monitorId] = newVideo loadedVideosOnCanvas[monitorId] = newVideo
timeStripPreBuffersEls[monitorId] = getVideoContainerPreBufferEl(newVideo) timeStripPreBuffersEls[monitorId] = getVideoContainerPreBufferEl(newVideo)
queueNextVideo(newVideo) queueNextVideo(newVideo)
@ -605,6 +617,9 @@ $(document).ready(function(){
function getAllActiveVideosInSlots(){ function getAllActiveVideosInSlots(){
return timeStripVideoCanvas.find('video') return timeStripVideoCanvas.find('video')
} }
function getActiveMonitorsInSlots(){
return loadedMonitorsOnCanvas
}
function playVideo(videoEl){ function playVideo(videoEl){
try{ try{
videoEl.playbackRate = timelineSpeed videoEl.playbackRate = timelineSpeed
@ -646,7 +661,7 @@ $(document).ready(function(){
addition += (msSpeed * timelineSpeed); addition += (msSpeed * timelineSpeed);
newTime = new Date(currentDate + addition) newTime = new Date(currentDate + addition)
setTickDate(newTime); setTickDate(newTime);
executeExtender('timelineTimeChange', [newTime]) executeExtender('timelineTimeChange', [newTime, loadedMonitorsOnCanvas])
// setTimeOfCanvasVideos(newTime) // setTimeOfCanvasVideos(newTime)
}, msSpeed) }, msSpeed)
timeStripVisTickMovementIntervalSecond = setInterval(function() { timeStripVisTickMovementIntervalSecond = setInterval(function() {