Android IOS WebRTC Audio Video Development Summary (16)

Source: Internet
Author: User

This section mainly shares video calls in the way of operating audio devices on Android and iOS, such as mediating volume size, enabling the speaker (please specify the source of this series of articles reproduced, blog Park Rtc.blacker).

First look at the directory structure in WEBRTC that handles audio device code:

The first way is to call the Android or OBJECTC API directly, the code is as follows (Webrtcaudiotrack.java):

Manipulate audio Devices by invoking the Audiomanager class provided by Android (WebRTC is written in C + +, which calls these Java methods via JNI).

Here's how to manipulate audio devices in iOS (AUDIO_DEVICE_IMPL.MM).

2, before the introduction of another way we can think about it, since WEBRTC is implemented in C + +, you can use JNI to invoke the Android API, and then not through the JNI call Java, but directly call his underlying implementation class library it? With this question we look directly Audio Device initialization method (audio_device_impl.cc):

By compiling the instruction Webrtc_android_opensles to control how the audio device is manipulated, if enabled, the direct call to Opensles,opensles instructions is as follows:

OpenSL ES provides a C-language interface that can be called through C + +, which is basically similar to the interface that is called through Java in Android:

    • Android.media.MediaPlayer
    • Android.media.MediaRecorder

For Android NDK Development, the API provided by OpenSL ES with JNI calls allows you to do most of the audio operations without using Java.

Opensles_input.h content is as follows:

Opensles_output.h as follows:

Above, if there are errors or omissions, please correct or add, thank you!

Android IOS WebRTC Audio Video Development Summary (16)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.