From e11045101072212bec10c46e475296f17a37efc2 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Fri, 17 Apr 2026 18:28:50 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E9=BB=91=E8=84=B8=E6=81=A2?= =?utf8?q?=E5=A4=8D=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../thunderbird/src/ThunderBirdMainView.cpp | 3 ++- .../thunderbird/src/ThunderBirdModel.cpp | 20 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp index 3a6694ab5..7fed3991f 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp @@ -638,7 +638,8 @@ namespace OHOS // 但是,如果视频线程不存在(videoPlay_ == nullptr 或 isExited_),则强制切换 bool videoThreadExists = (videoPlay_ != nullptr && videoPlay_->isEntered_ && - !videoPlay_->isExited_); + !videoPlay_->isExited_ && + !videoPlay_->playError_); if (currentVideoPath_ == targetPath && videoThreadExists) { diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index b523f65bd..abb4f0e0d 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -2327,11 +2327,13 @@ extern "C" { view->UpdateBatteryProcess(); } - // 检查视频线程是否存在,如果不存在则切换到眨眼表情 + /* 视频健康:线程在且未退出,且未上报播放错误。Surface 连续申请失败会走 EVNET_VIDEO_RUNNING_ERR → playError_=true, + * 此时 isEntered_ 可能仍为 true,旧逻辑会误判为“视频仍在”,不触发眨眼/恢复(黑脸)。 */ if (view != nullptr) { bool videoThreadExists = (view->videoPlay_ != nullptr && view->videoPlay_->isEntered_ && - !view->videoPlay_->isExited_); + !view->videoPlay_->isExited_ && + !view->videoPlay_->playError_); if (!videoThreadExists) { // 视频线程不存在 @@ -3233,13 +3235,15 @@ extern "C" { // 切换到 wink 表情(用于视频切换失败时的回退) void ThunderBirdModel::SwitchToWinkingExpression() { - // 检查 eyesShape_ 和 eyesColor_ 是否已初始化 + const std::string shape = eyesShape_.empty() ? "calm-eyes" : eyesShape_; + const std::string color = eyesColor_.empty() ? "amber" : eyesColor_; if (eyesShape_.empty() || eyesColor_.empty()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::SwitchToWinkingExpression: eyesShape_ or eyesColor_ is empty, cannot switch to winking"); - return; + WEARABLE_LOGW(WEARABLE_LOG_MODULE_APP, + "SwitchToWinkingExpression: eyes empty, use default CloseEyes path (%s/%s)", + shape.c_str(), color.c_str()); } - - std::string winkingExpressionPath = "/user/res/video/CloseEyes/" + eyesShape_ + "/" + eyesColor_ + ".mp4"; + + std::string winkingExpressionPath = "/user/res/video/CloseEyes/" + shape + "/" + color + ".mp4"; // 检查文件是否存在 if (access(winkingExpressionPath.c_str(), F_OK) == 0) { @@ -3986,7 +3990,7 @@ extern "C" { // StartStoryAudioPlaybackTimeoutTimer(); /* 先注释:第一句播完不开启5秒超时 */ } else { // 后续音频播放结束,刷新5秒超时定时器 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioPlaybackEnd: 故事模式音频播放结束,刷新5秒超时定时器"); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioPlaybackEnd: 故事模式音频播放结束,刷新5秒超时定时器"); // 停止旧的定时器并重新启动,实现刷新 // StopStoryAudioPlaybackTimeoutTimer(); //StartStoryAudioPlaybackTimeoutTimer(); -- 2.17.1