AlexKMDev / WebRTC

Unofficial builds of Google WebRTC iOS Framework
https://webrtc.org/native-code/ios/
Other
292 stars 76 forks source link

How to use the method to show localstream in videoview? - for iOS #41

Open PrasannaYuvitime opened 6 years ago

PrasannaYuvitime commented 6 years ago

After updating the webrtc framework for the latest one , I am not getting how to show local stream to user cause methodology is changed which has no sample on repository's "iOS" folder.

in old code...

    RTCVideoCapturer *capturer = [RTCVideoCapturer capturerWithDeviceName:cameraID];
    RTCMediaConstraints *mediaConstraints = [self defaultMediaStreamConstraints];
    RTCVideoSource *videoSource = [_factory videoSourceWithCapturer:capturer constraints:mediaConstraints];
    localVideoTrack = [_factory videoTrackWithID:@"ARDAMSv0" source:videoSource];

The RTCVideoCapturer object and RTCVideoSource object was linked here to each other.

But in new code...

 RTCVideoSource *source = [_factory videoSource];
    RTCCameraVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:source];
    [_delegate appClient:self didCreateLocalCapturer:capturer];
      localVideoTrack = [_factory videoTrackWithSource:source
                                               trackId:kARDVideoTrackId];

There is no connection to each other. So, the delegate method does what , [_delegate appClient:self didCreateLocalCapturer:capturer]; I am not getting it. [Help Required!]

roxxydev commented 6 years ago

Have you resolved this one yet? I'm facing the same problem using Swift, I could not use the video source with RTCCameraVideoCapturer but the documentation or PeerConnectionFactory videoSource says

Initialize a generic RTCVideoSource. The RTCVideoSource should be passed to a RTCVideoCapturer implementation, e.g. RTCCameraVideoCapturer, in order to produce frames.

Ankit-Aggarwal commented 6 years ago

I am having the same problem. Basically, I want to intercept the capture frame rendered to apply some filters.

But i am not getting a way to connect my source and custom capturer.. or capturer to video track.