diff --git a/frameworks/bootanimation/include/boot_animationconfig.h b/frameworks/bootanimation/include/boot_animationconfig.h index 68b3613fb5..c97b93394a 100644 --- a/frameworks/bootanimation/include/boot_animationconfig.h +++ b/frameworks/bootanimation/include/boot_animationconfig.h @@ -29,6 +29,7 @@ public: std::string GetSoundUrl(); std::string GetCustomCfgFile(); std::string GetBootVideoPath(); + std::string GetBootExtraVideoPath(); int32_t GetRotateScreenId(); int32_t GetRotateDegree(); void ParserCustomCfgFile(); diff --git a/frameworks/bootanimation/include/util.h b/frameworks/bootanimation/include/util.h index 892c3bca58..0403a9f9fa 100644 --- a/frameworks/bootanimation/include/util.h +++ b/frameworks/bootanimation/include/util.h @@ -91,6 +91,7 @@ public: std::string custPicZipPath = {}; std::string custSoundsPath = {}; std::string custVideoPath = {}; + std::string custExtraVideoPath = {}; int32_t rotateScreenId = -1; int32_t rotateDegree = 0; }; diff --git a/frameworks/bootanimation/src/boot_animation.cpp b/frameworks/bootanimation/src/boot_animation.cpp index 461b562150..527d214f6a 100644 --- a/frameworks/bootanimation/src/boot_animation.cpp +++ b/frameworks/bootanimation/src/boot_animation.cpp @@ -318,8 +318,10 @@ void BootAnimation::PlayVideo() .userData_ = this, .callback_ = std::bind(&BootAnimation::CloseVideoPlayer, this), }; + LOGI("PlayVideo setVideo screenId:%{public}d", (int32_t)defaultId_); bootVideoPlayer_ = std::make_shared(); - bootVideoPlayer_->SetVideoPath(animationConfig_.GetBootVideoPath()); + bootVideoPlayer_->SetVideoPath( + defaultId_ == 0 ? animationConfig_.GetBootVideoPath() : animationConfig_.GetBootExtraVideoPath()); bootVideoPlayer_->SetPlayerSurface(rsSurfaceNode_ ? rsSurfaceNode_->GetSurface() : nullptr); bootVideoPlayer_->SetCallback(&fcb_); if (!bootVideoPlayer_->PlayVideo()) { diff --git a/frameworks/bootanimation/src/boot_animationconfig.cpp b/frameworks/bootanimation/src/boot_animationconfig.cpp index 5dc8d2c423..5e390dfdd0 100644 --- a/frameworks/bootanimation/src/boot_animationconfig.cpp +++ b/frameworks/bootanimation/src/boot_animationconfig.cpp @@ -117,6 +117,14 @@ std::string BootAnimationConfig::GetBootVideoPath() return custConfig_.custVideoPath; } +std::string BootAnimationConfig::GetBootExtraVideoPath() +{ + if (custConfig_.custExtraVideoPath.empty()) { + return GetBootVideoPath(); + } + return custConfig_.custExtraVideoPath; +} + int32_t BootAnimationConfig::GetRotateScreenId() { return custConfig_.rotateScreenId; diff --git a/frameworks/bootanimation/src/util.cpp b/frameworks/bootanimation/src/util.cpp index 608c7381e7..b8dde9c67c 100644 --- a/frameworks/bootanimation/src/util.cpp +++ b/frameworks/bootanimation/src/util.cpp @@ -75,6 +75,11 @@ bool ReadCustomBootConfig(const std::string& path, BootCustomConfig& aniconfig) aniconfig.custVideoPath = custVideoPath->valuestring; LOGI("cust video path: %{public}s", aniconfig.custVideoPath.c_str()); } + cJSON* custExtraVideoPath = cJSON_GetObjectItem(overallData, "cust.bootanimation.video.extra"); + if (custExtraVideoPath != nullptr && custExtraVideoPath->valuestring != nullptr) { + aniconfig.custExtraVideoPath = custExtraVideoPath->valuestring; + LOGI("cust extra video path: %{public}s", aniconfig.custExtraVideoPath.c_str()); + } cJSON* rotateScreenJson = cJSON_GetObjectItem(overallData, "cust.bootanimation.rotate.screenid"); if (rotateScreenJson != nullptr && rotateScreenJson->valuestring != nullptr) { aniconfig.rotateScreenId = std::stoi(rotateScreenJson->valuestring);