- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi!
how switch camera in ios?
I use :
self.myCamera = AVCaptureDevice.defaultDevice(withDeviceType: .builtInWideAngleCamera, mediaType: AVMediaTypeVideo, position: .front)
let cameraid=self.myCamera?.uniqueID
self.myCameraPar=RTCLocalCameraStreamParameters(videoEnabled: true, audioEnabled: true)
// [parameters setResolutionWidth:352 height:288];
self.myCameraPar?.setResolutionWidth(352, height: 288)
self.myCameraPar?.setCameraId(cameraid!)
self.localCanmerStream=RTCLocalCameraStream(parameters: self.myCameraPar!)
I switch camera,but no success!
/*
let session = AVCaptureSession()
do {
let Input1 = try AVCaptureDeviceInput(device: self.myCamera)
let Input2 = try AVCaptureDeviceInput(device: self.myCamera2)
session.beginConfiguration()
session.removeInput(Input1)
let b = session.canAddInput(Input2)
if(b)
{
session.addInput(Input2)
print("okOKokok")
}
else
{
print("nononono")
}
session.commitConfiguration()
session.startRunning()
*/
I look at API "RTCAVFoundationVideoSource" ,but I can not use.
let t = RTCAVFoundationVideoSource.init(constraints: <#T##RTCMediaConstraints!#>)
t?.useBackCamera = true
- Tags:
- HTML5
- JavaScript*
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I 've set source and localstream like below
source = RTCAVFoundationVideoSource(constraints: mediaConstraints)
source?.useBackCamera = true
localStream = RTCLocalCameraStream(audioEnabled: true, videoSource: source!, error: nil)
and after this just use useBackCamera (true|false) inside my changeCamera() function. I didn't use any cameraParameter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For iOS SDK , switch camera can be done through set useBackCamera as Yes /NO
Following is example code , you can include it to your SwitchCamera() function and it will switch camera over successive calls when i is even or odd
static int i = 0; NSDictionary *mandatoryConstraints = @{@"minWidth" : @"640", @"minHeight" : @"480",@"maxWidth" : @"640", @"maxHeight" : @"480", @"maxFrameRate":@"24", @"minFrameRate":@"24"}; RTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatoryConstraints optionalConstraints:nil]; RTCAVFoundationVideoSource* source=[[RTCAVFoundationVideoSource alloc] initWithConstraints:constraints]; if((i++)%2 == 1){ source.useBackCamera = YES; }else{ source.useBackCamera = NO; } NSError *err=[[NSError alloc]init]; _localStream=[[RTCLocalCameraStream alloc]initWithAudioEnabled:YES VideoSource:source error: &err];
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi , Thank you all。 My problem has been solved
//////////////////////////////////////////////////////
let mandatoryConstraints = ["minWidth":"640","minHeight":"480","maxWidth":"640","maxHeight":"480","maxFrameRate":"16","minFrameRate":"16"]
let constraints = RTCMediaConstraints(mandatoryConstraints: mandatoryConstraints, optionalConstraints: nil)
self.mVideoSource = RTCAVFoundationVideoSource(constraints: constraints)
self.mVideoSource?.useBackCamera = false
self.mIsBackCamera = false
self.localCanmerStream=RTCLocalCameraStream(audioEnabled: true, videoSource: self.mVideoSource!, error: nil)
func switchCamera()
{
if mIsBackCamera
{
self.mVideoSource?.useBackCamera = false
mIsBackCamera = false
}
else
{
self.mVideoSource?.useBackCamera = true
mIsBackCamera = true
}
}
//////////////////////////////////////////////////////////////////////////////////////////
Thinks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to switch camera in v4.0 of iOS client using ICSLocalStream?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Team,
we are also having same issue, how to switch camera in v4.1 for using ICSLocalStream?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Deepesh and krishna,
ICSLocalStream can be initialized with a RTCMediaStream. You can switch position on its associated RTCCameraVideoCapturer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jianjun,
Thanks for your reply,
with out using initialise with media stream working good.
let constraints = ICSStreamConstraints.init()
constraints.audio = true
constraints.video = ICSVideoTrackConstraints.init()
constraints.video?.frameRate = 24 //need to check waht is heighest and lowset and why we need to set
constraints.video?.resolution = CGSize(width: 640, height: 480) //is based on device we need to change, its our local stream resilution
if self.isFrontCam == false {
constraints.video?.devicePosition = .front //as per out camera we need to set front or back, by default its setting as front
}
else{
constraints.video?.devicePosition = .back //as per out camera we need to set front or back, by default its setting as front
}
var errorObj : NSError?
self.localVideoStream = ICSLocalStream.init(constratins: constraints, error: &errorObj). //local video stream is created
localVideoView.captureSession = captureSource.captureSession //RTCCameraVideoCapturer also started
self.localVideoStream.attach(self.remoteVideoVioew!) //local stream is getting renderview.
But as per the response if we created the ICSLocalStream with RTCMediaStream,for local itself its not adding to renderview getting only black scrren.
For this after hitting the Join Api in the response we will get conference information objection, that object is subclass of ICSStream(which contains mediaStream object). As we check with the stream object it doesn't contains any RTCMediaStream, project is getting crashed.
Sample code :
let icsSourceinf = ICSStreamSourceInfo.init()
icsSourceinf.audio = .mic
icsSourceinf.video = .camera
let remoteStreamObj = currentConfInfo.remoteStreams.first as! ICSRemoteStream
rtcMediaStream = remoteStreamObj.mediaStream as? RTCMediaStream
if rtcMediaStream == nil {
rtcMediaStream = localVideoStream2.mediaStream // to resolve the crash checked the condition and added localstream
}
localVideoStream = ICSLocalStream.init(mediaStream: rtcMediaStream!, source: icsSourceinf)
localVideoView.captureSession = captureSource.captureSession
Please help us how to use ICSLocalStream with media object.
As we noticed this method contains peer connectivity properties, our aim is to create conference call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
same here.
Would like to switch camera position while conference call.
Seems Android SDK has a method called switchCamera but iOS hasn't.
Trying to find some solution. Stuck here for almost a week. :'(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Team,
I have the same issue. Kindly, give us an update, to solve the above?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi krishna,
The issue may be fixed by https://github.com/open-media-streamer/oms-client-native/commit/98c9c31f34b162774bec0abb89364011df06c885. But it is not included in v4.1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jianjun,
Thanks for your response.
We are using v4.1 SDKs for iOS,Android and Server side and we cannot depend OMS Client.( i.e the link you given above).
Does it have any possible solution using your SDK / WebRTC SDK which you have provided?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jianjuan,
How to fix the issue, we cannot find solution in v4.1.1. for ICSLocalStream to switch camera. If we republish the local stream for one instance its working fine. If we trigger same call again with out restart the application the remote itself not binding to opposite device getting issues as
2019-02-06 17:45:27.604415+0530 VideoConf_Swift[9961:1784648] Failed to make complete framebuffer object 8cd6
2019-02-06 17:45:27.604732+0530 VideoConf_Swift[9961:1784648] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x281c9c640> to GL_RENDERBUFFER 1
How to resolve this issue, please help us
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Above commit is included in v4.1.1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yanbin Z. (Intel) wrote:For iOS SDK , switch camera can be done through set useBackCamera as Yes /NO
Following is example code , you can include it to your SwitchCamera() function and it will switch camera over successive calls when i is even or odd
static int i = 0; NSDictionary *mandatoryConstraints = @{@"minWidth" : @"640", @"minHeight" : @"480",@"maxWidth" : @"640", @"maxHeight" : @"480", @"maxFrameRate":@"24", @"minFrameRate":@"24"}; RTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatoryConstraints optionalConstraints:nil]; RTCAVFoundationVideoSource* source=[[RTCAVFoundationVideoSource alloc] initWithConstraints:constraints]; if((i++)%2 == 1){ source.useBackCamera = YES; }else{ source.useBackCamera = NO; } NSError *err=[[NSError alloc]init]; _localStream=[[RTCLocalCameraStream alloc]initWithAudioEnabled:YES VideoSource:source error: &err];
RTCAVFoundationVideoSource and RTCLocalCameraStream dose not provide in WebRTC.framework,how can i get it ?thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
snow f. wrote:Hi , Where can I find RTCLocalCameraStream? thanks
//////////////////////////////////////////////////////
let mandatoryConstraints = ["minWidth":"640","minHeight":"480","maxWidth":"640","maxHeight":"480","maxFrameRate":"16","minFrameRate":"16"]
let constraints = RTCMediaConstraints(mandatoryConstraints: mandatoryConstraints, optionalConstraints: nil)
self.mVideoSource = RTCAVFoundationVideoSource(constraints: constraints)
self.mVideoSource?.useBackCamera = false
self.mIsBackCamera = false
self.localCanmerStream=RTCLocalCameraStream(audioEnabled: true, videoSource: self.mVideoSource!, error: nil)
func switchCamera()
{
if mIsBackCamera
{
self.mVideoSource?.useBackCamera = false
mIsBackCamera = false
}
else
{
self.mVideoSource?.useBackCamera = true
mIsBackCamera = true
}
}//////////////////////////////////////////////////////////////////////////////////////////
Thinks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi guys,
Regarding camera switch on iOS, did you manage to do that without republishing? We are struggling, and getting stuck. If any of you be able to do that, would you kindly share the source code block implementation? Thanks in advances!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jianjun Z. (Intel) wrote:Hi Deepesh and krishna,
ICSLocalStream can be initialized with a RTCMediaStream. You can switch position on its associated RTCCameraVideoCapturer.
Hi Jianjun,
How are you?
Could you please give us sample example for creating local stream with RTCMediaStream, as we are unable to create local stream with it.
Kindly do the needful as it is high priority issue from our end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
K, Srujan wrote:Quote:
Jianjun Z. (Intel) wrote:
Hi Deepesh and krishna,
ICSLocalStream can be initialized with a RTCMediaStream. You can switch position on its associated RTCCameraVideoCapturer.
Hi Jianjun,
How are you?
Could you please give us sample example for creating local stream with RTCMediaStream, as we are unable to create local stream with it.
Kindly do the needful as it is high priority issue from our end.
Hello,
Any update would be appreciated?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Jianjun Z.
Could you please help us out by giving an example of creating local stream with RTCMediaStream?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Team,
Any update would be appreciated?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page