AppRTCDemo icon indicating copy to clipboard operation
AppRTCDemo copied to clipboard

How can I change the rotation&performance of video or audio?

Open meontheroad opened this issue 10 years ago • 7 comments

@YK-Unit : I don't find the interface in the code about camera rotation,switch font or back camera.Mean while,I can't find the audio interface . Can u tell me where are the interface in the code?

Thank u very much!

meontheroad avatar Oct 20 '14 02:10 meontheroad

I get the camera in method - (BOOL)startRTCTaskAsInitiator:(BOOL)flag withTarget:(NSString *)targetJID in RTCWorker.m. The way to get the front camera is here:

    //add local video track
    if (!self.localVideoCapture) {
        NSString *cameraID = nil;
        //** front camera
        for (AVCaptureDevice *captureDevice in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo] ) {
            if (!cameraID || captureDevice.position == AVCaptureDevicePositionFront) {
                cameraID = [captureDevice localizedName];
            }
        }
        self.localVideoCapture = [RTCVideoCapturer capturerWithDeviceName:cameraID];
    }

If you want to get the back camera, you can use AVCaptureDevicePositionBack instead of AVCaptureDevicePositionFront.

YK-Unit avatar Oct 20 '14 04:10 YK-Unit

@YK-Unit :It can help to get the back camera when begin to connect. I want to switch camera when the two accounts are chatting.So I can't find this interface . also there aren't interfaces include camera rotation,switch audio & video on off .For example, (RTCVideoCapturer *)capturerWithDeviceName:(NSString *)deviceName; in the RTCVideoCapturer.h file。 there aren't rotation interface,0°、90°,270° rotate。 can u help me?

meontheroad avatar Oct 20 '14 06:10 meontheroad

@meontheroad I'm sorry to tell you I'm busy now, maybe you need to enable the functionality by yourself. But I think you can try to reset the localVideoCapture when you change the cameraID. And about the rotate, I have no idea now, maybe you can ask for others. Good luck^-^

YK-Unit avatar Oct 22 '14 09:10 YK-Unit

  • (void)addVideoView { self.rtcVideoView = [[RTCVideoView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width)]; self.rtcVideoView.transform=CGAffineTransformMakeRotation(M_PI/2); self.rtcVideoView.frame=CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); [self.view addSubview:self.rtcVideoView]; }

charleslinkn avatar Nov 03 '14 03:11 charleslinkn

@charleslinkn :Thanku very much for your help,`It's work normal,although it rotate the view not camera。By the the way,Can u tell me how I can switch camera device(between front to back camera)?

meontheroad avatar Nov 08 '14 05:11 meontheroad

as @YK-Unit said

  • (BOOL)startRTCTaskAsInitiator:(BOOL)flag withTarget:(NSString *)targetJID in RTCWorker.m. The way to get the front camera is here:

    //add local video track if (!self.localVideoCapture) { NSString cameraID = nil; //* front camera for (AVCaptureDevice *captureDevice in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo] ) { if (!cameraID || captureDevice.position == AVCaptureDevicePositionFront) { cameraID = [captureDevice localizedName]; } } self.localVideoCapture = [RTCVideoCapturer capturerWithDeviceName:cameraID]; } If you want to get the back camera, you can use AVCaptureDevicePositionBack instead of AVCaptureDevicePositionFront.

charleslinkn avatar Nov 08 '14 05:11 charleslinkn

@charleslinkn :+1: I kown that.But I want to switch camera when the phone is translating with other device. What I mean is that how switch camera when the peer connection is working. Can u help me?

meontheroad avatar Nov 08 '14 06:11 meontheroad