I'm working on an app that's similar to YouTube functionalities. Now I need to display a list of videos (already stored in Firebase) in a collectionView and I need to get the duration of each video. I'm considering to
add a property
duration
tostruct Post
and just get it easily when loading the posts.create an object of
AVURLAsset
from the url of the video and get the duration fromasset.duration
. However, my intuition tells me this second option is not that good an idea.
I'm now in the very early stage of my career as an iOS developer; I badly need a solution to this problem. Thanks!