Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
Tags (8)
master
5.1.0
5.0.0
4.4.0
4.3.0
4.2.0
4.1.0
4.0.0
3.6.0
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
The license selected for the repository is subject to the license used by the main branch of the repository.
master
Branches (1)
Tags (8)
master
5.1.0
5.0.0
4.4.0
4.3.0
4.2.0
4.1.0
4.0.0
3.6.0
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
Tags (8)
master
5.1.0
5.0.0
4.4.0
4.3.0
4.2.0
4.1.0
4.0.0
3.6.0
webflex
/
record.php
webflex
/
record.php
record.php 55.77 KB
Copy Edit Raw Blame History
wangc authored 2026年05月27日 14:37 +08:00 . 20260527
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987
<?php include ("./link/session.php") ?>
<!doctype html>
<html lang="uft-8">
<head>
<?php include ("./public/head.inc") ?>
<link href="assets/plugins/datepicker/css/vue-datepicker.min.css" rel="stylesheet">
</head>
<body>
<?php include ("./public/menu.inc") ?>
<div data-simplebar>
<main class="page-content record" id="app" v-cloak>
<div class="row">
<div class="col-lg-7 lp-equal-height-container">
<div class="card lp-equal-height-item">
<div class="card-header bg-transparent d-flex">
<div class="flex-grow-1">
<div class="p-2 mb-0 d-flex align-items-end">
<cn>录制格式</cn>
<en>Record Format</en>
</div>
</div>
</div>
<div class="card-body d-flex flex-column justify-content-between" >
<div class="row"></div>
<div class="row my-3">
<div class="col-lg-3 text-center">
<cn>通道选择</cn>
<en>Channel select</en>
</div>
<div class="col-lg-8">
<div class="row row-cols-5" v-if="Object.keys(recordConf).length > 0">
<div class="form-check form-check-primary mb-2" v-for="(item,index) in handleEnableConf" :key="item.id">
<input class="form-check-input" type="checkbox" v-model="recordConf.chns" :value="item.id">
<label class="form-check-label">
{{item.name}}
</label>
</div>
</div>
</div>
</div>
<hr>
<div class="row my-3">
<div class="col-lg-3 lp-align-center">
<cn>全局控制</cn>
<en>Overall config</en>
</div>
<div class="col-lg-8">
<div class="row" v-if="Object.keys(recordConf).length > 0">
<div class="col-lg-12">
<div class="row row-cols-5">
<div class="col-lg ps-4">
<label>
<cn>MP4</cn>
<en>MP4</en>
</label>
</div>
<div class="col-lg ps-4">
<label>
<cn>TS</cn>
<en>TS</en>
</label>
</div>
<div class="col-lg ps-4">
<label>
<cn>FLV</cn>
<en>FLV</en>
</label>
</div>
<div class="col-lg ps-4">
<label>
<cn>MKV</cn>
<en>MKV</en>
</label>
</div>
<div class="col-lg ps-4">
<label>
<cn>MOV</cn>
<en>MOV</en>
</label>
</div>
</div>
</div>
<hr>
<div class="col-lg-12">
<div class="row row-cols-5">
<div class="col-lg p-0">
<bs-switch v-model="recordConf.format.mp4"></bs-switch>
</div>
<div class="col-lg p-0">
<bs-switch v-model="recordConf.format.ts"></bs-switch>
</div>
<div class="col-lg p-0">
<bs-switch v-model="recordConf.format.flv"></bs-switch>
</div>
<div class="col-lg p-0">
<bs-switch v-model="recordConf.format.mkv"></bs-switch>
</div>
<div class="col-lg p-0">
<bs-switch v-model="recordConf.format.mov"></bs-switch>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row"></div>
<hr class="my-3">
<div class="row">
<div class="col-lg-12 text-center">
<button type="button" class="btn btn-primary border-3 px-5" @click="updateRecordConf">
<cn>保存</cn>
<en>Save</en>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-5 lp-equal-height-container">
<div class="card lp-equal-height-item">
<div class="card-header bg-transparent d-flex">
<div class="flex-grow-1">
<div class="p-2 mb-0 d-flex align-items-end">
<cn>录制参数</cn>
<en>Record Config</en>
</div>
</div>
</div>
<div class="card-body d-flex flex-column justify-content-between" v-if="Object.keys(recordConf).length > 0">
<div class="row">
<div class="col-lg-4 lp-align-right pe-4">
<label>
<cn>录制模式</cn>
<en>record mode</en>
</label>
</div>
<div class="col-lg-6">
<select class="form-select" v-model="recordConf.type">
<option value="normal" cn="常规录制" en="normal" v-language-option></option>
<option value="loop" cn="循环录制" en="loop" v-language-option></option>
</select>
</div>
</div>
<div class="row mt-3" v-if="recordConf.type === 'loop'">
<div class="col-lg-4 lp-align-right pe-4">
<label>
<cn>保留空间</cn>
<en>keep spaces</en>
</label>
</div>
<div class="col-lg-6">
<div class="input-group">
<input class="form-control" type="text" v-model.trim.lazy="recordConf.limit">
<span class="input-group-text input-group-addon lp-cursor-pointer">
<cn>Mb</cn>
<en>Mb</en>
</span>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-lg-4 lp-align-right pe-4">
<label>
<cn>分段存储</cn>
<en>fragment file</en>
</label>
</div>
<div class="col-lg-6">
<select class="form-select" v-model="recordConf.fragment.enable">
<option :value="true" cn="开启" en="ON" v-language-option></option>
<option :value="false" cn="关闭" en="OFF" v-language-option></option>
</select>
</div>
</div>
<div class="row mt-3" v-if="recordConf.fragment.enable">
<div class="col-lg-4 lp-align-right pe-4">
<label>
<cn>分段模式</cn>
<en>fragment mode</en>
</label>
</div>
<div class="col-lg-6" v-if="recordConf.fragment.enable">
<select class="form-select" v-model="recordConf.fragment.mode">
<option value="dura" cn="录制时长" en="record duration" v-language-option></option>
<option value="size" cn="文件大小" en="file size" v-language-option></option>
</select>
</div>
</div>
<div class="row mt-3" v-if="recordConf.fragment.enable && recordConf.fragment.mode==='dura'">
<div class="col-lg-4 lp-align-right pe-4">
<label>
<cn>分段时长</cn>
<en>fragment duration</en>
</label>
</div>
<div class="col-lg-6">
<div class="input-group">
<input class="form-control" type="text" v-model.trim.lazy="recordConf.fragment.dura">
<span class="input-group-text input-group-addon lp-cursor-pointer">
<cn></cn>
<en>Sec</en>
</span>
</div>
</div>
</div>
<div class="row mt-3" v-if="recordConf.fragment.enable && recordConf.fragment.mode==='size'">
<div class="col-lg-4 lp-align-right pe-4">
<label>
<cn>分段大小</cn>
<en>fragment size</en>
</label>
</div>
<div class="col-lg-6">
<div class="input-group">
<input class="form-control" type="text" v-model.trim.lazy="recordConf.fragment.size">
<span class="input-group-text input-group-addon lp-cursor-pointer">
<cn>Mb</cn>
<en>Mb</en>
</span>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-lg-4 lp-align-right pe-4">
<label>
<cn>开机录制</cn>
<en>Auto record</en>
</label>
</div>
<div class="col-lg-6">
<select class="form-select" v-model="recordConf.auto">
<option :value="true" cn="开启" en="ON" v-language-option></option>
<option :value="false" cn="关闭" en="OFF" v-language-option></option>
</select>
</div>
</div>
<hr class="my-3">
<div class="row">
<div class="col-lg-12 text-center">
<button type="button" class="btn btn-primary border-3 px-5" @click="updateRecordConf">
<cn>保存</cn>
<en>Save</en>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-lg-7 mx-auto">
<div class="rec-bar">
<div class="row">
<div class="col-7 d-flex lp-align-right">
<button type="button" :class="['btn border-3', recChnList.some(obj => obj.durTime !== '--:--:--') ? 'btn-default' : 'btn-primary']" :disabled="recChnList.some(obj => obj.durTime !== '--:--:--')" @click="onStartRecord">
<i class="fa-solid fa-video me-1"></i>
<cn>录制</cn>
<en>Record</en>
</button>
<button type="button" :class="['btn border-3 ms-2', recChnList.some(obj => obj.durTime !== '--:--:--') ? 'btn-primary' : 'btn-default']" :disabled="!recChnList.some(obj => obj.durTime !== '--:--:--')" @click="onStopRecord">
<i class="fa-solid fa-stop me-1"></i>
<cn>全部停止</cn>
<en>Stop All</en>
</button>
</div>
<div class="col-5 text-center p-0" style="line-height: 34px;">
<strong class="font-12">
<cn>已用空间</cn>
<en>Used Space</en>:
<span>{{diskSpace}}</span>
</strong>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 mx-auto">
<ul class="nav nav-tabs nav-primary" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" data-bs-toggle="tab" href="#tab1" role="tab" aria-selected="true">
<div class="d-flex align-items-center">
<div class="tab-icon"><i class="fa fa-sign-in me-1"></i></div>
<div class="tab-title"><cn>频道信息</cn><en>Channels</en></div>
</div>
</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" data-bs-toggle="tab" href="#tab2" role="tab" aria-selected="false">
<div class="d-flex align-items-center">
<div class="tab-icon"><i class="fa-solid fa-download me-1"></i></div>
<div class="tab-title"><cn>文件管理-常规录制</cn><en>Normal File Manager</en></div>
</div>
</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" data-bs-toggle="tab" href="#tab3" role="tab" aria-selected="false">
<div class="d-flex align-items-center">
<div class="tab-icon"><i class="fa-solid fa-download me-1"></i></div>
<div class="tab-title"><cn>文件管理-循环录制</cn><en>Loop File Manager</en></div>
</div>
</a>
</li>
</ul>
<div class="tab-content py-3 pe-2 ps-2">
<div class="tab-pane fade show active" id="tab1" role="tabpanel">
<div class="row">
<div class="col-2 text-center">
<cn>频道名称</cn>
<en>Channel name</en>
</div>
<div class="col text-center">
<cn>MP4</cn>
<en>MP4</en>
</div>
<div class="col text-center">
<cn>TS</cn>
<en>TS</en>
</div>
<div class="col text-center">
<cn>FLV</cn>
<en>FLV</en>
</div>
<div class="col text-center">
<cn>MKV</cn>
<en>MKV</en>
</div>
<div class="col text-center">
<cn>MOV</cn>
<en>MOV</en>
</div>
<div class="col text-center">
<cn>暂停</cn>
<en>pause</en>
</div>
<div class="col-2 text-center">
<cn>录制文件名</cn>
<en>record name</en>
</div>
<div class="col text-center">
<cn>录制时间</cn>
<en>record time</en>
</div>
</div>
<hr >
<div class="row mt-1" v-for="(item,index) in handleMergeRecState" :key="item.id">
<div class="col-lg-12">
<div class="row">
<div class="col-2 text-center">
<input type="text" class="form-control" v-model.trim.lazy="item.name" readonly disabled>
</div>
<div class="col lp-align-center">
<bs-switch v-model="item.mp4" @switch-change="onStartRecordByFormat"></bs-switch>
</div>
<div class="col lp-align-center">
<bs-switch v-model="item.ts" @switch-change="onStartRecordByFormat"></bs-switch>
</div>
<div class="col lp-align-center">
<bs-switch v-model="item.flv" @switch-change="onStartRecordByFormat"></bs-switch>
</div>
<div class="col lp-align-center">
<bs-switch v-model="item.mkv" @switch-change="onStartRecordByFormat"></bs-switch>
</div>
<div class="col lp-align-center">
<bs-switch v-model="item.mov" @switch-change="onStartRecordByFormat"></bs-switch>
</div>
<div class="col lp-align-center">
<bs-switch v-model="item.pause" @switch-change="onStartRecordByFormat"></bs-switch>
</div>
<div class="col-2 lp-align-center">
{{item.curFileName}}
</div>
<div class="col lp-align-center">
{{item.durTime}}
</div>
</div>
<hr >
</div>
</div>
<div class="row my-3">
<div class="col-lg-12 tips">
<cn>1、开启分段存储后,会根据设置的参数,一次录制生成多个视频文件。</cn>
<en>1. Enabling segmented storage creates multiple video files per recording.</en>
</div>
<div class="col-lg-12 tips">
<cn>2、视频分段存储时,在分段过程中可能会损失1到2秒的视频数据,请注意。</cn>
<en>2.Segmented storage may result in a 1-2 second video loss during transitions.</en>
</div>
<div class="col-lg-12 tips">
<cn>3、如果录制模式选择循环录制时,当存储空间小于设置的保留空间时,会按照文件序号名依次删除。</cn>
<en>3. In loop recording mode, files will be deleted in sequence by file number when storage falls below the reserved space.</en>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab2" role="tabpanel">
<div class="row mt-3 mb-2">
<div class="col-lg-12 d-flex">
<div class="flex-grow-0 font-16 lp-align-center ms-3" style="font-weight: bold">
<cn>筛选:</cn>
<en>Filter</en>
</div>
<div class="flex-grow-0 font-16 lp-align-center ms-4">
<cn>起始日期:</cn>
<en>start date</en>
</div>
<div class="flex-grow-0 ms-3">
<date-picker v-model="filter.startDate" :enable-time-picker="false"
format="yyyy-MM-dd" :locale="filter.lang" :cancel-text="filter.cancelTxt"
:select-text="filter.selectTxt"></date-picker>
</div>
<div class="flex-grow-0 font-16 lp-align-center ms-3">
<cn>结束日期:</cn>
<en>end date</en>
</div>
<div class="flex-grow-0 ms-3">
<date-picker v-model="filter.endDate" :enable-time-picker="false"
format="yyyy-MM-dd" :locale="filter.lang" :cancel-text="filter.cancelTxt"
:select-text="filter.selectTxt" ></date-picker>
</div>
</div>
</div>
<hr >
<div class="row mt-3" v-for="(dir,index) in Object.keys(handleRecordFilesNormal)" :key="index">
<div class="col-lg-12">
<div class="card">
<div class="card-header rec-file-title py-2 d-flex">
<div class="flex-grow-1 text-center font-20">
<span>{{dir}}</span>
<i class="fa-solid fa-edit fa-sm lp-cursor-pointer ps-3" @click="reNameRecordDir(dir)"></i>
</div>
<div class="flex-grow-0 pe-2 pt-1">
<i class="fa-solid fa-trash-can fa-lg lp-cursor-pointer" @click="delRecordFileByName(dir)"></i>
</div>
</div>
<div class="card-body">
<div class="row row-cols-2 row-cols-lg-5 g-3">
<div v-for="(item,idx) in Object.keys(handleRecordFilesNormal[dir])" :key="idx" class="col">
<div class="card">
<div class="card-header bg-transparent font-14 d-flex">
<div class="flex-grow-1 text-center">
<span class="ms-5">{{handleChnName(item)}}</span>
</div>
<div v-if="handleMp4Array(dir,item).length" class="flex-grow-0 lp-cursor-pointer" @click="showVideoPlayer(dir,item)">
<i class="fa-regular fa-circle-play font-16"></i>
</div>
<div class="flex-grow-0 ms-2 lp-cursor-pointer">
<div class="dropdown ms-auto">
<div type="button" class="btn-option dropdown-toggle dropdown-toggle-nocaret cursor-pointer" data-bs-toggle="dropdown">
<i class="fa-regular fa-circle-down font-16"></i>
</div>
<ul class="dropdown-menu">
<li v-for="(itm,ix) in handleRecordFileFormat(dir,item)" class="text-center" @click="onDownloadRecordFile(dir,item,itm)">
<a class="dropdown-item" href="javascript:;">{{itm}}</a>
</li>
</ul>
</div>
</div>
<div class="flex-grow-0 ms-2 lp-cursor-pointer" @click="delRecordFileByName(dir+'/'+item)">
<i class="fa-solid fa-trash-can font-14"></i>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-12">
<img :src="makeImgUrl(dir,item)" class="card-img-top">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab3" role="tabpanel">
<div class="row my-3">
<div class="col-lg-12 d-flex">
<div class="flex-grow-0 font-16 lp-align-center ms-3" style="font-weight: bold">
<cn>筛选:</cn>
<en>Filter</en>
</div>
<div class="flex-grow-0 font-16 lp-align-center ms-4">
<cn>起始序号:</cn>
<en>start num</en>
</div>
<div class="flex-grow-0 ms-3">
<input type="number" class="form-control" v-model.number="filter.startNum">
</div>
<div class="flex-grow-0 font-16 lp-align-center ms-3">
<cn>结束序号:</cn>
<en>end num</en>
</div>
<div class="flex-grow-0 ms-3">
<input type="number" class="form-control" v-model.number="filter.endNum">
</div>
</div>
</div>
<hr >
<div class="row" v-for="(dir,index) in (Object.keys(handleRecordFilesLoop).sort((a, b) => parseInt(b, 10) - parseInt(a, 10)))" :key="index">
<div class="col-lg-12">
<div class="card">
<div class="card-header rec-file-title py-2 d-flex">
<div class="flex-grow-1 text-center font-20">
<span>{{dir}}</span>
</div>
<div class="flex-grow-0 pe-2 pt-2">
<i class="fa-solid fa-trash-can fa-lg lp-cursor-pointer" @click="delRecordFileByName(dir)"></i>
</div>
</div>
<div class="card-body">
<div class="row row-cols-2 row-cols-lg-5 g-3">
<div v-for="(item,idx) in Object.keys(handleRecordFilesLoop[dir])" :key="idx" class="col">
<div class="card">
<div class="card-header bg-transparent font-14 d-flex">
<div class="flex-grow-1 text-center">
<span class="ms-5">{{item}}</span>
</div>
<div v-if="handleMp4Array(dir,item).length" class="flex-grow-0 lp-cursor-pointer" @click="showVideoPlayer(dir,item)">
<i class="fa-regular fa-circle-play font-16"></i>
</div>
<div class="flex-grow-0 ms-2 lp-cursor-pointer">
<div class="dropdown ms-auto">
<div type="button" class="btn-option dropdown-toggle dropdown-toggle-nocaret cursor-pointer" data-bs-toggle="dropdown">
<i class="fa-regular fa-circle-down font-16"></i>
</div>
<ul class="dropdown-menu">
<li v-for="(itm,ix) in handleRecordFileFormat(dir,item)" class="text-center" @click="onDownloadRecordFile(dir,item,itm)">
<a class="dropdown-item" href="javascript:;">{{itm}}</a>
</li>
</ul>
</div>
</div>
<div class="flex-grow-0 ms-2 lp-cursor-pointer" @click="delRecordFileByName(dir+'/'+item)">
<i class="fa-solid fa-trash-can font-14"></i>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-12">
<img :src="makeImgUrl(dir,item)" class="card-img-top">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<player-modal :modal-title="playerModalTitle" :modal-show="showPlayerModal" :modal-size="'modal-xl'" :had-footer="playerModalFooter"
:confirm-btn-name="'上一分段&Previous Fragment'" :cancel-btn-name="'下一分段&Next Fragment'"
:cancel-close-modal="false" @cancel-btn-click="playFragment('next')"
@confirm-btn-click="playFragment('last')" @modal-visible="playModalVisible">
<video-player :url="playerUrl"></video-player>
</player-modal>
</main>
</div>
<?php include ("./public/foot.inc") ?>
<script type="module">
import {rpc, func, alertMsg, confirm, isEmpty, clearReactiveArray} from "./assets/js/lp.utils.js?hash=e82520f08";
import { useDefaultConf,useRecordConf,useRecordFiles } from "./assets/js/vue.hooks.js?hash=89523e901";
import { ignoreCustomElementPlugin,filterKeywordPlugin,languageOptionDirective,bootstrapSwitchComponent,customModalComponent,videoPlayerComponent } from "./assets/js/vue.helper.js?hash=68eefc36f"
import VueDatePicker from "./assets/plugins/datepicker/js/vue-datepicker.esm.js"
import vue from "./assets/js/vue.build.js?hash=879ea7dbc";
import mutationObserver from './assets/plugins/polyfill/mutationobserver.esm.js';
const {createApp,ref,reactive,watchEffect,computed,onMounted} = vue;
const app = createApp({
directives: {
"language-option": languageOptionDirective
},
components:{
"bs-switch" : bootstrapSwitchComponent,
"player-modal": customModalComponent,
"video-player": videoPlayerComponent,
"date-picker": VueDatePicker
},
setup: function (props, context) {
const { defaultConf } = useDefaultConf();
const { recordConf, handleRecordConf ,updateRecordConf } = useRecordConf();
const { recordFilesNormal,recordFilesLoop,handleRecordFiles } = useRecordFiles();
const state = {
recChnList:reactive([]),
diskSpace: ref("--/--"),
showPlayerModal: ref(false),
playerUrl: ref(""),
playerModalTitle: ref("正在播放"),
playerModalFooter: ref(false),
showSettingModal: ref(false),
filter:reactive({
startDate: null,
endDate: null,
cancelTxt:"关闭",
selectTxt:"选择",
startNum: null,
endNum:null,
lang:"zh"
}),
}
const handleEnableConf = computed(() => {
return defaultConf.filter(item => {
return item.enable && item.type !== "ndi";
})
});
const handleRecordFilesNormal = computed(() => {
if (isEmpty(recordFilesNormal))
return {};
const startDate = state.filter.startDate ? new Date(state.filter.startDate) : null;
const endDate = state.filter.endDate ? new Date(state.filter.endDate) : null;
return Object.fromEntries(
Object.entries(recordFilesNormal).filter(([key]) => {
const datePart = key.split("_")[0];
const currentDate = new Date(datePart);
if (!startDate && !endDate)
return true;
if(startDate)
startDate.setHours(0, 0, 0, 0);
if(endDate)
endDate.setHours(23, 59, 59, 999);
if (startDate && !endDate)
return currentDate >= startDate;
if (!startDate && endDate)
return currentDate <= endDate;
return currentDate >= startDate && currentDate <= endDate;
})
);
});
const handleRecordFilesLoop = computed(() => {
if (isEmpty(recordFilesLoop))
return {};
return Object.fromEntries(
Object.entries(recordFilesLoop).filter(([key]) => {
const startNum = state.filter.startNum ? state.filter.startNum : null;
const endNum = state.filter.endNum ? state.filter.endNum : null;
const curNum = Number(key);
if(!startNum && !endNum)
return true;
if (startNum && !endNum)
return curNum >= startNum;
if (!startNum && endNum)
return curNum <= endNum;
return curNum >= startNum && curNum <= endNum;
})
);
});
const handleMergeRecState = computed(() => {
if (!isEmpty(state.recChnList)) {
return state.recChnList.filter(recChn =>
defaultConf.some(item => item.id === recChn.id && item.enable)
);
}
return defaultConf
.filter(conf => conf.enable)
.map(({ id, name }) => ({
id,
name,
mp4: false,
ts: false,
flv: false,
mkv: false,
mov: false,
curFileName: "------",
durTime: "--:--:--"
}));
})
const onStartRecord = async () => {
const isMountDisk = await rpc("rec.isMountDisk");
if (!isMountDisk) {
alertMsg('<cn>启动录制失败,没有找到外部存储设备!</cn><en>Failed to start recording,no external storage device was found!</en>', 'error');
return;
}
const result = await rpc("rec.start");
if (result) {
alertMsg('<cn>启动录制成功</cn><en>Recording started successfully!</en>', 'success');
setTimeout(handleRecordFiles,500);
return;
}
alertMsg('<cn>启动录制失败,没有找到外部存储设备!</cn><en>Failed to start recording,no external storage device was found!</en>', 'error');
}
const onStopRecord = () => {
rpc("rec.stop").then( data => {
if(data){
handleRecordConf();
alertMsg('<cn>停止录制成功</cn><en>Recording stoped successfully!</en>', 'success');
return;
}
alertMsg('<cn>停止录制失败!</cn><en>Failed to stop recording</en>', 'error');
} );
}
const onStartRecordByFormat = async type => {
const result = await rpc("rec.execute", [JSON.stringify(state.recChnList)]);
if (result) {
if(type) {
setTimeout(handleRecordFiles,500);
alertMsg('<cn>启动录制成功</cn><en>Recording started successfully!</en>', 'success');
} else {
alertMsg('<cn>停止录制成功</cn><en>Recording started successfully!</en>', 'success');
}
return;
}
alertMsg('<cn>操作失败,没有找到外部存储设备!</cn><en>Operation failed, external storage device not found! </en>', 'error');
}
const handleDiskSpace = () => {
rpc("rec.getState").then(data => {
if(isEmpty(data)) {
state.diskSpace.value = "--/--";
return;
}
state.diskSpace.value = data.used + " / " + data.total;
})
}
const handleChnName = rdir => {
const isNumeric = (str) => /^\d+(\.\d+)?$/.test(str);
if(isNumeric(rdir)) {
const conf = defaultConf.find(item => item.id === Number(rdir));
if(conf)
return conf.name;
return "";
}
return rdir;
}
const handleRecChnsState = () => {
rpc("rec.getRecChnsState").then( data => {
clearReactiveArray(state.recChnList);
state.recChnList.splice(0, state.recChnList.length, ...data);
})
setTimeout(handleRecChnsState,1000);
}
const makeImgUrl = (dir, name) => {
const regex = /\d{4}-\d{2}-\d{2}_\d{6}/;
if(regex.test(dir))
return `files/${dir}/${name}/preview.jpg`;
else
return `files/${name}/${dir}_preview.jpg`;
};
const isDateFolder = (name) => /^\d{4}-\d{2}-\d{2}_\d{6}(_.+)?$/.test(name);
const delRecordFileByName = dirName => {
confirm({
title: '<cn>删除</cn><en>Delete</en>',
content: '<cn>是否删除文件'+dirName+' ?</cn><en>Do you want to delete the file '+dirName+' ?</en>',
buttons: {
ok: {
text: "<cn>删除</cn><en>Delete</en>",
btnClass: 'btn-primary',
keys: ['enter'],
action: () => {
if(isDateFolder(dirName)) {
func("/root/delRecordFile",{"name":dirName}).then(res => {
alertMsg(res.msg,res.status);
if(res.status === "success")
handleRecordFiles();
})
} else {
const [num,dir] = dirName.split("/");
if(!dir) {
const action = [];
for(let i=0;i<Object.keys(recordFilesLoop[num]).length;i++)
action.push(func("/root/delRecordFile",{"name":Object.keys(recordFilesLoop[dirName])[i]+"/"+dirName}))
Promise.all(action).then((results) => {
if(results.every(ret => typeof ret === "boolean" ? ret : (ret?.status === "success"))){
alertMsg(results[0].msg,results[0].status);
handleRecordFiles();
}
})
} else {
func("/root/delRecordFile",{"name":dir+"/"+num}).then(res => {
alertMsg(res.msg,res.status);
if(res.status === "success")
handleRecordFiles();
})
}
}
}
},
cancel: {
text: "<cn>取消</cn><en>Cancel</en>",
action: () => {}
}
}
});
}
const reNameRecordDir = dirName => {
confirm({
title: '<cn>重命名</cn><en>Rename</en>',
content: '<div class="row justify-content-center my-3">' +
'<div class="col-lg-auto d-flex justify-content-end align-items-end pe-0">' +
'<label id="recDirName"></label>' +
'</div>' +
'<div class="col-lg-auto p-0">' +
'<input id="recDirNameExt" class="form-control shadow-none p-0" autocomplete="off" style="border-top-width: 0;border-left-width: 0;border-right-width: 0;outline: none;border-radius: unset;">' +
'</div>' +
'</div>',
buttons: {
ok: {
text: "<cn>确定</cn><en>Save</en>",
btnClass: 'btn-primary',
keys: ['enter'],
action: () => {
let name = document.querySelector('#recDirName').textContent;
let ext = document.querySelector('#recDirNameExt').value;
ext = ext.trim();
if(ext)
name = name + ext;
else
name = name.replace(/_$/, '');
if(name !== dirName) {
func("/root/updateRecordFilesName",{newName:name,lastName:dirName}).then(res => {
alertMsg(res.msg,res.status);
if(res.status === "success")
handleRecordFiles();
})
}
}
},
cancel: {
text: "<cn>取消</cn><en>Cancel</en>",
action: () => {}
}
},
onOpenBefore:()=>{
const match = dirName.match(/^(\d{4}-\d{2}-\d{2}_\d{6})_(.+)$/);
const name = match ? match[1] : dirName;
const ext = match ? match[2] : "";
document.querySelector('#recDirName').textContent = name+"_";
document.querySelector('#recDirNameExt').value = ext;
}
});
}
const handleMp4Array = (dir, rdir) => {
const regex = /\d{4}-\d{2}-\d{2}_\d{6}/;
const files = regex.test(dir) ? recordFilesNormal[dir][rdir] : recordFilesLoop[dir][rdir];
return files.filter(file => file.toLowerCase().endsWith('.mp4')).reverse();
};
const showVideoPlayer = (dir, rdir) => {
const mp4Array = handleMp4Array(dir, rdir);
const regex = /\d{4}-\d{2}-\d{2}_\d{6}/;
const basePath = regex.test(dir) ? `${dir}/${rdir}` : rdir;
const titleBase = regex.test(dir) ? dir : rdir;
const titleSuffix = mp4Array.length > 1 ? ` (${1}/${mp4Array.length})` : '';
state.playerModalTitle.value = `正在播放 ${titleBase}${titleSuffix} & Playing ${titleBase}${titleSuffix}`;
state.playerModalFooter.value = mp4Array.length > 1;
state.playerUrl.value = `files/${basePath}/${mp4Array[0]}`;
state.showPlayerModal.value = !state.showPlayerModal.value;
};
const playFragment = type =>{
if(!state.playerUrl.value) return;
const urlList = state.playerUrl.value.split("/");
const dir = urlList[1];
let rdir,fileName;
if(urlList.length === 4) {
rdir = urlList[2];
fileName = urlList[3];
} else {
fileName = urlList[2];
const match = fileName.match(/^(rec_\d{5})(?:_\d+)?\.mp4$/);
rdir = match[1];
}
const mp4Array = handleMp4Array(dir,rdir);
let index = mp4Array.indexOf(fileName);
if (type === "next" && index + 1 < mp4Array.length) index++;
if (type === "last" && index - 1 >= 0) index--;
const basePath = urlList.length === 4 ? `${dir}/${rdir}` : dir;
const titleBase = urlList.length === 4 ? dir : rdir;
const titleSuffix = mp4Array.length > 1 ? ` (${index+1}/${mp4Array.length})` : '';
state.playerUrl.value = `files/${basePath}/${mp4Array[index]}`;
state.playerModalTitle.value = `正在播放 ${titleBase}${titleSuffix} & Playing ${titleBase}${titleSuffix}`;
}
const playModalVisible = visible => {
if(!visible)
state.playerUrl.value = "";
}
const handleRecordFileFormat = (dir, rdir) => {
const formats = [];
const regex = /\d{4}-\d{2}-\d{2}_\d{6}/;
const files = regex.test(dir) ? recordFilesNormal[dir][rdir] : recordFilesLoop[dir][rdir];
files.forEach(file => {
const [, fileFormat] = file.split(".");
const formatUpper = fileFormat.toUpperCase();
if (fileFormat !== "jpg" && !formats.includes(formatUpper))
formats.push(formatUpper);
});
return formats;
};
const onDownloadRecordFile = (dir, rdir, format) => {
format = format.toLowerCase();
const regex = /\d{4}-\d{2}-\d{2}_\d{6}/;
const files = regex.test(dir) ? recordFilesNormal[dir][rdir] : recordFilesLoop[dir][rdir];
const formatFiles = files.filter(file => file.toLowerCase().endsWith(`.${format}`));
const basePath = regex.test(dir) ? `/files/${dir}/${rdir}` : `/files/${rdir}`;
formatFiles.forEach((file, index) => {
setTimeout(() => {
const url = `${basePath}/${file}`;
const eleA = document.createElement('a');
eleA.href = url;
eleA.download = file;
eleA.dispatchEvent(new MouseEvent('click'));
}, 200 * index);
});
};
const saveFragmentSetting = () => {
updateRecordConf();
}
const onListenLangageChange = () => {
const html = document.querySelector('html');
const observer = new mutationObserver(() => {
const lang = html.getAttribute('data-bs-language');
if(lang === "cn") {
state.filter.selectTxt = "选择";
state.filter.cancelTxt = "关闭";
state.filter.lang = "zh";
} else {
state.filter.selectTxt = "Select";
state.filter.cancelTxt = "Close";
state.filter.lang = "en";
}
});
const config = {
attributes: true,
attributeFilter: ["data-bs-language"],
subtree: false
};
observer.observe(html, config);
}
onMounted(() => {
handleDiskSpace();
handleRecChnsState();
onListenLangageChange();
})
return {...state, recordConf ,updateRecordConf,handleEnableConf,handleRecordFilesNormal,handleRecordFilesLoop,
recordFilesLoop, handleMergeRecState, onStartRecord,onStopRecord,onStartRecordByFormat,handleChnName,makeImgUrl,
delRecordFileByName, showVideoPlayer,handleMp4Array,handleRecordFileFormat,onDownloadRecordFile,
saveFragmentSetting,playFragment,playModalVisible,reNameRecordDir}
}
});
app.use(ignoreCustomElementPlugin);
app.use(filterKeywordPlugin);
app.mount('#app');
</script>
</body>
</html>
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

Encoder web 标准版页面,灵派编码器通用web管理页面标准版页面,持续维护更新中...
Cancel

Releases (8)

All

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/LinkPi/webflex.git
git@gitee.com:LinkPi/webflex.git
LinkPi
webflex
webFlex
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /