قالب وردپرس درنا توس
Home / IOS Development / swift – WebRTC (iOS): Local video does not stream on external site

swift – WebRTC (iOS): Local video does not stream on external site



I'm trying to create an app with audio, video call using WebRTC.

remove video and audio works properly in my app, but my local stream is not displayed on the client side.

here's what i've written to add a video track

  let videoSource = self.rtcPeerFactory.videoSource ()
let videoCapturer = RTCCameraVideoCapturer (delegate: videoSource)

guard let frontCamera = (RTCCameraVideoCapturer.captureDevices (). first {$ 0.position == .front}),

// Select the highest res
la format = (RTCCameraVideoCapturer.supportedFormats (for: frontCamera) .sorted {(f1, f2) -> Bool in
la width1 = CMVideoFormatDescriptionGetDimensions (f1.formatDescription) .width
la width2 = CMVideoFormatDescriptionGetDimensions (f2.formatDescription) .width
return width1
<width2 }).last, // select the highest fps la fps = (format.videoSupportedFrameRateRanges.sorted {return $ 0.maxFrameRate <$ 1.maxFrameRate} .last) other { print (.error, "Error in createLocalVideoTrack") return zero } videoCapturer.startCapture (with: frontCamera, format: format, fps: Int (fps.maxFrameRate)) self.callManagerDelegate? .didAddLocalVideoTrack (videoTrack: videoCapturer) la videoTrack = self.rtcPeerFactory.videoTrack (with: videoSource, trackId: K.CONSTANT.VIDEO_TRACK_ID)

and this is adding soundtracks

  leave restrictions: RTCMediaConstraints = RTCMediaConstraints.init (mandatoryConcertions: [:] optionalContractions: null)

leave the audio source: RTCAudioSource = self.rtcPeerFactory.audioSource (with: restrictions)
leave audioTrack: RTCAudioTrack = self.rtcPeerFactory.audioTrack (with: audioSource, trackId: K.CONSTANT.AUDIO_TRACK_ID)

my full webRTC log attached here.

some logs I get (I think this is something wrong)

  (thread.cc:303): Waiting for the thread to join, but blocking calls are not allowed
(basic_port_allocator.cc:1035): Port [31aba00:0:1:0:relay:Net[ipsec4:2405:204:8888:x:x:x:x:x/64:VPN/Unknown:id=2]]: Port encountered errors while collecting candidates.

...

(basic_port_allocator.cc:1017): Port [38d7400:audio:1:0:local:Net[en0:192.168.1.x/24:Wifi:id=1]]: Port completed collecting candidates.
(basic_port_allocator.cc:1035): Port [3902c00:video:1:0:relay:Net[ipsec5:2405:204:8888:x:x:x:x:x/64:VPN/Unknown:id=3]]: Port encountered errors while collecting candidates.


Source link