virtual-human-cf 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -1
- package/dist/api/request.d.ts +1 -0
- package/dist/components/VirtualHumanEventAdapter.vue.d.ts +14 -1
- package/dist/virtual-human-cf.es.js +593 -581
- package/dist/virtual-human-cf.umd.js +6 -6
- package/package.json +1 -1
- package/src/api/request.ts +4 -1
- package/src/components/VirtualHumanEventAdapter.vue +20 -1
package/README.md
CHANGED
|
@@ -12,9 +12,31 @@
|
|
|
12
12
|
- 响应式设计
|
|
13
13
|
|
|
14
14
|
## 更新日志
|
|
15
|
+
## 1.6.0
|
|
16
|
+
- 新增VirtualHumanEventAdapter组件props: controlHostUrl,用于指定数字人播放控制指令的主机地址
|
|
17
|
+
```javascript
|
|
18
|
+
<VirtualHumanEventAdapter
|
|
19
|
+
:controlHostUrl="controlHostUrl"
|
|
20
|
+
/>
|
|
21
|
+
const controlHostUrl = ref("http://****");
|
|
22
|
+
```
|
|
23
|
+
### 1.5.0
|
|
24
|
+
- 新增VirtualHumanEventAdapter组件对外暴露play方法
|
|
15
25
|
|
|
16
|
-
|
|
26
|
+
```javascript
|
|
27
|
+
<VirtualHumanEventAdapter
|
|
28
|
+
v-if="activeScreenClientId"
|
|
29
|
+
@controlEvent="onControlEvent"
|
|
30
|
+
ref="adapterRef"
|
|
31
|
+
/>
|
|
32
|
+
const adapterRef = ref(null);
|
|
17
33
|
|
|
34
|
+
// 底部有使用demo,这里不重复
|
|
35
|
+
// 播放
|
|
36
|
+
adapterRef.value.play().then(() => {}).catch(() => {});
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
### 1.4.0
|
|
18
40
|
- 新增VirtualHumanEventAdapter组件对外暴露pause、resume、stop方法
|
|
19
41
|
|
|
20
42
|
```javascript
|
|
@@ -164,6 +186,7 @@ const onEnded = () => {
|
|
|
164
186
|
| -------------- | ------ | ------ | ---- | ------------------ |
|
|
165
187
|
| screenClientId | String | - | 是 | 屏幕客户端 ID |
|
|
166
188
|
| wsUrl | String | - | 是 | WebSocket 连接地址 |
|
|
189
|
+
| controlHostUrl | String | - | 是 | 数字人播放控制指令的主机地址 |
|
|
167
190
|
|
|
168
191
|
#### Events
|
|
169
192
|
|
|
@@ -181,10 +204,12 @@ const onEnded = () => {
|
|
|
181
204
|
|
|
182
205
|
| 方法名 | 说明 | 回调参数 |
|
|
183
206
|
| ------ | -------- | -------- |
|
|
207
|
+
| play | 播放 |Promise<boolean> |
|
|
184
208
|
| pause | 暂停播放 |Promise<boolean> |
|
|
185
209
|
| resume | 恢复播放 |Promise<boolean> |
|
|
186
210
|
| stop | 停止播放 |Promise<boolean> |
|
|
187
211
|
|
|
212
|
+
|
|
188
213
|
```js
|
|
189
214
|
// eventNotifaction 载荷数据
|
|
190
215
|
{
|
|
@@ -213,6 +238,7 @@ tts_complete 文本转语音完成,不代表本地播放完成
|
|
|
213
238
|
<VirtualHumanEventAdapter
|
|
214
239
|
:screen-client-id="clientId"
|
|
215
240
|
:ws-url="websocketUrl"
|
|
241
|
+
:controlHostUrl="controlHostUrl"
|
|
216
242
|
@connected="onConnected"
|
|
217
243
|
@eventNotifaction="onEventNotifaction"
|
|
218
244
|
@playComplete="onPlayComplete"
|
|
@@ -230,6 +256,7 @@ import { VirtualHumanEventAdapter } from 'virtual-human-cf';
|
|
|
230
256
|
|
|
231
257
|
const clientId = 'screen-123';
|
|
232
258
|
const websocketUrl = 'ws://localhost:8080/ws';
|
|
259
|
+
const controlHostUrl = 'http://localhost:8080';
|
|
233
260
|
|
|
234
261
|
const onConnected = () => {
|
|
235
262
|
console.log('WebSocket 连接成功');
|
|
@@ -253,6 +280,12 @@ const onError = (error) => {
|
|
|
253
280
|
|
|
254
281
|
const adapterRef = ref(null);
|
|
255
282
|
const controlFunc = () => {
|
|
283
|
+
// 播放
|
|
284
|
+
adapterRef.value.play().then(res => {
|
|
285
|
+
// res boolean true 播放成功 false 播放失败
|
|
286
|
+
}).catch((error) => {
|
|
287
|
+
console.error('播放失败:', error);
|
|
288
|
+
});
|
|
256
289
|
// 暂停播放
|
|
257
290
|
adapterRef.value.pause().then(res => {
|
|
258
291
|
// res boolean true 暂停成功 false 暂停失败
|
package/dist/api/request.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
|
|
1
3
|
declare function __VLS_template(): {
|
|
2
4
|
default?(_: {}): any;
|
|
3
5
|
};
|
|
@@ -10,7 +12,12 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
10
12
|
type: StringConstructor;
|
|
11
13
|
required: true;
|
|
12
14
|
};
|
|
15
|
+
controlHostUrl: {
|
|
16
|
+
type: PropType<string | null>;
|
|
17
|
+
default: null;
|
|
18
|
+
};
|
|
13
19
|
}>, {
|
|
20
|
+
play: () => Promise<boolean>;
|
|
14
21
|
pause: () => Promise<boolean>;
|
|
15
22
|
resume: () => Promise<boolean>;
|
|
16
23
|
stop: () => Promise<boolean>;
|
|
@@ -31,6 +38,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
31
38
|
type: StringConstructor;
|
|
32
39
|
required: true;
|
|
33
40
|
};
|
|
41
|
+
controlHostUrl: {
|
|
42
|
+
type: PropType<string | null>;
|
|
43
|
+
default: null;
|
|
44
|
+
};
|
|
34
45
|
}>> & Readonly<{
|
|
35
46
|
onPause?: ((...args: any[]) => any) | undefined;
|
|
36
47
|
onError?: ((...args: any[]) => any) | undefined;
|
|
@@ -39,7 +50,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
39
50
|
onEnd?: ((...args: any[]) => any) | undefined;
|
|
40
51
|
onConnected?: ((...args: any[]) => any) | undefined;
|
|
41
52
|
onPlayComplete?: ((...args: any[]) => any) | undefined;
|
|
42
|
-
}>, {
|
|
53
|
+
}>, {
|
|
54
|
+
controlHostUrl: string | null;
|
|
55
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
43
56
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
44
57
|
export default _default;
|
|
45
58
|
type __VLS_WithTemplateSlots<T, S> = T & {
|