I have an AVMutableComposition
(which is an AVAsset
) and I'm using GPUImage
(https://github.com/BradLarson/GPUImage) to filter it by using a GPUImageMovie
. It is working, but I need to implement seeking functionality.
I'm currently initializing GPUImageMovie
with my mutable composition:
[[GPUImageMovie alloc] initWithAsset:asset];
However, according to GPUImageMovie playback controls I need to create my own player and player item, then initialize the movie with that:
videoPlayerItem = [[AVPlayerItem alloc] initWithAsset:asset];
videoPlayer = [[AVPlayer alloc] initWithPlayerItem:videoPlayerItem];
GPUImageMovie *video = [[GPUImageMovie alloc] initWithPlayerItem:videoPlayerItem];
However, when I try to play the movie this way using [videoPlayer seekToTime:kCMTimeZero]; [videoPlayer play];
, I'm getting a blank player. Nothing is nil
etc, but it simply doesn't show anything.
The only question/answer I could find was this:
GPUImageMovie not playing video file when initWithPlayerItem
Though its solution is irrelevant to me as the problem was with the URL scheme, which I don't have (mine is not a URL asset, but a mutable composition).
How can I control/seek an AVMutableComposition
played as a GPUImageMovie
? (and yes, I need to use GPUImageMovie
, the whole processing pipeline is tightly-coupled to use that) (I am targeting iOS 9+)
I've ended up creating a new AVPlayer
based on the original video, and used that one for controlling the playback. Of course, even if it suited my needs for this particular project (as I didn't need the filtered video at the point where I needed to control playback), it may not fit everybody's needs.