1 /* 2 * Copyright (c) 2021-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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_VIDEO_VIDEO_MODEL_NG_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_VIDEO_VIDEO_MODEL_NG_H 18 19 #include "core/components_ng/base/frame_node.h" 20 #include "core/components_ng/pattern/video/video_model.h" 21 22 namespace OHOS::Ace::NG { 23 24 class ACE_EXPORT VideoModelNG : public OHOS::Ace::VideoModel { 25 public: 26 void Create(const RefPtr<VideoControllerV2>& videoController) override; 27 void SetSrc(const std::string& src, const std::string& bundleName, const std::string& moduleName) override; 28 void SetProgressRate(double progressRate) override; 29 void SetPosterSourceInfo(const std::string& posterUrl, const std::string &bundleName, 30 const std::string &moduleName) override; 31 void SetPosterSourceByPixelMap(RefPtr<PixelMap>& pixMap) override; 32 void SetMuted(bool muted) override; 33 void SetAutoPlay(bool autoPlay) override; 34 void SetControls(bool controls) override; 35 void SetObjectFit(ImageFit objectFit) override; 36 void SetLoop(bool loop) override; 37 38 void SetOnStart(VideoEventFunc&& onStart) override; 39 void SetOnPause(VideoEventFunc&& onPause) override; 40 void SetOnFinish(VideoEventFunc&& onFinish) override; 41 void SetOnError(VideoEventFunc&& onError) override; 42 void SetOnPrepared(VideoEventFunc&& onPrepared) override; 43 void SetOnSeeking(VideoEventFunc&& onSeeking) override; 44 void SetOnSeeked(VideoEventFunc&& onSeeked) override; 45 void SetOnUpdate(VideoEventFunc&& onUpdate) override; 46 void SetOnFullScreenChange(VideoEventFunc&& onFullScreenChange) override; 47 void SetOnStop(VideoEventFunc&& onStop) override; 48 void EnableAnalyzer(bool enable) override; 49 void SetImageAnalyzerConfig(void* config) override; 50 void SetImageAIOptions(void *options) override; 51 static void SetAutoPlay(FrameNode* frameNode, bool autoPlay); 52 static void SetControls(FrameNode* frameNode, bool controls); 53 static void SetObjectFit(FrameNode* frameNode, ImageFit objectFit); 54 static void SetLoop(FrameNode* frameNode, bool loop); 55 static void SetMuted(FrameNode* frameNode, bool muted); 56 }; 57 58 } // namespace OHOS::Ace::NG 59 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_VIDEO_VIDEO_MODEL_NG_H 60