2

I am trying to play video on iPad by using this code. It is okay for iOS 6. But, in iOS 7, its self.asset.duration.value is zero. I would like to know how to do.

    NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
    NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:AVURLAssetPreferPreciseDurationAndTimingKey];

    AVURLAsset *assetToCombine = [AVURLAsset URLAssetWithURL:url options:options];//original
    [assetToCombine retain];


    NSArray *requestedKey=[NSArray arrayWithObjects:@"duration", nil];
    [assetToCombine loadValuesAsynchronouslyForKeys:requestedKey completionHandler:^{
        dispatch_async(dispatch_get_main_queue(), ^{
            //do nth here

            NSLog(@"dispatch_async assetToCombine.duration.value is %lld.",assetToCombine.duration.value);

        });
    }];
    NSLog(@"assetToCombine.duration.value is %lld.",assetToCombine.duration.value);
Khant Thu Linn
  • 5,905
  • 7
  • 52
  • 120

0 Answers0