1

I am setting up a camera controller with the following in swift 3:

let cameraController = UIImagePickerController()
    cameraController.sourceType = .camera
    cameraController.mediaTypes = [kUTTypeMovie as NSString as String]
    cameraController.showsCameraControls = true
    cameraController.videoQuality = UIImagePickerControllerQualityType.typeHigh
    cameraController.allowsEditing = false
    cameraController.delegate = delegate
    present(cameraController, animated: false, completion: nil)

This records both video and audio, and so asks for access to the camera and the microphone. The audio is not at all useful here.

How do you record video, but disable to microphone so that no audio is recorded, and so that permission to use the microphone is not asked?

ZiEiTiA
  • 275
  • 2
  • 16

1 Answers1

2

Setting your media type to KUTTypeVideo instead of KUTTypeMovie should do the trick.

KUTTypeVideo documentation

nwales
  • 3,521
  • 2
  • 25
  • 47
  • 1
    I tried this, however it crashes the app with the error: `*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'No available types for source 1' *** First throw call stack: (0x1848011b8 0x18323855c 0x18aba07c0 0x1000fff6c 0x1000ffd08 0x1000ffd84 0x18a6ebd30 0x18a6ebcb0 0x18a6d6128 0x18a6eb59c 0x18a6eb0c4 0x18a6e6328 0x18a6b6da0 0x18aea075c 0x18ae9a130 0x1847aeb5c 0x1847ae4a4 0x1847ac0a4 0x1846da2b8 0x18618e198 0x18a7217fc 0x18a71c534 0x10011ca14 0x1836bd5b8) libc++abi.dylib: terminating with uncaught exception of type NSException` – ZiEiTiA Jan 06 '17 at 10:40
  • Are you importing MobileCoreServices? – nwales Jan 06 '17 at 13:46
  • Yes I am: `import UIKit import MediaPlayer import MobileCoreServices import Photos import AssetsLibrary import AVKit` – ZiEiTiA Jan 07 '17 at 09:51