Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Method 1:</strong> Not sure if this will work, but try playing a blank audio file right before you send the capture event.</p> <p>To play a clip, add the <code>Audio Toolbox</code> framework, <code>#include &lt;AudioToolbox/AudioToolbox.h&gt; </code>and play the audio file like this <em>immediately</em> before you take the picture:</p> <pre><code> NSString *path = [[NSBundle mainBundle] pathForResource:@"blank" ofType:@"wav"]; SystemSoundID soundID; NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO]; AudioServicesCreateSystemSoundID((CFURLRef)filePath, &amp;soundID); AudioServicesPlaySystemSound(soundID); </code></pre> <p>Here is a blank audio file if you need it. <a href="http://cl.ly/3cKi" rel="noreferrer">http://cl.ly/3cKi</a></p> <p><strong>________________________________________________________________________________________________________________________________________</strong></p> <p><b>Method 2:</b>There's also an alternative if this doesn't work. As long as you don't need to have a good resolution, you can <a href="http://www.codza.com/extracting-frames-from-movies-on-iphone" rel="noreferrer">grab a frame from the video stream</a>, thus avoiding the picture sound altogether.</p> <p><strong>________________________________________________________________________________________________________________________________________</strong></p> <p><strong>Method 3:</strong> Another way to do this would be to take a "screenshot" of your application. Do it this way:</p> <pre><code>UIGraphicsBeginImageContext(self.window.bounds.size); [self.window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData * data = UIImagePNGRepresentation(image); [data writeToFile:@"foo.png" atomically:YES]; </code></pre> <p>If you're wanting this to fill the whole screen with a preview of the video stream so that your screenshot looks good:</p> <pre><code>AVCaptureSession *captureSession = yourcapturesession; AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:captureSession]; UIView *aView = theViewYouWantTheLayerIn; previewLayer.frame = aView.bounds; // Assume you want the preview layer to fill the view. [aView.layer addSublayer:previewLayer]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload