Search code examples
iosxcodeavfoundationbackground-audiompnowplayinginfocenter

How can i get current time of background audio? (iOS)


I have audio app. For listening audio i use AVFoundationFramework and make it in background with info by MPNowPlayingInfoCenter. If user making segue to other screen the audio are playing. I want show him info about playing audio on this new screen. The most problem is getting current time of playing in background audio. How can i get it?

P.S.: Length of audio primarily equals to one hour.

P.P.S.: I will be pleased to get answer in any language (obj-c/Swift)

EDIT: in iOS remote center shows true info, i just need get it in code... screenshot: http://postimg.org/image/9lv60eb1n/


Solution

  • I still don't know how make it (take info from remote center), but i solved it by singleton for audio player.