iOS native client support

Hello,
I’ve started working on the iOS side of libmediasoup.

I am a complete newbie when it comes to iOS development and I’ve never ported C++ to Objective-C/Swift, so if anyone can help me It would be greatly appreciated.

For now I think I’ve got the base blueprint sorted, and I’m trying to port C++ to Swift (Following various tutorials…)

Repository:

2 Likes

Great! BTW it would be great if your project and this one (mediasoup-client-android) become somehow similar in their design. Remember that you do not need to port any C++ code to ObjC but just use the C++ API exposed by libmediasoupclient and provide an ObjC wrapper for its API.

1 Like

@ibc
For clarity I will try to implement it as close to the android SDK as possible.

From what I’ve read it seems the below is the best approach?
libmediasoup C++ -> Objective-C++ Wrapper -> Objective-C Wrapper.
The above allows objective-c user’s with zero knowledge of c++ to use the library, and with a bridging header also allows Swift users to use the library.

If anyone has a better approach/example implementations please share.
For now I’ll work on the Objective-C++ Wrappers

I’m not an expert in Objective C/C++. Just wondering, why not going directly to Swift instead?

I’m not an expert in Objective C/C++. Just wondering, why not going directly to Swift instead?

Unfortunately this can not be done, We need a way to “port” the c++ object to objective-c/Swift.
Sort of like an iOS version of Android JNI.

For example:
C++ mediasoupclient::Consumer → Objective-C++ (mediasoupclient::Consumer to NSObject) → Objective-C (NSObject)
Swift users will need to use a bridging header to be able to use the Objective-C header.

1 Like

Update:
All of the base libmediasoupclient has been implemented. :slight_smile:
There are still some small things that need to be implemented, which will be complete once I’ve tested it on a sample application.

3 Likes

Amazing. Thanks. Please keep working on it as your convenience. We’ll come back to this to make it oficial in the future when we get some time.

1 Like

Sample client source:

So far I’ve managed to get as far as Producer.produce.
Once the SDK is finalized I’ll start work on the docs.

4 Likes

Looks really nice

Really great @ethand91!

We’ll check it in detail as soon as we get some time.

1 Like

You made you question. Please do not directly mention authors to insist and get a response.

This is an open source project. Don’t ask things for free just because you need them, please.

There is people contributing to mediasoup by making those native SDKs for iOS and Android. That’s a good point to start. You may try them and provide your feedback so there is more people involved into this. We, the authors, do the max we can do taking into account that this is an Open Source project.

Update:
Usage example created:

Still needs a couple of tweaks etc. Also trying to upload it to cocoapods for smoother implementation.
Be grateful if anyone could try to use the library and give me any feedback/advice. (iOS is not my strong point ;))

Thinking of adding the mediasoup-ios-client documentation to the mediasoup website, would this be ok?

1 Like

Hi @Rakshitha-M-Rodrigo, will you be able to test this and provide feedback, please?

We’ll love to have it in the mediasoup website. However, before that we really need to take a depth look into the code to be able to properly document it and provide support here about it if needed. Unfortunately we are specially busy these weeks and it’s not a good timing for it. We promise we’ll do it in the future. In the meanwhile, please document all the API in the README (or wherever you prefer).

For now, I’ve added it to the website here:

is it ok?

4 Likes

@ibc
Understood, For now I’ll put the API in it’s own directory on the repository.

3 Likes

Cocoapods has been supported, making implementation easier.

Next I would like to implement the following:

  • VP9 support (iOS does not enable VP9 support by default)
  • Bitcode support
  • Ability to communicate with mediasoup-demo
  • API documentation
2 Likes

Nice!

However, what do you mean with “Ability to communicate with mediasoup-demo”? It’s up to you, but I would not include any WebSocket nor a demo specific stuff into the lib.

However, what do you mean with “Ability to communicate with mediasoup-demo”?

What I meant was having a sample that communicates with the mediasoup-demo, therefore you don’t need to implement the server side in order to test it out.
Pretty much the iOS version of this sample:

It’s up to you, but I would not include any WebSocket nor a demo specific stuff into the lib

Definitely not going to be including it the lib :wink:

2 Likes

Great