新增FFmpeg录制方法,但如果意外中断会存储失败

This commit is contained in:
yutou
2021-04-15 18:34:19 +08:00
parent e94033b3fd
commit 5666582641
9 changed files with 222 additions and 67 deletions

View File

@@ -50,7 +50,7 @@
</div>
</form>
</div>
<div id="config" class="layui-card" style="margin-top: 5%;height: 100%;display: none">
<div id="config" class="layui-card" style="margin-top: 5%;height: 120%;display: none">
<div class="layui-card-header">系统设置</div>
<div class="layui-card-body">
<form class="layui-form" action="" style="margin-top: 2%;width: 80%">
@@ -68,6 +68,15 @@
lay-text="开启|关闭">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">录制器</label>
<div class="layui-input-block">
<input id="savemodel" type="checkbox" lay-filter="saveLiveModel" lay-skin="switch"
lay-text="FFMPEG| Java ">
<i class="layui-icon" id="htitle">&#xe60b;</i>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">FFmpeg</label>
<div class="layui-input-block">
@@ -121,6 +130,15 @@
form.render();
}
})
$.post('/system/get/savelive.do',function (json){
if (json.code === undefined || json.code !== 0) {
return;
}
if (json.data.save_live_model) {
$('#savemodel').prop('checked', true);
}
form.render();
})
form.on('switch(userReg)', function (data) {
let flag = data.elem.checked ? '1' : '0';
$.post("/system/set/config.do", {key: "userReg", value: flag}, function (json) {
@@ -137,6 +155,14 @@
}
})
})
form.on('switch(saveLiveModel)',function (data){
let flag = data.elem.checked ? 'ffmpeg' : 'java';
$.post("/system/set/savelive.do", {model: flag}, function (json) {
if (json.code !== undefined) {
layer.msg(json.msg)
}
})
})
});
$.post('/bili/login/get/test.do', function (json) {
if (json.code === undefined || json.code !== 0) {
@@ -153,6 +179,7 @@
$('#ffmpeg').val(json.data.ffmpeg_path);
})
$('#login').click(function () {
$.post('/bili/login/set/login.do', function (json) {
if (json.code === undefined || json.code !== 0) {
@@ -184,7 +211,12 @@
})
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#htitle').on('click', function () {
layer.open({
title:"录制模式",
content:'FFmpeg录制能保留视频信息如时间戳之类的但对性能要求比较高。<br>Java录制使用javaApi录制性能要求较低但无法记录视频信息如没有时间戳且有可能因为超时而断开录制。<br>建议性能足够的情况下使用FFmpeg。<br>需要设置FFmpeg的路径'
})
});
</script>
</body>
<style>