AVComposition breaks on Airplay
Asked Answered
L

2

6

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?
Latonia answered 24/7, 2012 at 22:54 Comment(3)
Did you have any luck with this? I am having a similar problemBlitz
Any information? I just experienced this issue myself, years after your question, but the problem still exists.Gladwin
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.Latonia
O
0

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.
Orbadiah answered 1/8, 2014 at 11:20 Comment(0)
D
0

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!

Dishcloth answered 15/5, 2014 at 12:10 Comment(0)
O
0

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.
Orbadiah answered 1/8, 2014 at 11:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.