Read status for videos re-added to Videos Table

rkmpp-v4l2m2m-decode
Moe 2022-12-06 15:00:23 -08:00
parent 888e0380c7
commit a5d04b5d17
3 changed files with 38 additions and 11 deletions

View File

@ -26,3 +26,14 @@
background: rgba(0,0,0,0.6);
color: #fff;
}
[data-status="1"] .btn-monitor-status-color {
background: #27b392!important;
border-color: #27b392!important;
}
[data-status="2"] .btn-monitor-status-color {
background-color: #2b3c4b;
border-color: #2b3c4b;
color: #fff;
}

View File

@ -639,14 +639,33 @@ function buildDefaultVideoMenuItems(file,options){
return `
<li><a class="dropdown-item" href="${href}" download>${lang.Download}</a></li>
${options.play ? `<li><a class="dropdown-item open-video" href="${href}">${lang.Play}</a></li>` : ``}
${options.play ? `<li><a class="dropdown-item mark-unread" href="${href}">${lang.Play}</a></li>` : ``}
<li><hr class="dropdown-divider"></li>
${permissionCheck('video_delete',file.mid) ? `<li><a class="dropdown-item open-video-studio" href="${href}">${lang.Slice}</a></li>` : ``}
${permissionCheck('video_delete',file.mid) ? `<li><a class="dropdown-item delete-video" href="${href}">${lang.Delete}</a></li>` : ``}
${permissionCheck('video_delete',file.mid) ? `<li><a class="dropdown-item compress-video" href="${href}">${lang.Compress}</a></li>` : ``}
`
}
function setVideoStatus(video,toStatus){
return new Promise((resolve,reject) => {
toStatus = toStatus || 2
if(video.status != toStatus){
$.get(`${video.actionUrl}/status/${toStatus}`,function(data){
resolve(data)
})
}
})
}
onWebSocketEvent(function(d){
switch(d.f){
case'video_edit':case'video_archive':
var video = loadedVideosInMemory[`${d.mid}${d.time}`]
if(video){
let filename = `${formattedTimeForFilename(convertTZ(d.time),false,`YYYY-MM-DDTHH-mm-ss`)}.${video.ext || 'mp4'}`
loadedVideosInMemory[`${d.mid}${d.time}`].status = d.status
$(`[data-mid="${d.mid}"][data-filename="${filename}"]`).attr('data-status',d.status);
}
break;
case'video_delete':
$('[file="'+d.filename+'"][mid="'+d.mid+'"]:not(.modal)').remove();
$('[data-file="'+d.filename+'"][data-mid="'+d.mid+'"]:not(.modal)').remove();
@ -656,15 +675,6 @@ onWebSocketEvent(function(d){
goBackOneTab()
}
deleteTab(videoPlayerId)
// if($.powerVideoWindow.currentDataObject&&$.powerVideoWindow.currentDataObject[d.filename]){
// delete($.timelapse.currentVideos[$.powerVideoWindow.currentDataObject[d.filename].position])
// $.powerVideoWindow.drawTimeline(false)
// }
// if($.timelapse.currentVideos&&$.timelapse.currentVideos[d.filename]){
// delete($.timelapse.currentVideosArray.videos[$.timelapse.currentVideos[d.filename].position])
// $.timelapse.drawTimeline(false)
// }
// if($.vidview.loadedVideos && $.vidview.loadedVideos[d.filename])delete($.vidview.loadedVideos[d.filename])
break;
}
})
@ -677,6 +687,7 @@ $(document).ready(function(){
var videoTime = el.attr('data-time')
var video = loadedVideosInMemory[`${monitorId}${videoTime}`]
createVideoPlayerTab(video)
setVideoStatus(video)
return false;
})
.on('click','[video-time-seeked-video-position]',function(){

View File

@ -157,8 +157,8 @@ $(document).ready(function(e){
`,
size: convertKbToHumanSize(file.size),
buttons: `
<div class="row-info btn-group" data-mid="${file.mid}" data-ke="${file.ke}" data-time="${file.time}" data-filename="${file.filename}">
<a class="btn btn-sm btn-default open-video" href="${href}" title="${lang.Play}"><i class="fa fa-play"></i></a>
<div class="row-info btn-group" data-mid="${file.mid}" data-ke="${file.ke}" data-time="${file.time}" data-filename="${file.filename}" data-status="${file.status}">
<a class="btn btn-sm btn-default btn-monitor-status-color open-video" href="${href}" title="${lang.Play}"><i class="fa fa-play"></i></a>
${permissionCheck('video_delete',file.mid) ? `<a class="btn btn-sm btn-${file.archive === 1 ? `success status-archived` : `default`} archive-video" title="${lang.Archive}"><i class="fa fa-${file.archive === 1 ? `lock` : `unlock-alt`}"></i></a>` : ''}
<div class="dropdown d-inline-block">
<a class="btn btn-sm btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent">
@ -254,9 +254,14 @@ $(document).ready(function(e){
.on('click','.preview-video',function(e){
e.preventDefault()
var el = $(this)
var rowEl = $(this).parents('[data-mid]')
var monitorId = rowEl.attr('data-mid')
var videoTime = rowEl.attr('data-time')
var video = loadedVideosInMemory[`${monitorId}${videoTime}`]
var href = el.attr('href')
setPreviewedVideoHighlight(el,videosTableDrawArea)
drawPreviewVideo(href)
setVideoStatus(video)
return false;
})
.on('click','.zip-selected-videos',function(e){