1 /* 2 * Copyright (c) 2023 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 ARK_MEDIA_ADAPTER_H 17 #define ARK_MEDIA_ADAPTER_H 18 #pragma once 19 20 #include "ohos_adapter/include/ark_graphic_adapter.h" 21 22 namespace OHOS::ArkWeb { 23 24 /*--ark web(source=webcore)--*/ 25 class ArkPlayerCallbackAdapter : public virtual ArkWebBaseRefCounted { 26 public: 27 /*--ark web()--*/ 28 virtual void OnInfo(int32_t type, int32_t extra, int32_t value) = 0; 29 30 /*--ark web()--*/ 31 virtual void OnError(int32_t errorType) = 0; 32 }; 33 34 /*--ark web(source=webview)--*/ 35 class ArkPlayerAdapter : public virtual ArkWebBaseRefCounted { 36 public: 37 /*--ark web()--*/ 38 virtual int32_t SetPlayerCallback(ArkWebRefPtr<ArkPlayerCallbackAdapter> callbackAdapter) = 0; 39 40 /*--ark web()--*/ 41 virtual int32_t SetSource(const ArkWebString& url) = 0; 42 43 /*--ark web()--*/ 44 virtual int32_t SetSource(int32_t fd, int64_t offset, int64_t size) = 0; 45 46 /*--ark web()--*/ 47 virtual int32_t SetVideoSurface(ArkWebRefPtr<ArkIConsumerSurfaceAdapter> cSurfaceAdapter) = 0; 48 49 /*--ark web()--*/ 50 virtual int32_t SetVolume(float leftVolume, float rightVolume) = 0; 51 52 /*--ark web()--*/ 53 virtual int32_t Seek(int32_t mSeconds, int32_t mode) = 0; 54 55 /*--ark web()--*/ 56 virtual int32_t Play() = 0; 57 58 /*--ark web()--*/ 59 virtual int32_t Pause() = 0; 60 61 /*--ark web()--*/ 62 virtual int32_t PrepareAsync() = 0; 63 64 /*--ark web()--*/ 65 virtual int32_t GetCurrentTime(int32_t& currentTime) = 0; 66 67 /*--ark web()--*/ 68 virtual int32_t GetDuration(int32_t& duration) = 0; 69 70 /*--ark web()--*/ 71 virtual int32_t SetPlaybackSpeed(int32_t mode) = 0; 72 }; 73 74 } // namespace OHOS::ArkWeb 75 76 #endif // ARK_MEDIA_ADAPTER_H 77