I want to make slider for my AVPlayer, I used AVPlayer because I want to stream a mp3 file from Firebase..
I tried:
var duration = player.currentItem.asset.duration
but that obviously doesn’t work 🙂
I read the documentation of AVPlayer but I don’t get it
There is seek
function and I don’t know how that work
In AVAudioPlayer there is duration function which show that information, but in AVPlayer there is nothing like unfortunately…
2
Answers
I solved this.
I used currentTime in previous answer to get currentTime and convert that into seconds using CMTimeGetSeconds function.
But for get complete duration I just made a function getDuration:
and just call that function into my Text view.
Hope this will help you.