tkmn0 / SimpleWebRTCExample_iOS

Simple example for WebRTC on iOS written in swift5
MIT License
182 stars 49 forks source link

Hello ! Thanks for your project, little questions here ! #3

Closed Suriteka closed 5 years ago

Suriteka commented 5 years ago

Hello,

First of all thanks a lot for your project ! It helped us a lot, we are touching WebRTC for the first time ! But I have some questions, we actually have a drone (DJI Spark) and we have a Data (Array Buffer) variable.

We have the websocket server, and we actually did a call with your source code. πŸ”₯

So we have something like this

func videoFeed(_ videoFeed: DJIVideoFeed, didUpdateVideoData videoData: Data) {
        if !webRTCClient.isConnected {
            webRTCClient.connect(onSuccess: { (offerSDP: RTCSessionDescription) -> Void in
                self.sendSDP(sessionDescription: offerSDP)
            })
        }

        videoData.withUnsafeBytes { (bytes:UnsafePointer<UInt8>) in
           videoPreview?.push(UnsafeMutablePointer(mutating: bytes), length: Int32(videoData.count))
        }
}

But during the init of WebRTC, You are doing the creation of videoPreview with setupDataChannel. How can I change this to my videoData my videoSource with another source ?

Arigato gozaimasu ! (Trying to learn some nihongo )

tkmn0 commented 5 years ago

hi :) Firstly, I'm glad that you succeed to run my project!

Your project sounds interesting! Do you mean that you want to send your video data ( maybe from drone? ) as WebRTC videoSource? If yes, I do not know yet how to create custom video source from data.

haha, It's awesome! Douitashimashite:) means Je vous en prie.

tkmn0 commented 5 years ago

hi ! I added RTCCustomFrameCapturer class. This class can create video source from CMSampleBuffer. Please check it out.

Actually, I tried to create video source from CVPixelBuffer so that you can create video source from data (or bytes?) but, I found we need CMSampleBuffer to create RTCVideoFrame coz RTCVideoFrame requires time stamp.

Suriteka commented 5 years ago

Hi thanks a lot for your answer ! πŸ‘

We are trying your solutions right now. Actually we are using webRTCClient.sendData(data: videoData) and it works pretty great ! But we will try with your class too. Thanks a lot. ❀️

Oh and by the way, I saw your other project : https://github.com/tkmn0/webrtc_sample Can I use it too to display my drone video in a webpage ? There is no socket connection with a server. Only Ice servers. Should I create one ?

tkmn0 commented 5 years ago

Great!! It's my pleasure haha :)

https://github.com/tkmn0/webrtc_sample is JUST SAMPLE javascript API for WebRTC on browser but does not hove html. Actually, now I'm trying to create browser side simple WebRTC example written in typescript. However, I don't have enough time.

If you create socket connection & viewer side (html) you can connect iOS and web browser each other( I recommend with chrome).

Suriteka commented 5 years ago

Ok I see.

I actually have a socket connection between my browser (client) and my server. Just need to send the good SDP and get the SDP of the drone. And then show the video. But thanks a lot for your help. πŸ˜„

Have a good day in Japan. (Would love to go once in my life πŸ—Ύ)

tkmn0 commented 5 years ago

Sounds good! πŸ‘

I'm looking forward to your project 😁

You too in France:)
Let's meet up if you came to japan.