Microphone access requested without microphone usage - swift
Asked Answered
M

1

9

I'm having an issue with an animation (mp4) on my app. Sometimes(not all the time) when the app is launched, it requests microphone access but I am not requesting for one anywhere in the app. I'm only using AVPlayer to play the mp4 content. The code below is the only one related to the player. Any idea why I'm being requested for mic access? Thanks

import UIKit
import Foundation
import MediaPlayer
import AVKit

class AnimationLaunchscreen: UIViewController {

    var player: AVPlayer?

    override func viewDidLoad() {
        super.viewDidLoad()

        let timer = Timer.scheduledTimer(timeInterval: 6.0, target: self, selector: #selector(timeToMoveOn), userInfo: nil, repeats: false)

        self.loadVideo()

    }

    @objc func timeToMoveOn() {
        self.performSegue(withIdentifier: "goToTableView", sender: self)
    }

    func loadVideo() {

        let path = Bundle.main.path(forResource: "stopwatchAnimation", ofType:"mp4")

        let filePathURL = NSURL.fileURL(withPath: path!)
        let player = AVPlayer(url: filePathURL)
        let playerLayer = AVPlayerLayer(player: player)

        playerLayer.frame = self.view.frame
        playerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill
        playerLayer.zPosition = -1

        self.view.layer.addSublayer(playerLayer)

        player.seek(to: CMTime.zero)
        player.play()
    }

    override func viewWillAppear(_ animated: Bool) {
        makeStatusBarBlack()
    }

}
Menial answered 18/11, 2018 at 13:2 Comment(4)
Happens to me also, but only when running in the simulator. Looks like a bug in Xcode 10.1Paynter
I'll try on my device! Thanks for your feedback ! Good day.Menial
I had the same issue on simulatorMajorette
Yes. It only appears in Simulator. Seems like a bug only in Xcode 10.1Mutual
M
0

Adding the answer here so it is easier to find than reading the comments. This really appears to be a bug on simulator only (https://forums.developer.apple.com/thread/110423). Running on device works just fine.

Malissamalissia answered 16/2, 2019 at 12:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.