Отправить набор образцов воспроизведения аудио (не микрофон) через Webrtc - PullRequest
0 голосов
/ 01 февраля 2019

Я могу отправить образцы видео Replaykit на удаленный узел, но без звука.Что использовать вместо RTCVideoFrame?Есть ли способ отправить аудио-видео вместе?

Ниже приведен фрагмент:

 var peerConnectionFactory: RTCPeerConnectionFactory?
        var localVideoSource: RTCVideoSource?
        var videoCapturer: RTCVideoCapturer?
        func setupVideoCapturer(){
                // localVideoSource and videoCapturer will use 
                localVideoSource = self.peerConnectionFactory!.videoSource() 
                videoCapturer = RTCVideoCapturer()
                localVideoSource.capturer(videoCapturer, didCapture: videoFrame!)

                let videoTrack : RTCVideoTrack =   self.peerConnectionFactory!.videoTrack(with: localVideoSource, trackId: "100”)

                let mediaStream: RTCMediaStream = (self.peerConnectionFactory?.mediaStream(withStreamId: “1"))!
                mediaStream.addVideoTrack(videoTrack)
                self.newPeerConnection!.add(mediaStream)
            }


     override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {
         switch sampleBufferType {
                   case RPSampleBufferType.video:

                // create the CVPixelBuffer
                let pixelBuffer:CVPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)!;

                // create the RTCVideoFrame
                var videoFrame:RTCVideoFrame?;
                let timestamp = NSDate().timeIntervalSince1970 * 1000
                videoFrame = RTCVideoFrame(pixelBuffer: pixelBuffer, rotation: RTCVideoRotation._0, timeStampNs: Int64(timestamp))
                // connect the video frames to the WebRTC
                localVideoSource.capturer(videoCapturer, didCapture: videoFrame!)

                break
            }
        } 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...