AVAudioPlayer doesn't start playing in background

前端 未结 4 1297
我寻月下人不归
我寻月下人不归 2021-01-16 18:39

I am using AVAudioPlayer and NSFileHandle to do audio streaming. The basic idea is that I save the streaming audio data to the device with file sys

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-16 18:57

    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    
    UIBackgroundTaskIdentifier newTaskId = UIBackgroundTaskInvalid;
    newTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:NULL];
    

    /* And in info.Plist file Required background modes : App PLAYS Audio */

提交回复
热议问题