5
5
<div style =" display : flex ; justify-content : center ; align-items : center ;" >
6
6
<p >摄像头服务:</p >
7
7
<n-space >
8
- <n-tag :type =" hasCamera ? 'success' : 'error'" >{{ hasCamera ? '已连接' : '未连接' }}</n-tag >
8
+ <n-tag :type =" hasCamera ? 'success' : 'error'" >{{ hasCamera ? hasCamera : '未连接' }}</n-tag >
9
9
<n-tag :type =" runCamera ? 'success' : 'error'" >{{ runCamera ? '运行中' : '未运行' }}</n-tag >
10
10
</n-space >
11
11
</div >
12
12
<n-space >
13
13
<n-button size =" small" type =" primary" @click =" runService('vlc-webcam', 'restart')" >启动</n-button >
14
14
<n-button size =" small" type =" error" @click =" runService('vlc-webcam', 'stop')" >停止</n-button >
15
15
<n-button size =" small" type =" info" @click =" runVLC('webcam')" >测试</n-button >
16
- <n-button size =" small" type =" warning" @click =" runService('vlc-webcam', 'enable')" >激活</n-button >
17
16
<n-button size =" small" @click =" statusService('vlc-webcam')" >状态</n-button >
17
+ <n-button size =" small" type =" warning" @click =" runService('vlc-webcam', 'enable')" >激活</n-button >
18
+ <n-button size =" small" type =" warning" @click =" runService('vlc-webcam', 'disable')" >禁用</n-button >
19
+ <n-button size =" small" @click =" hasCamera = 'video0'" >强制摄像头存在</n-button >
18
20
</n-space >
19
21
<div style =" display : flex ; justify-content : center ; align-items : center ;" >
20
22
<p >屏幕捕获服务:</p >
24
26
<n-button size =" small" type =" primary" @click =" runService('vlc-screen', 'restart')" >启动</n-button >
25
27
<n-button size =" small" type =" error" @click =" runService('vlc-screen', 'stop')" >停止</n-button >
26
28
<n-button size =" small" type =" info" @click =" runVLC('screen')" >测试</n-button >
27
- <n-button size =" small" type =" warning" @click =" runService('vlc-screen', 'enable')" >激活</n-button >
28
29
<n-button size =" small" @click =" statusService('vlc-screen')" >状态</n-button >
30
+ <n-button size =" small" type =" warning" @click =" runService('vlc-screen', 'enable')" >激活</n-button >
31
+ <n-button size =" small" type =" warning" @click =" runService('vlc-screen', 'disable')" >禁用</n-button >
29
32
</n-space >
30
33
</n-gi >
31
34
<n-gi >
@@ -49,7 +52,7 @@ import { filesystem, os } from '@neutralinojs/lib';
49
52
import { NCard , NGrid , NGi , NButton , NInput , NTabs , NTabPane } from ' naive-ui' ;
50
53
import { onMounted , ref } from ' vue' ;
51
54
52
- const hasCamera = ref (false );
55
+ const hasCamera = ref (' ' );
53
56
54
57
const runCamera = ref (false );
55
58
const runScreen = ref (false );
@@ -123,7 +126,7 @@ const saveConfig = async (service: string) => {
123
126
onMounted (async () => {
124
127
try {
125
128
const checkCamera = await filesystem .readDirectory (' /dev' );
126
- hasCamera .value = checkCamera .map ((item ) => item .path ). includes ( ' video0 ' ) ;
129
+ hasCamera .value = checkCamera .map ((item ) => item .entry ). filter (( item ) => item . startsWith ( ' video ' )). join ( ' , ' ) || ' ' ;
127
130
const camera = await filesystem .readFile (' /etc/default/vlc-webcam' );
128
131
const screen = await filesystem .readFile (' /etc/default/vlc-screen' );
129
132
cameraInfo .value = camera ;
0 commit comments