Audio and video calls are supported only in baseline 10.1.68 and later.
Prerequisites
If you use the native AAR approach, first complete Add mPaaS to your project. Then, make sure that the
build.gradlefile in the project's root directory contains the following dependency:classpath 'com.android.boost.easyconfig:easyconfig:2.8.4'Make sure that the
build.gradlefile of the main project (android main module) contains the following configuration:apply plugin: 'com.alipay.apollo.baseline.config'If you use the component-based (Portal & Bundle) approach, first complete the component-based integration process.
Add the SDK
Native AAR approach
Follow the instructions in AAR component management to install the Audio and Video Call component in your project using Component Management (AAR).
Component-based approach
In your Portal and Bundle projects, install the Audio and Video Call component using Component Management. For more information, see Manage component dependencies.
Initialize mPaaS
If you use the native AAR approach, you need to initialize mPaaS.
Add the following code to your Application class:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Initialize mPaaS
MP.init(this);
}
}For more information, see Initialize mPaaS.
Use the SDK
Initialize the engine and enable automatic publishing and subscribing by setting
autoPublishandautoSubscribeto true.AlipayRtcEngine rtcEngine = AlipayRtcEngine.getInstance( this ); rtcEngine.setRtcListenerAndHandler( engineEventListener, eventHandler ); rtcEngine.setImListener( imListener ); rtcEngine.setInviteListener( inviteListener ); rtcEngine.setServerAddr( SERVER_ONLINE ); rtcEngine.setAutoPublishSubscribe( autoPublish, autoSubscribe ); publishConfig = new PublishConfig(); rtcEngine.configAutoPublish( publishConfig );Create or join a channel.
CreateRoomParams createRoomParams = new CreateRoomParams(); rtcEngine.createRoom( createRoomParams ); JoinRoomParams joinRoomParams = new JoinRoomParams(); rtcEngine.joinRoom( joinRoomParams );Add a listener for the local and remote views.
Local:
onCameraPreviewInfo(final ARTVCView view )Remote:
void onRemoteViewFirstFrame( final FeedInfo info, final ARTVCView _view )