I am trying to support video playback for remote video files in iOS. It works for a regular video, but has a problem with slow motion videos: the slow motion effect is lost. I.e. A slow motion plays back like a regular speed rate video.
Here is what I am doing:
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
[asset.resourceLoader setDelegate:self.urlDelegate
queue:[self.urlDelegate getDispatchQueue]];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset];
AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];
AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];
controller.player = player;
[player play];
[self presentViewController:controller animated:false completion:^{
<snipped>
}];
Note, the url
points to a QuickTime (.MOV
) video file on a HTTP(s) server.
Again, the above code plays a slow motion video just like a regular video without any slow motions. Is it because AVURLAsset
does not support slow motion video? What are I missing to let AVPlayer
plays slow motion?
I am targeting iOS 12 and above.
Thanks!