Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // #import <AVFoundation/AVFoundation.h>
- NSTimeInterval duration = 0;
- NSURL url = [NSURL URLWithString:@"http://your-streaming-media-url";
- dispatch_queue_t queue = dispatch_queue_create("streaming.duration", NULL);
- dispatch_async(queue, ^{
- AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:@{AVURLAssetPreferPreciseDurationAndTimingKey : @(YES)}];
- if (asset) duration = CMTimeGetSeconds(asset.duration);
- });
Add Comment
Please, Sign In to add comment