[mirotalksfu] - fix avatars

هذا الالتزام موجود في:
Miroslav Pejic
2024-10-16 20:09:16 +02:00
الأصل 511bde4d94
التزام 7d5a38cc7d
4 ملفات معدلة مع 26 إضافات و21 حذوفات

عرض الملف

@@ -55,7 +55,7 @@ dev dependencies: {
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.86
* @version 1,5,87
*
*/
@@ -2129,8 +2129,7 @@ function startServer() {
}
});
// https://docs.heygen.com/reference/overview-copy
// https://docs.heygen.com/reference/avatar-list
socket.on('getAvatarList', async ({}, cb) => {
if (!config.videoAI.enabled || !config.videoAI.apiKey)
return cb({ error: 'Video AI seems disabled, try later!' });
@@ -2153,6 +2152,7 @@ function startServer() {
}
});
// https://docs.heygen.com/reference/get-voices
socket.on('getVoiceList', async ({}, cb) => {
if (!config.videoAI.enabled || !config.videoAI.apiKey)
return cb({ error: 'Video AI seems disabled, try later!' });
@@ -2175,24 +2175,25 @@ function startServer() {
}
});
socket.on('streamingNew', async ({ quality, avatar_name, voice_id }, cb) => {
// https://docs.heygen.com/reference/new-session
socket.on('streamingNew', async ({ quality, avatar_id, voice_id }, cb) => {
if (!roomList.has(socket.room_id)) return;
if (!config.videoAI.enabled || !config.videoAI.apiKey)
return cb({ error: 'Video AI seems disabled, try later!' });
try {
const voice = voice_id ? { voice_id: voice_id } : {};
const response = await axios.post(
`${config.videoAI.basePath}/v1/streaming.new`,
{
quality,
avatar_name,
voice: {
voice_id: voice_id,
},
avatar_id,
voice: voice,
},
{
headers: {
'Content-Type': 'application/json',
'X-Api-Key': config.videoAI.apiKey,
'accept': 'application/json',
'content-type': 'application/json',
'x-api-key': config.videoAI.apiKey,
},
},
);
@@ -2210,6 +2211,7 @@ function startServer() {
}
});
// https://docs.heygen.com/reference/start-session
socket.on('streamingStart', async ({ session_id, sdp }, cb) => {
if (!roomList.has(socket.room_id)) return;
if (!config.videoAI.enabled || !config.videoAI.apiKey)
@@ -2238,6 +2240,7 @@ function startServer() {
}
});
// https://docs.heygen.com/reference/submit-ice-information
socket.on('streamingICE', async ({ session_id, candidate }, cb) => {
if (!roomList.has(socket.room_id)) return;
if (!config.videoAI.enabled || !config.videoAI.apiKey)
@@ -2266,6 +2269,7 @@ function startServer() {
}
});
// https://docs.heygen.com/reference/send-task
socket.on('streamingTask', async ({ session_id, text }, cb) => {
if (!roomList.has(socket.room_id)) return;
if (!config.videoAI.enabled || !config.videoAI.apiKey)
@@ -2322,6 +2326,7 @@ function startServer() {
}
});
// https://docs.heygen.com/reference/close-session
socket.on('streamingStop', async ({ session_id }, cb) => {
if (!roomList.has(socket.room_id)) return;
if (!config.videoAI.enabled || !config.videoAI.apiKey)

عرض الملف

@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.5.86",
"version": "1,5,87",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.86
* @version 1,5,87
*
*/
@@ -4494,7 +4494,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.5.86',
title: 'WebRTC SFU v1,5,87',
html: `
<br />
<div id="about">

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.86
* @version 1,5,87
*
*/
@@ -168,9 +168,9 @@ const VideoAI = {
enabled: true,
active: false,
info: {},
avatar: null,
avatarId: null,
avatarName: 'Monica',
avatarVoice: '',
avatarVoice: null,
quality: 'medium',
virtualBackground: true,
background: '../images/virtual/1.jpg',
@@ -7885,7 +7885,7 @@ class RoomClient {
'default',
];
//console.log('AVATARS LISTS', completion.response.avatars);
console.log('AVATARS LISTS', completion.response.avatars);
completion.response.avatars.forEach((avatar) => {
avatar.avatar_states.forEach((avatarUi) => {
if (
@@ -7928,9 +7928,9 @@ class RoomClient {
img.style.border = 'var(--border)';
const avatarData = img.getAttribute('avatarData');
const avatarDataArr = avatarData.split('|');
VideoAI.avatar = avatarDataArr[0];
VideoAI.avatarId = avatarDataArr[0];
VideoAI.avatarName = avatarDataArr[1];
VideoAI.avatarVoice = avatarDataArr[2] ? avatarDataArr[2] : '';
//VideoAI.avatarVoice = avatarDataArr[2] ? avatarDataArr[2] : ''; use the default one
avatarVideoAIPreview.setAttribute('src', avatarUi.video_url.grey);
avatarVideoAIPreview.play();
@@ -8091,11 +8091,11 @@ class RoomClient {
async streamingNew() {
try {
const { quality, avatar, avatarVoice } = VideoAI;
const { quality, avatarId, avatarVoice } = VideoAI;
const response = await this.socket.request('streamingNew', {
quality: quality,
avatar_name: avatar,
avatar_id: avatarId,
voice_id: avatarVoice,
});