Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4343268
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:43:41+00:00 2026-05-21T11:43:41+00:00

i am new to AVFoundation and i am trying to implement a video camera

  • 0

i am new to AVFoundation and i am trying to implement a video camera with AVFoundation here is my basic setup. Basically, when you click a button it will call the showCamera method. In here i create the session and then add an audio input and video input then add the video output.

Where in here do i add the AVCaptureConnection and how do i do it? Is there some tutorial that shows how to use the connections? Any help is appreciated.

- (IBAction) showCamera
{
//Add the camview to the current view ontop of controller
[[[[[UIApplication sharedApplication] delegate] self] window] addSubview:camView];

session = [[AVCaptureSession alloc] init];

//Set preset on session to make recording scale high
if ([session canSetSessionPreset:AVCaptureSessionPresetHigh]) {
    session.sessionPreset = AVCaptureSessionPresetHigh;
}

// Add inputs and outputs.
NSArray *devices = [AVCaptureDevice devices];

//Print out all devices on phone
for (AVCaptureDevice *device in devices) 
{

    if ([device hasMediaType:AVMediaTypeVideo]) 
    {

        if ([device position] == AVCaptureDevicePositionBack) 
        {

            //Add Rear Video input to session
            [self addRearCameraInputToSession:session withDevice:device];

        }


    } 
    else if ([device hasMediaType:AVMediaTypeAudio]) 
    {

        //Add Microphone input to session
        [self addMicrophoneInputToSession:session withDevice:device];
    }
    else
    {
        //Show error that your camera does not have a phone
    }
}



//Add movie output
[self addMovieOutputToSession:session];

//Construct preview layer
[self constructPreviewLayerWithSession:session onView:camView];

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:43:42+00:00Added an answer on May 21, 2026 at 11:43 am

    You don’t add AVCaptureConnections manually. When you have both an input and an output added to the AVCaptureSession object, the connections are automatically created for you. Quoth the documentation:

    When an input or an output is added to a session, the session greedily forms connections between all the compatible capture inputs’ ports and capture outputs.

    Unless you need to disable one of the automatically-created connections, or change the videoMirrored or videoOrientation properties, you shouldn’t have to worry about them at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New with jQuery. Here's what I have so far - basically, I want jQuery+ajax
New to Python and trying to figure out what went wrong here. Making a
I am using AVFoundation to record video on IOS 5. I would like the
I am using AVFoundation to capture CMSampleBufferRef from the camera and then convert it
New to jquery question... Using jQuery, depending on the radio button clicked I would
New to Ruby and ROR and loving it each day, so here is my
New to SharePoint. I'm trying to upload a document to SharePoint using it's CopyIntoItems
I am new to the whole AVFoundation thing. Before I was using the good
I'm shooting video on an iPhone 4 with the front camera and combining the
New formtastic user here. I have a relationship user has_many clients In formtastic ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.