Search code examples
iosiphoneavfoundationm4a

Get playback time of audio m4a file ios


I want to get the m4a audio playback time without player implementation.

I found AVAsset implementation but didn't worked for me.


Solution

  • playbacktime can only be used when using MPMediaPalyback

    From AVAsset you can get only the duration of the Asset not the playback time.

    below is a refernce link

    How to get the duration of an audio file in iOS?

    You can access the duration property of the audio file but you cannot get the playback time.

    Playback time will only be available when you are using a player. :-)