add fix
This commit is contained in:
parent
cd52493f82
commit
666f3dc830
@ -162,8 +162,7 @@ async function playMedia(donat, voiceSettings) {
|
||||
mediaPromise = playSpeech(donat.text, voiceSettings);
|
||||
}
|
||||
|
||||
const timeoutPromise = new Promise(r => setTimeout(r, donat.duration * 1000));
|
||||
await Promise.race([mediaPromise, timeoutPromise]);
|
||||
await mediaPromise;
|
||||
} catch (error) {
|
||||
console.error('Media play error:', error);
|
||||
}
|
||||
@ -196,14 +195,12 @@ async function widgetView() {
|
||||
|
||||
clearContainer(contentDiv);
|
||||
|
||||
// Добавление изображения
|
||||
if (donat.image_link) {
|
||||
const img = document.createElement('img');
|
||||
img.src = donat.image_link;
|
||||
contentDiv.appendChild(img);
|
||||
}
|
||||
|
||||
// Отображение имени пользователя
|
||||
if (donat.show_name && donat.donat_user) {
|
||||
const userElem = document.createElement('div');
|
||||
userElem.className = 'donation-user';
|
||||
@ -211,7 +208,6 @@ async function widgetView() {
|
||||
contentDiv.appendChild(userElem);
|
||||
}
|
||||
|
||||
// Отображение текста
|
||||
if (donat.show_text && donat.text) {
|
||||
const textElem = donat.amount ?
|
||||
createTextWithAmount(donat.text, donat.amount) :
|
||||
@ -219,7 +215,6 @@ async function widgetView() {
|
||||
contentDiv.appendChild(textElem);
|
||||
}
|
||||
|
||||
// Воспроизведение медиа
|
||||
const voiceSettings = {
|
||||
voice_speed: donat.voice_speed,
|
||||
scenery: donat.scenery,
|
||||
@ -231,7 +226,6 @@ async function widgetView() {
|
||||
|
||||
await playMedia(donat, voiceSettings);
|
||||
|
||||
// Отправка подтверждения
|
||||
if (donat.order_id) {
|
||||
try {
|
||||
await fetch(widgetUrl + '/widget/donat/viewed', {
|
||||
@ -248,7 +242,6 @@ async function widgetView() {
|
||||
console.error('Ошибка обработки доната:', error);
|
||||
}
|
||||
|
||||
// Пауза между итерациями
|
||||
const elapsed = Date.now() - iterationStart;
|
||||
const remaining = 5000 - elapsed;
|
||||
if (remaining > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user