# Android native client support

**URL:** <https://mediasoup.discourse.group/t/android-native-client-support/276>\
**Category:** mediasoup libraries\
**Created:** [September 16, 2019, 3:16pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276 "2019-09-16T15:16:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [September 16, 2019, 3:16pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/1 "2019-09-16T15:16:13Z")

</div>

Planning to add android native client support and android client demo which can communicate with the mediasoup-demo’s server part. Wondering if it is needed or whether someone else is working on it?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [September 16, 2019, 3:26pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/2 "2019-09-16T15:26:33Z")

</div>

It would be extremely good to have an Android app that uses libmediasoupclient and connects to the mediasoup-demo server.

As you can see, we have developed and released libmediasoupclient, but there are not Android/iOS bindings for it. AFAIS there are two options:

1. Create libmediasoupclient bindings for Android and iOS. This is, the API exposed by libmediasoupclient wrapped in Java and ObjetiveC or Swift.
2. Do not create those bindings and instead make each application directly use the C++ API exposed by libmediasoupclient.

I assume the way to go is 1. So if you go that way, and then create an Android demo app, it would be great.

In the other side, we need some help improving the libmediasoupclient build system. Currently it depends on CMake and it depends on **static** libraries (libwebrtc, libsdptransform) and produces a **static** library. Not sure if that would work in Android/iOS environments.

---

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [September 16, 2019, 3:47pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/3 "2019-09-16T15:47:11Z")

</div>

Yep, the way to go is 1. The static library is OK for Android, and the good news is that Android Studio supports using CMake to compile C and C++ code. I’ll work on the Android support and demo app.

There will have two projects `mediasoup-client-android` and `protoo-client-android`.Temporarily, is it ok to create this repo under my GitHub account and use `org.mediasoup.droid` as the package name?

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [September 16, 2019, 11:35pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/4 "2019-09-16T23:35:34Z")

</div>

> [@haiyangwu](#):
>
> There will have two projects `mediasoup-client-android` and `protoo-client-android`

Just take into account that `protoo` is completely unrelated to mediasoup. Of course, you need it to interact with the mediasoup-demo at WebSocket level.

> [@haiyangwu](#):
>
> Temporarily, is it ok to create this repo under my GitHub account and use `org.mediasoup.droid` as the package name?

Which exact repo do you mean? I understand there are 3 repos:

1. `mediasoup-client-android`
2. `protoo-client-androir`
3. `mediasoup-demo-android` (not sure about the name)

---

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [September 17, 2019, 1:22am UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/5 "2019-09-17T01:22:13Z")

</div>

> [@ibc](#):
>
> Which exact repo do you mean? I understand there are 3 repos:
> 
> 1. `mediasoup-client-android`
> 2. `protoo-client-androir`
> 3. `mediasoup-demo-android` (not sure about the name)

2 repos are just ok, I meant that `mediasoup-demo-android` could be put into subdirectory of `mediasoup-client-android`. But 3 repos seems better and create all these 3 repos under my Github account.

`mediasoup-client-android` package name ` org.mediasoup.droid`  
`protoo-client-android` package name ` org.mediasoup.droid.protoo`  
`mediasoup-demo-android` package name ` org.mediasoup.droid.demo`

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [September 17, 2019, 9:37am UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/6 "2019-09-17T09:37:30Z")

</div>

> [@haiyangwu](#):
>
> 2 repos are just ok, I meant that `mediasoup-demo-android` could be put into subdirectory of `mediasoup-client-android` . But 3 repos seems better and create all these 3 repos under my Github account.

If possible, please do not include the demo app into the mediasoup-client Android SDK 🙂

> [@haiyangwu](#):
>
> `mediasoup-client-android` package name `org.mediasoup.droid`  
> `protoo-client-android` package name `org.mediasoup.droid.protoo`  
> `mediasoup-demo-android` package name `org.mediasoup.droid.demo`

We do not need that `protoo-client` for Android is associated with “[mediasoup.org](http://mediasoup.org)” at all. Can you please use any other namespace? You can use `org.protoojs.droid` instead.

---

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [September 17, 2019, 2:40pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/7 "2019-09-17T14:40:25Z")

</div>

Got it. I’ll start working on it.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [September 20, 2019, 2:33pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/8 "2019-09-20T14:33:01Z")

</div>

BTW I’ll mention your work on Januscon in Napoli next week 🙂

 ![18](https://global.discourse-cdn.com/free1/uploads/mediasoup/original/1X/6971cee6b0e24d0ad27a4119877015dbf62c3fcb.png)

---

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [October 6, 2019, 3:30pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/9 "2019-10-06T15:30:09Z")

</div>

Update:

- repo link : [https://github.com/haiyangwu/mediasoup-client-android](https://github.com/haiyangwu/mediasoup-client-android)
- basic struct : Java API \<-\> jni Bridge \<-\> c++ libmediasoupclient
- android develop environment already done

Still, I need several weeks to complete this task. 🤔

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [October 6, 2019, 3:36pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/10 "2019-10-06T15:36:06Z")

</div>

Amazing!

---

<div class="post-metadata">

**Author:** ![jmillan](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/jmillan/32/9_2.png) [@jmillan](https://mediasoup.discourse.group/u/jmillan)\
**Post date:** [October 7, 2019, 1:56pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/11 "2019-10-07T13:56:11Z")

</div>

Looks promising!

---

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [October 26, 2019, 6:25pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/12 "2019-10-26T18:25:45Z")

</div>

A big step forward, update:

- repo link : [https://github.com/haiyangwu/mediasoup-client-android](https://github.com/haiyangwu/mediasoup-client-android)
- complete **all** Java API for [MediasoupClientTest.java](https://github.com/haiyangwu/mediasoup-client-android/blob/dev/mediasoup-client/src/androidTest/java/org/mediasoup/droid/MediasoupClientTest.java) which is migrated from [mediasoupclient.test.cpp](https://github.com/versatica/libmediasoupclient/blob/v3/test/mediasoupclient.test.cpp)

From now on move to the next step mediasoup-demo-android, but still, need several weeks.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [October 27, 2019, 2:24pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/13 "2019-10-27T14:24:49Z")

</div>

Awesome! please update us with news when appropriate. We’ll try to follow it.

---

<div class="post-metadata">

**Author:** ![ethand91](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ethand91/32/14_2.png) [@ethand91](https://mediasoup.discourse.group/u/ethand91)\
**Post date:** [November 7, 2019, 7:09am UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/14 "2019-11-07T07:09:28Z")

</div>

Although still a work in progress, I have also started on working on an android demo app.  
I have managed to get to the point where I can publish a stream from android.  
I’ll link the repository below, although it is still a work in progress:

> **[ethand91/mediasoup-android-sample](https://github.com/ethand91/mediasoup-android-sample)**
>
> Simple Mediasoup@3 Android Sample App. Contribute to ethand91/mediasoup-android-sample development by creating an account on GitHub.

So far no issues with the Android SDK. 🙂  
Really great job!

---

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [November 8, 2019, 2:55am UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/15 "2019-11-08T02:55:37Z")

</div>

Awesome! any issue please let me you. BTW I’ve already started two repo, one is **protoo-android-client** the other is **mediasoup-android-demo** , and let’s work in parallel. 🤫

---

<div class="post-metadata">

**Author:** ![ethand91](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ethand91/32/14_2.png) [@ethand91](https://mediasoup.discourse.group/u/ethand91)\
**Post date:** [November 8, 2019, 10:05am UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/16 "2019-11-08T10:05:35Z")

</div>

@haiyangwu  
I’ve managed to get as far as playing a remote audio consumer without any issues.  
However because Consumer does not implement the getNativeTrack methods, I am unable to play the remote video consumer. 😟

Would this be hard to implement?

---

<div class="post-metadata">

**Author:** ![jmillan](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/jmillan/32/9_2.png) [@jmillan](https://mediasoup.discourse.group/u/jmillan)\
**Post date:** [November 8, 2019, 7:02pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/17 "2019-11-08T19:02:10Z")

</div>

@ethand91,

I don’t know about `getNativeTrack`, and it’s not present in libwebrtc. Could you please elaborate why you are unable to play the remote video consumer?

---

<div class="post-metadata">

**Author:** ![ethand91](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ethand91/32/14_2.png) [@ethand91](https://mediasoup.discourse.group/u/ethand91)\
**Post date:** [November 9, 2019, 12:34pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/18 "2019-11-09T12:34:17Z")

</div>

@jmillan  
We need to pass the consumer.getTrack from libmediasoup to the Android side via JNI in order to play it.  
(c++ consumer.getTrack() -\> JNI consumer.getNativeTrack() and getTrack() -\> Android consumer.getTrack())

At the moment the JNI API for the consumer.getTrack() has not been implemented, so it’s impossible to get the consumer’s track on the Android side.

---

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [November 9, 2019, 12:59pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/19 "2019-11-09T12:59:33Z")

</div>

@ethand91 I’ll implement the getTrack method and give u a update.

---

<div class="post-metadata">

**Author:** ![haiyangwu](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/haiyangwu/32/115_2.png) [@haiyangwu](https://mediasoup.discourse.group/u/haiyangwu)\
**Post date:** [November 9, 2019, 4:04pm UTC](https://mediasoup.discourse.group/t/android-native-client-support/276/20 "2019-11-09T16:04:39Z")

</div>

@ethand91 [A new commit, implement the Consumer#getTrack](https://github.com/haiyangwu/mediasoup-client-android/commit/c13ae79dd41f4cbf3fcc163b63b20935e8cd59b5) has pushed to the repo. 🖖

[Next page](https://mediasoup.discourse.group/t/android-native-client-support/276.md?page=2)
