1 /* 2 * Copyright (c) 2022-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 OHOS_AVSESSION_CALLBACK_CLIENT_H 17 #define OHOS_AVSESSION_CALLBACK_CLIENT_H 18 19 #include "avsession_callback_stub.h" 20 #include "avsession_info.h" 21 #include "key_event.h" 22 #include "avsession_log.h" 23 24 namespace OHOS::AVSession { 25 class AVSessionCallbackClient : public AVSessionCallbackStub { 26 public: 27 explicit AVSessionCallbackClient(const std::shared_ptr<AVSessionCallback>& callback); 28 ~AVSessionCallbackClient(); 29 30 void OnAVCallAnswer() override; 31 void OnAVCallHangUp() override; 32 void OnAVCallToggleCallMute() override; 33 void OnPlay() override; 34 void OnPause() override; 35 void OnStop() override; 36 void OnPlayNext() override; 37 void OnPlayPrevious() override; 38 void OnFastForward(int64_t time) override; 39 void OnRewind(int64_t time) override; 40 void OnSeek(int64_t time) override; 41 void OnSetSpeed(double speed) override; 42 void OnSetLoopMode(int32_t loopMode) override; 43 void OnToggleFavorite(const std::string& mediald) override; 44 void OnMediaKeyEvent(const MMI::KeyEvent& keyEvent) override; 45 void OnOutputDeviceChange(const int32_t connectionState, const OutputDeviceInfo& outputDeviceInfo) override; 46 void OnCommonCommand(const std::string& commonCommand, const AAFwk::WantParams& commandArgs) override; 47 void OnSkipToQueueItem(int32_t itemId) override; 48 void OnPlayFromAssetId(int64_t assetId) override; 49 void OnCastDisplayChange(const CastDisplayInfo& castDisplayInfo) override; 50 51 private: 52 std::shared_ptr<AVSessionCallback> callback_; 53 static constexpr const char* EVENT_NAME = "AVSessionCallback"; 54 }; 55 } // namespace OHOS::AVSession 56 #endif // OHOS_AVSESSION_CALLBACK_CLIENT_H