I am creating an iOS application where basic real-time streaming required
- Broadcaster/host streaming video/audio in a room
- Guests join room and stream video/audio
I have integrated mediasoup-ios-client and the web socket iOS library Starscream on the client-side.
For the server I copied the mediasoup-demo server since all the capabilities needed already written there and found it a good place to move fast and understand the mediasoup API better.
I am listing below the steps I am taking and successfully implemented so far in iOS client.
- websocket is connected:
["Origin": "wss://192.168.2.4:4443", "Upgrade": "websocket", "Sec-WebSocket-Accept": "9XBEhU0BaApchES+R3iu5FH23OY=", "Connection": "Upgrade", "Sec-WebSocket-Protocol": "protoo"]
- Mediasoupclient.initialize()
- HTTP API getRoomRtpCapabilities
('/rooms/:roomId')
MediasoupDevice.init
MediasoupDevice.load(rtpCapabilities)
-
mediasoupDevice!.isLoaded()
=> true - HTTP API createBroadcaster
('/rooms/:roomId/broadcasters')
=>{"peers":[]}
- HTTP API createBroadcasterTransport
('/rooms/:roomId/broadcasters/:broadcasterId/transports')
=>{ "iceCandidates" : [ ... ], "dtlsParameters" : { "fingerprints" : [ ... ], "role" : "auto" }, "id" : "...", "iceParameters" : { ... } }
- HTTP API connectBroadcasterTransport
('/rooms/:roomId/broadcasters/:broadcasterId/transports/:transportId/connect')
=> It looks like I don’t receive any JSON response here
Do I need to create a Producer ('/rooms/:roomId/broadcasters/:broadcasterId/transports/:transportId/producers')
and a Consumer ('/rooms/:roomId/broadcasters/:broadcasterId/transports/:transportId/consume')
for the broadcaster/host as next steps?
Client-side after creating the broadcaster transport do I need to cal MediasoupDevice.createSendTransport
and MediasoupDevice.createRecvTransport
.
Still wrapping my head around the communication needed, I appreciate your help.