ESoft
ESoft

Reputation: 862

AvPlayer with distortion

Is there a way to have an (one single) AVPlayerLayer cover the area as shown in the image below?
The player should cover both the white and red area with the appropriate perspective.

enter image description here

Upvotes: 1

Views: 528

Answers (1)

Peter Hosey
Peter Hosey

Reputation: 96333

You definitely can't do this with one layer with an affine transform. Maybe with Core Image, but I don't know what filter(s) you'd use and they'd probably be really expensive anyway.

What you might be able to do is use multiple AVPlayerLayers, each playing the same item, with their 3D transforms set so that they intersect at the fold point. The left side of the right layer would be behind the left layer, and the right side of the left layer would be behind the right layer.

  • You'd probably want to have both player layers inside an AVSynchronizedLayer to keep them playing to the same clock.
  • I don't know whether you'll need two AVPlayers. At any rate, it's easy enough to get the playerItem from one and create a second AVPlayer around it.

As you can guess, I haven't done this, so caveat implementor. Hopefully it'll set you in the right direction.

Upvotes: 1

Related Questions