• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2025 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 "av_session_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     ErrCode OnAVCallAnswer() override;
31     ErrCode OnAVCallHangUp() override;
32     ErrCode OnAVCallToggleCallMute() override;
33     ErrCode OnPlay() override;
34     ErrCode OnPause() override;
35     ErrCode OnStop() override;
36     ErrCode OnPlayNext() override;
37     ErrCode OnPlayPrevious() override;
38     ErrCode OnFastForward(int64_t time) override;
39     ErrCode OnRewind(int64_t time) override;
40     ErrCode OnSeek(int64_t time) override;
41     ErrCode OnSetSpeed(double speed) override;
42     ErrCode OnSetLoopMode(int32_t loopMode) override;
43     ErrCode OnSetTargetLoopMode(int32_t targetLoopMode) override;
44     ErrCode OnToggleFavorite(const std::string& mediaId) override;
45     ErrCode OnMediaKeyEvent(const MMI::KeyEvent& keyEvent) override;
46     ErrCode OnOutputDeviceChange(const int32_t connectionState, const OutputDeviceInfo& outputDeviceInfo) override;
47     ErrCode OnCommonCommand(const std::string& commonCommand, const AAFwk::WantParams& commandArgs) override;
48     ErrCode OnSkipToQueueItem(int32_t itemId) override;
49     ErrCode OnPlayFromAssetId(int64_t assetId) override;
50     ErrCode OnPlayWithAssetId(const std::string& assetId) override;
51     ErrCode OnCastDisplayChange(const CastDisplayInfo& castDisplayInfo) override;
52     ErrCode OnCastDisplaySizeChange(const CastDisplayInfo& castDisplayInfo) override;
53     ErrCode OnCustomData(const AAFwk::WantParams& extras) override;
54 
55 private:
56     std::shared_ptr<AVSessionCallback> callback_;
57     static constexpr const char* EVENT_NAME = "AVSessionCallback";
58 };
59 } // namespace OHOS::AVSession
60 #endif // OHOS_AVSESSION_CALLBACK_CLIENT_H