CloudHub Docs
Download Documents

RTS


Quick start RTS SDK

prepare

  1. Engineering that integrates the SDK is required

  2. cloudhub_rts.aar package

integration SDK

1. copy cloudhub_rts.aar

Copy the aar package to the libs folder under the project. The libs folder needs to be at the same level as the src folder.

2. Add dependency in gradle

repositories{
    flatDir{
        dirs'libs'
    }
}

At the same time, under the dependencies node, add api(name:‘cloudhub_rts’,ext:‘aar’)

3. Add permissions

<uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    

Realize RTS live broadcast

Create RTS Views

Create an RTS real-time streaming user views according to actual business scenarios

You can refer to the sample code in Android RTS SDK DEMO

Integration Push Stream

1.Create RtsUpStream

Before calling other APIs, you need to create and initialize an RtsUpStream object. When initializing RtsUpStream, you need to provide a callback event handler. For specific information about the event, please refer to Overview

RtsEngine->createUpStream()

2.Set up audio equipment

upStream->startCamera();
upStream->startMicrophone();

3.Local preview

upStream->startPlayingLocalVideo();

4.Start streaming

upStream->startPlayingLocalVideo();

5.Stop streaming

According to business requirements, call stopPush to end the push, and then release the upstream.

upStream->stopPush();
RtsEngine->deleteUpStream(upStream);

Integrated pull stream

1.Create RtsDownStream

Before calling other APIs, you need to create and initialize an RtsDownStream object. When initializing RtsDownStream, you need to provide a callback event handler. For specific information about the event, please refer to Overview

RtsEngine->createDownStream();

2.Video playback

upStream->startPlayingRemoteVideo();

3.Start to pull

upStream->startPull(url);

4.Stop streaming

According to business needs, call stopPull to end the pull stream, and then release the downstream stream.

downStream->stopPull();
RtsEngine->deleteDownStream(upStream);

More methods and example codes

Refer to Overview Method description and Android RTS SDK DEMO Related implementations in.