Great appreciate the help on this - I'll go ahead a file an enhancement request.
Post
Replies
Boosts
Views
Activity
A follow up - can we listen for remote or seek events from airplay? I've been working to attach MPRemoteCommandCenter to the AVPlayer, but it just doesn't want to pick up any remote events while I'm airplaying.
EDIT: This is the exact issue I'm having https://developer.apple.com/forums/thread/110322
When I say "native airplay player" I'm referring to the one that comes built in on the receiver end. For example, our app uses a custom player UI on iPhone (lets call this the sender) and when I cast to tvOS (the receiver) it defaults to the native tvOS UI rather than our own.
This is where the confusion may lie for me - we have a custom UI for iOS and tvOS, but when air-playing specifically from iPhone to tvOS it does not use the custom one. So, I suppose the first step here is learning how to force airplay to use our UI instead of the native one.
I know there's lots of "hand-waving" going on as I try to describe this situation, so please don't hesitate to ask for more clarification.
To give you a bit more context, we support playback with advertisements, and the ultimate goal is to prevent the ability to skip ads when airplaying. In its current state, if a user is solely watching on their iPhone or tvOS device (not casting), its easy enough for us to block seeking with our custom UI. However, as soon as they start casting from iPhone to tvOS, the native controls take over on tvOS and the user is able to skip ads with the tvOS remote.
I should make an important distinction in that there are two ways to watch on tvOS: By downloading the app on the tvOS device (uses our custom UI)
By airplaying from the iphone app to the tvOS device (uses the native apple UI)
I think what it comes down to is - How do I ensure that airplay is using the custom UI? Is there some flag I need to set to tell it to use the UI we built around AVPlayer? Should it be happening automatically?
Correct, we do have our own UI built around AVPlayer, but when air-playing the app defaults back to the native apple player instead of using our UI. With this in mind, I suppose there is two possible solutions here:
Replace the native airplay player with our custom one so that we can control seek functionality
Or, figure out a way to disable seeking on the native airplay player
For #1, can you offer some guidance on how we'd use our own UI for airplay? I haven't been able to find any code examples of this, nor have I seen it done by any popular media apps (Hulu, HBOMax, etc..)
If this isn't possible, then I'd be curious how to go about solving #2
Hi Gavin, thanks for the great explanation. I've run into a similar issue and agree that the old even listeners seem to be depreciated. Any chance you can share the code chunk you used to initialize the MPNowPlayingSession?
Hi, a bit late of a response here, but I'm curious if you ever found a solution to this?