Hello Guys我正在开发一个直播流媒体广播应用。一切都很好,但我注意到,能量影响非常高。当我尝试上传此应用时,苹果会拒绝与否?我使用背景模式在背景中播放歌曲
import UIKit
import AVFoundation
class ViewController: UIViewController {
var player: AVPlayer = AVPlayer(url: STREAMING_URL! as URL)
override func viewDidLoad() {
super.viewDidLoad()
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
print("AVAudioSession Category Playback OK")
do {
try AVAudioSession.sharedInstance().setActive(true)
print("AVAudioSession is Active")
} catch {
print("Active error \(error.localizedDescription)")
}
} catch {
print("Category error \(error.localizedDescription)")
}
}
//Play
@IBAction func playBtnTapped(_ sender: Any) {
player.play()
}
//Pause
@IBAction func pauseBtnTapped(_ sender: Any) {
player.pause()
}
如何减少这种能量影响?
答案 0 :(得分:0)