5
votes

I have a video composition which I'd like to play over Airplay (without mirroring). The app works as expected when using normal Airplay mirroring, but I'd like to get the speed, reliability, and resolution bump you get from using Airplay video instead.

The problem is that when I set

player.usesAirPlayVideoWhileAirPlayScreenIsActive = YES;

...the player goes blank.

Notes:

  • Since I don't create separate windows for each display, they are both trying to use the same AVPlayer.
  • My AVVideoComposition contains different files and adds opacity ramps between them.
  • This unanswered question suggests that the problem is more likely due to the fact that I'm playing an AVComposition than the use of a shared player: AVComposition doesn't play via Airplay Video

Two questions:

  1. Do I have to get rid of the player on the iPad?
  2. Can an AVVideoComposition ever be played over AirPlay?
2
Did you have any luck with this? I am having a similar problemArtilheiro
Any information? I just experienced this issue myself, years after your question, but the problem still exists.o15a3d4l11s2
Unfortunately we decided to drop the feature at the time and moved on, so I'm afraid I can't shed any light on this.mrgrieves

2 Answers

0
votes

I can't make comments so I had to post this as an answer although it might not fully respond to the questions.

I had similar issue and at the end I found out that when AVPlayer plays AVComposition it simply doesn't display anything on the external display. That's why I had to do it myself by listening to UIScreen connection notifications.

I have to say that all worked pretty perfect. I'm checking first if there are more than one screen and if there are I simply move the AVPlayer on that screen while displaying a simple message on the device's screen that content is played on... plus the name of AirPlay device. This way I can put whatever I want on the external display and is not very complicated. Same thing is when I receive UIScreenDidConnectNotification.

That was fine until I noticed that the composition plays really choppy on the the external display. Even if it consists of only one video without any complex edits or overlays. Same video plays perfectly if I save it to the Camera Roll or if I use MPMoviePlayerController.

I've tried many things like lowering resolutions, lowering renderScale and so on but with no success.

One thing bothers me more is how actually Apple do this in iMovie - if you have AirPlay enabled and you play a project (note it's still not rendered so it must use a composition in order to display it) right after tapping play button it opens a player that plays content really smoothly on the external monitor. If you however activate AirPlay from the player it closes and start rendering the project. After that it plays it I thing by using MPMoviePlayerController.

I'm still trying to find a solution and will post back if I have any success.

So for the two questions:

  1. I don't see why you have to get rid.
  2. Yes it can be played but with different technique and obviously issues.
0
votes

in the app .plist create a new item called:

required background modes

add a new array element called:

App plays audio or streams audio/video using AirPlay

Not sure if you have already tried this, but you don't mention it in your post.

Cheers!