OneNET IoT Platform Platform Introduction Introduction Manual Guidline for Device Development Guideline for Application Development
API
API Usage API List SDK MQTT LwM2M EDP Modbus TCP
HTTP Push MQ
Other Service Common Question

Instruction of use Android playerSDK

1. Introduction

The SDK is used with the push-stream end of OneNET platform device to realize video playback function, including live streaming, historical streaming, local video viewing, voice push, screenshots and so on. This project is based on ijkplayer and dkplayer.

2. Environment

Android Studio 3.1.2

Gradle 4.4

Platform API 21~27

NDK 16

CPU armv5、armv7、arm64、X86、X86-64

3. Characteristics

Support live broadcast and on-demand

Support RTMP, RTMPE, HLS, HTTPS play

Support RTMP, RMPE live broadcast voice push

Support playing screenshots (except surfaceview decoder scenes)

Optimize RTMP homepage opening time

Optimize the variable frame rate soft decoding process, dynamically adjust the number of decoding threads according to the frame rate

4. Get

Source code address: https://github.com/cm-heclouds/AndroidPlayerSDK Or add the following code to build.gradle

repositories {
    jcenter()
}
dependencies {
    implementation "com.ont.media:ontplayer-native:1.0.0"
implementation "com.ont.media:ontplayer-java:1.0.0"
implementation "com.ont.media:ontplayer-ui:1.0.0"
}

5. DEMO Example

5.1 Encryption Settings

OneNET video service > Can set whether the video stream is encrypted to receive at product profile, and the setting corresponds to different broadcast protocols.

5.2 Playback Function

Enter device ID on the homepage, camera channel ID and APIKey to enter the player interface.

pic1

5.2.1 Live Streaming

In the upper left corner of the player interface, you can switch between live video broadcast and on-demand playback. In the live video broadcast interface, protocol type and clarity can be selected to obtain the live broadcast address (The corresponding device on the push-stream end must be online) for playing, or the live broadcast address can be directly input for playing.

pic1

5.2.2 Playback

Device video - get the historical video on the push-stream end device

Server video - get the video recorded by the server

Local video - play local video files

pic1

For usage of each API of the function, see "OneNET Video Service Http API Interface Introductions".

5.3. Voice Push

5.3.1. Implement the following interfaces in BaseVideoController

@Override
public void onSupportPushAudio(boolean support) {

    if (support) {
        // the protocol supports voice push
// ......
// such as audioButton.setVisibility(VISIBLE);
    } else {
// the protocol does not support voice push
// ......
}
}

@Override
public void onEnablePushAudio(boolean enable) {

// whether the voice function is available current
// ......
    // such as audioButton.setEnabled(enable);
}



@Override
public void onStoppedPushAudio() {

// voice function has been passively stopped
// ......
    // such as audioButton.setText("sound recording");
}

5.3.2. Call the following interface in IjkVideoView

public int startPushAudio() 
public int stopPushAudio()

5.4. Screenshot Function

Support TextureView screenshot, support SurfaceView soft decoding screenshot; save generated pictures to local.

5.4.1. Call the following interface in IjkVideoView

public void doScreenshot()

5.4.2. Realize the following interface in BaseVideoController

@Override
public void onScreenshotComplete(int ret, String path) {

// Screenshot completed
// ......
}

5.4.3. SurfaceView soft decoding screenshot needs to open the following options

mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "ffplaycodec-screenshot-path", "/sdcard/OntRoot");

mMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "ffplaycodec-screenshot", 1);

6.Licence

Copyright (c) 2018 cmiot

Licensed under LGPLv2.1 or later

results matching ""

    No results matching ""