AVURLAsset* audioAsset = [[AVURLAsset alloc]initWithURL:assetURL options:@{AVURLAssetPreferPreciseDurationAndTimingKey:@YES}];
// audio asset url create object and specifies its method....
this audio asset can get value in only second?
I want to know how above code works and role of AVURLAsset
AVURLAsset
is a subclass of AVAsset
. AVAsset
is used to get information about the asset such as metadata (like track titles, author, composer, and so on). The "asset" is usually a sound or video file.
In the example you have given, you are creating an AVAsset
from a URL, and you are specifying that you want precise duration and timing. Because of that option, when you ask for the duration, there may be a significant amount of work required for the AVAsset
method to compute a precise time. This is clearly stated in the Apple documentation. The documentation also suggests that you usually do not need the precise duration and timing.