diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp index 878745621..7a5d0f4cf 100644 --- a/es-core/src/components/VideoComponent.cpp +++ b/es-core/src/components/VideoComponent.cpp @@ -121,7 +121,7 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, if (elem->has("size")) { glm::vec2 videoSize {elem->get("size")}; if (videoSize == glm::vec2 {0.0f, 0.0f}) { - LOG(LogWarning) << "VideoComponent: Invalid theme configuration, property " + LOG(LogWarning) << "VideoComponent: Invalid theme configuration, property \"size\" " "for element \"" << element.substr(6) << "\" is set to zero"; videoSize = {0.01f, 0.01f}; @@ -163,14 +163,23 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, } else { mStaticImage.setLinearInterpolation(false); - LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property " - " defined as \"" - << interpolation << "\""; + LOG(LogWarning) << "VideoComponent: Invalid theme configuration, property " + "\"interpolation\" for element \"" + << element.substr(6) << "\" defined as \"" << interpolation << "\""; } } - if (elem->has("default")) - mConfig.defaultVideoPath = elem->get("default"); + if (elem->has("default")) { + const std::string defaultVideo {elem->get("default")}; + if (ResourceManager::getInstance().fileExists(defaultVideo)) { + mConfig.defaultVideoPath = defaultVideo; + } + else { + LOG(LogWarning) + << "VideoComponent: File defined for property \"default\" for element \"" + << element.substr(6) << "\" does not exist: \"" << defaultVideo << "\""; + } + } if (elem->has("defaultImage")) { mStaticImage.setDefaultImage(elem->get("defaultImage")); @@ -178,8 +187,16 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, mDefaultImagePath = elem->get("defaultImage"); } - if (elem->has("path")) - mConfig.staticVideoPath = elem->get("path"); + if (elem->has("path")) { + const std::string staticPath {elem->get("path")}; + if (ResourceManager::getInstance().fileExists(staticPath)) { + mConfig.staticVideoPath = staticPath; + } + else { + LOG(LogWarning) << "VideoComponent: File defined for property \"path\" for element \"" + << element.substr(6) << "\" does not exist: \"" << staticPath << "\""; + } + } if ((properties & ThemeFlags::DELAY) && elem->has("delay")) mConfig.startDelay = @@ -208,17 +225,18 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, mThemeImageTypes = Utils::String::delimitedStringToVector(imageTypes, ","); if (mThemeImageTypes.empty()) { - LOG(LogError) << "VideoComponent: Invalid theme configuration, property " - "contains no values"; + LOG(LogError) << "VideoComponent: Invalid theme configuration, property \"imageType\" " + "for element \"" + << element.substr(6) << "\" contains no values"; } for (std::string& type : mThemeImageTypes) { if (std::find(supportedImageTypes.cbegin(), supportedImageTypes.cend(), type) == supportedImageTypes.cend()) { LOG(LogError) - << "VideoComponent: Invalid theme configuration, property " - "defined as \"" - << type << "\""; + << "VideoComponent: Invalid theme configuration, property \"imageType\" " + "for element \"" + << element.substr(6) << "\" defined as \"" << type << "\""; mThemeImageTypes.clear(); break; } @@ -228,8 +246,9 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, std::stable_sort(sortedTypes.begin(), sortedTypes.end()); if (std::adjacent_find(sortedTypes.begin(), sortedTypes.end()) != sortedTypes.end()) { - LOG(LogError) << "VideoComponent: Invalid theme configuration, property " - "contains duplicate values"; + LOG(LogError) << "VideoComponent: Invalid theme configuration, property \"imageType\" " + "for element \"" + << element.substr(6) << "\" contains duplicate values"; mThemeImageTypes.clear(); } }