1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_PLAYER_H 17 #define FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_PLAYER_H 18 19 #ifdef PLAYER_FRAMEWORK_ENABLE 20 #include "player.h" 21 #endif 22 #include "transaction/rs_interfaces.h" 23 #include "util.h" 24 25 namespace OHOS { 26 static const int MAX_WAIT_MEDIA_CREATE_TIME = 5000000; // 5S 27 28 class BootPlayer { 29 public: ~BootPlayer()30 virtual ~BootPlayer() {}; 31 Play()32 virtual void Play() {}; 33 GetResPath(const std::string & type)34 std::string GetResPath(const std::string& type) 35 { 36 if (IsFileExisted(resPath_)) { 37 return FILE_PREFIX + resPath_; 38 } 39 return type == TYPE_VIDEO ? BOOT_VIDEO_PATH : BOOT_SOUND_PATH; 40 } 41 42 Rosen::ScreenId screenId_; 43 std::string resPath_; 44 bool isSoundEnabled_ = false; 45 std::shared_ptr<Media::Player> mediaPlayer_; 46 }; 47 } // namespace OHOS 48 49 #endif // FRAMEWORKS_BOOTANIMATION_INCLUDE_BOOT_PLAYER_H 50