From 50a74935f18aa03b30f9e595507d6af98360fb5f Mon Sep 17 00:00:00 2001 From: nnwang <10577303+nnwang@user.noreply.gitee.com> Date: Sun, 22 Feb 2026 05:20:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9speakerlib=E7=9A=84=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- play.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/play.lua b/play.lua index 80e3d19..41c591b 100644 --- a/play.lua +++ b/play.lua @@ -74,7 +74,8 @@ print("task_id: " .. task_id) -- 用于记录已打印的日志数量,避免重复打印 local total_logs_printed = 0 -speakerrun = true +local speakerrun = true + while true do @@ -106,9 +107,17 @@ while true do total_logs_printed = total_logs_printed + #task_info.new_logs end + local main_audio_url = server_url .. task_info.result.audio_urls.audio_dfpwm_url + local left_audio_url = server_url .. task_info.result.audio_urls.audio_dfpwm_left_url + local right_audio_url = server_url .. task_info.result.audio_urls.audio_dfpwm_right_url + if task_info.result.audio_urls and speakerrun then speakerrun = false - shell.run("bg speakerlib play ".. server_url .. task_info.result.audio_urls.audio_dfpwm_url .." ".. server_url .. task_info.result.audio_urls.audio_dfpwm_left_url .." ".. server_url .. task_info.result.audio_urls.audio_dfpwm_right_url) + local new_tab_id = shell.openTab(mypath.."/speakerlib","play",main_audio_url,left_audio_url,right_audio_url) + local tab_id = multishell.getCurrent() + -- 切换一次进程,让其可以自然关闭 + multishell.setFocus(new_tab_id) + multishell.setFocus(tab_id) end -- 检查是否完成 @@ -132,18 +141,11 @@ videoInfo.fps = 20 videoInfo.frame_urls = {} --- /frames/20116713/frame_000001.png + for i = 1, videoInfo.total_frames - 10 do videoInfo.frame_urls[i] = "/frames/"..task_id.."/frame_" .. string.format("%06d", i) .. ".png" end --- 播放音频 单通道 ---shell.run("bg speaker play", server_url .. videoInfo.audio_dfpwm_url) - --- server_url .. videoInfo.audio_urls.audio_dfpwm_url -- 音频单通道文件 URL --- server_url .. videoInfo.audio_urls.audio_dfpwm_right_url -- 音频右通道文件 URL --- server_url .. videoInfo.audio_urls.audio_dfpwm_left_url -- 音频左通道文件 URL - -- 下载和播放函数 frames = {} local frameCount = 0