title: Why is imagePickerController.mediaTypes = [kUTTypeMovie as String] including Live Photos as Bounce or Loop Effect as Video?
body: <p>I'm using the UIImagePicker to pick only videos from my library and I set my media type to:</p>
  
  <pre><code>imagePicker.mediaTypes = [kUTTypeMovie as String]
  </code></pre>
  
  <p>I noticed that when the library is presented, even though I expect only videos, if there is a live photo in the library with a <code>Bounce</code> or <code>Loop</code> effect, it shows up also. If I take that same photo and switch it's effect to <code>Live</code> or <code>Long Exposure</code> it will no longer show up in the library. If I switch it back to <code>Bounce</code> or <code>Loop</code> it reappears.</p>
  
  <p>I've tried both the <code>.photoLibrary</code> and the <code>.savedPhotosAlbum</code> and the same thing happens.</p>
  
  <p>The reason I ask is because I want to keep them out of the library and I only want videos of xxx secs or more to be picked.</p>
  
  <ol>
  <li>Why do these effect types show up in the image picker library even though I'm picking video only?</li>
  <li>Why does only <code>Loop</code> and <code>Bounce</code> appear but <code>Long Exposure</code> and <code>Live</code> doesn't?</li>
  <li>How do I keep them out?</li>
  </ol>
  
  <p>Maybe this would be a separate question but since it pertains to the same <code>Live</code> and <code>Bounce</code> photo issue I added it. I noticed that if I put a url that was derived from a <code>Live</code> or <code>Bounce</code> photo inside an AVPlayer, if I go to the background and come back there is a brief freeze when the app is back in the foreground, and it only happens with those 2 effects (which shouldn't be available). When the app goes to the background I remove the AVPlayerLayer correctly using this method <a href="https://stackoverflow.com/a/48487317/4833705">Remove AVPlayerLayer</a> but it's still briefly frozen (app is unresponsive) in the foreground when a url from those to effect types are initialized inside the player.</p>
  
  <p>code:</p>
  
  <pre><code>import MobileCoreServices
  import AVFoundation
  
  class ViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate{
  
  var playerItem: AVPlayerItem?
  var player: AVPlayer?
  var playerLayer: AVPlayerLayer?
  var currentPlayTime: CMTime?
  let imagePicker = UIImagePickerController()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      imagePickerController.delegate = self
  
      NotificationCenter.default.addObserver(self, selector: #selector(appHasEnteredBackground), name: Notification.Name.UIApplicationWillResignActive, object: nil)
  
      NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterForeground), name: Notification.Name.UIApplicationWillEnterForeground, object: nil)
  }
  
  override func viewDidLayoutSubviews() {
      // I have a UIView Outlet for the AVPlayerLayer named viewForPlayerLayer.
  
      guard let playerLayer = playerLayer else { return }
      playerLayer.videoGravity = .resizeAspectFill
      viewForPlayerLayer.layer.insertSublayer(playerLayer, at: 0)
      playerLayer.frame = viewForPlayerLayer.bounds
      playerLayer.masksToBounds = true
  
  }
  
  @IBAction fileprivate func showLibraryButtonTapped(_ sender: UIButton) {
  
      imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary // .savedPhotosAlbum also tried 
      imagePicker.mediaTypes = [kUTTypeMovie as String]
      imagePicker.videoMaximumDuration = 60
      present(imagePicker, animated: true, completion: nil)
  }
  
  func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
  
      if let url = info[UIImagePickerControllerMediaURL] as? URL{
  
            let asset = AVAsset(url: url)
            playerItem = AVPlayerItem(asset: asset)
            player = AVPlayer(playerItem: playerItem!)
            playerLayer = AVPlayerLayer(player: player)
            player?.play()
      }
      imagePicker.dismiss(animated: true, completion: nil)
  }
  
  func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
      imagePicker.dismiss(animated: true, completion: nil)
  }
  
  @objc fileprivate func appHasEnteredBackground() {
  
      currentPlayTime = player.currentTime()
  
      if player.isPlaying{
          player.pause()
      }
  
      playerLayer = nil
  }
  
  @objc fileprivate func appWillEnterForeground(){
  
      if let player = player, let currentPlayTime = currentPlayTime{
  
          playerLayer = AVPlayerLayer(player: player)
  
          player.seek(to: currentPlayTime, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero)
      }
  }
  
  }
  </code></pre>