Agora Java API Reference for Android

NGIAgoraRtmpLocalUser.h
1 //
2 // Agora RTMP connection
3 //
4 // Created by Haonong Yu in 2020-02.
5 // Copyright (c) 2020 Agora.io. All rights reserved.
6 //
7
8 #pragma once // NOLINT(build/header_guard)
9
10 #include "NGIAgoraAudioTrack.h"
11 #include "NGIAgoraVideoTrack.h"
12
13 namespace agora {
14 namespace rtc {
15
16 struct RtmpStreamingAudioConfiguration;
17 struct RtmpStreamingVideoConfiguration;
18
22 enum PublishAudioError {
26 PUBLISH_AUDIO_ERR_OK = 0,
27
31 PUBLISH_AUDIO_ERR_FAILED = 1,
32 };
33
37 enum PublishVideoError {
41 PUBLISH_VIDEO_ERR_OK = 0,
42
46 PUBLISH_VIDEO_ERR_FAILED = 1,
47 };
48
52 class IRtmpLocalUserObserver {
53 public:
54 virtual ~IRtmpLocalUserObserver() {}
55
62 virtual void onAudioTrackPublishSuccess(agora_refptr<rtc::ILocalAudioTrack> audioTrack) = 0;
63
67 virtual void onAudioTrackPublishStart(agora_refptr<rtc::ILocalAudioTrack> audioTrack) = 0;
68
72 virtual void onAudioTrackUnpublished(agora_refptr<rtc::ILocalAudioTrack> audioTrack) = 0;
73
80 virtual void onAudioTrackPublicationFailure(agora_refptr<rtc::ILocalAudioTrack> audioTrack,
81 PublishAudioError error) = 0;
82
88 virtual void onVideoTrackPublishSuccess(agora_refptr<rtc::ILocalVideoTrack> videoTrack) = 0;
89
93 virtual void onVideoTrackPublishStart(agora_refptr<rtc::ILocalVideoTrack> videoTrack) = 0;
94
98 virtual void onVideoTrackUnpublished(agora_refptr<rtc::ILocalVideoTrack> videoTrack) = 0;
99
106 virtual void onVideoTrackPublicationFailure(agora_refptr<rtc::ILocalVideoTrack> videoTrack,
107 PublishVideoError error) = 0;
108 };
109
117 class IRtmpLocalUser {
118 public:
119
120 enum VideoBitrateAdjustType {
121 None = 0,
122 Increasing = 1, // The buffer is in good declining state to increase bitrate
123 Decreasing = 2, // The buffer is in bad increasing state to decrease bitrate
124 };
125
126 virtual ~IRtmpLocalUser() {}
127
137 virtual int setAudioStreamConfiguration(const RtmpStreamingAudioConfiguration& config, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
138
148 virtual int setVideoStreamConfiguration(const RtmpStreamingVideoConfiguration& config, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
149
159 virtual int adjustRecordingSignalVolume(int volume, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
160
169 virtual int getRecordingSignalVolume(int32_t* volume) = 0;
170
185 virtual int adjustVideoBitrate(VideoBitrateAdjustType type, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
186
198 virtual int setVideoEnabled(bool enabled, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
199
208 virtual int publishAudio(agora_refptr<rtc::ILocalAudioTrack> audioTrack, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
209
218 virtual int unpublishAudio(agora_refptr<rtc::ILocalAudioTrack> audioTrack, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
219
228 virtual int publishVideo(agora_refptr<rtc::ILocalVideoTrack> videoTrack, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
229
237 virtual int unpublishVideo(agora_refptr<rtc::ILocalVideoTrack> videoTrack, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
238
250 virtual int registerRtmpUserObserver(IRtmpLocalUserObserver* observer, void(*safeDeleter)(IRtmpLocalUserObserver*) = NULL, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
251
260 virtual int unregisterRtmpUserObserver(IRtmpLocalUserObserver* observer) = 0;
270 virtual int registerAudioFrameObserver(media::IAudioPcmFrameSink* observer, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
271
277 virtual void unregisterAudioFrameObserver(media::IAudioPcmFrameSink* observer) = 0;
278
288 virtual int registerVideoFrameObserver(media::base::IVideoFrameObserver* observer, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
289
295 virtual void unregisterVideoFrameObserver(media::base::IVideoFrameObserver* observer) = 0;
296 };
297
298 } // namespace rtc
299 } // namespace agora
agora::rtc::IRtmpLocalUserObserver::onVideoTrackPublishStart
virtual void onVideoTrackPublishStart(agora_refptr< rtc::ILocalVideoTrack > videoTrack)=0
agora::rtc::IRtmpLocalUser::setVideoEnabled
virtual int setVideoEnabled(bool enabled, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::media::IAudioPcmFrameSink
Definition: AgoraMediaBase.h:1395
agora::rtc::IRtmpLocalUser::unregisterVideoFrameObserver
virtual void unregisterVideoFrameObserver(media::base::IVideoFrameObserver *observer)=0
agora::agora_refptr
Definition: AgoraRefPtr.h:44
agora::rtc::IRtmpLocalUserObserver::onVideoTrackPublicationFailure
virtual void onVideoTrackPublicationFailure(agora_refptr< rtc::ILocalVideoTrack > videoTrack, PublishVideoError error)=0
agora::rtc::IRtmpLocalUser::registerAudioFrameObserver
virtual int registerAudioFrameObserver(media::IAudioPcmFrameSink *observer, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::media::base::IVideoFrameObserver
Definition: AgoraMediaBase.h:1172
agora::rtc::IRtmpLocalUser::unregisterAudioFrameObserver
virtual void unregisterAudioFrameObserver(media::IAudioPcmFrameSink *observer)=0
agora::rtc::IRtmpLocalUserObserver
Definition: NGIAgoraRtmpLocalUser.h:52
agora::rtc::IRtmpLocalUser::setAudioStreamConfiguration
virtual int setAudioStreamConfiguration(const RtmpStreamingAudioConfiguration &config, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::IRtmpLocalUser::getRecordingSignalVolume
virtual int getRecordingSignalVolume(int32_t *volume)=0
agora::rtc::IRtmpLocalUserObserver::onAudioTrackUnpublished
virtual void onAudioTrackUnpublished(agora_refptr< rtc::ILocalAudioTrack > audioTrack)=0
agora::rtc::IRtmpLocalUser::unpublishVideo
virtual int unpublishVideo(agora_refptr< rtc::ILocalVideoTrack > videoTrack, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::RtmpStreamingVideoConfiguration
Definition: NGIAgoraRtmpConnection.h:51
agora::rtc::IRtmpLocalUser::setVideoStreamConfiguration
virtual int setVideoStreamConfiguration(const RtmpStreamingVideoConfiguration &config, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::RtmpStreamingAudioConfiguration
Definition: NGIAgoraRtmpConnection.h:22
agora::rtc::IRtmpLocalUserObserver::onVideoTrackUnpublished
virtual void onVideoTrackUnpublished(agora_refptr< rtc::ILocalVideoTrack > videoTrack)=0
agora::rtc::IRtmpLocalUser::publishAudio
virtual int publishAudio(agora_refptr< rtc::ILocalAudioTrack > audioTrack, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::IRtmpLocalUserObserver::onAudioTrackPublishStart
virtual void onAudioTrackPublishStart(agora_refptr< rtc::ILocalAudioTrack > audioTrack)=0
agora::rtc::IRtmpLocalUser::adjustVideoBitrate
virtual int adjustVideoBitrate(VideoBitrateAdjustType type, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::IRtmpLocalUser::registerVideoFrameObserver
virtual int registerVideoFrameObserver(media::base::IVideoFrameObserver *observer, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::IRtmpLocalUser::adjustRecordingSignalVolume
virtual int adjustRecordingSignalVolume(int volume, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::IRtmpLocalUserObserver::onAudioTrackPublishSuccess
virtual void onAudioTrackPublishSuccess(agora_refptr< rtc::ILocalAudioTrack > audioTrack)=0
agora::rtc::IRtmpLocalUser
Definition: NGIAgoraRtmpLocalUser.h:117
agora::rtc::IRtmpLocalUser::unpublishAudio
virtual int unpublishAudio(agora_refptr< rtc::ILocalAudioTrack > audioTrack, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::IRtmpLocalUserObserver::onVideoTrackPublishSuccess
virtual void onVideoTrackPublishSuccess(agora_refptr< rtc::ILocalVideoTrack > videoTrack)=0
agora::rtc::IRtmpLocalUserObserver::onAudioTrackPublicationFailure
virtual void onAudioTrackPublicationFailure(agora_refptr< rtc::ILocalAudioTrack > audioTrack, PublishAudioError error)=0
agora::rtc::IRtmpLocalUser::unregisterRtmpUserObserver
virtual int unregisterRtmpUserObserver(IRtmpLocalUserObserver *observer)=0
agora::rtc::IRtmpLocalUser::registerRtmpUserObserver
virtual int registerRtmpUserObserver(IRtmpLocalUserObserver *observer, void(*safeDeleter)(IRtmpLocalUserObserver *)=NULL, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::IRtmpLocalUser::publishVideo
virtual int publishVideo(agora_refptr< rtc::ILocalVideoTrack > videoTrack, aosl_ref_t ares=AOSL_REF_INVALID)=0