In-App Messages


GAFA 2021: Enrich Your In-App Messages with Apple SharePlay

Justin Malandruccolo By Justin Malandruccolo Nov 1, 2021

It’s been a big year for Apple updates—from major privacy-focused features like Mail Privacy Protection and Hide My Email to significant adjustments to how iOS 15 handles push notification prioritization. But while these changes got plenty of press, there’s another, less-heralded addition to iOS that’s worth paying attention to: SharePlay.

This feature was originally intended for iOS 15, but missed the cut; instead, after more than a month of delays, it appeared as part of iOS 15.1 on October 25. Admittedly, this is far from the first time that Apple has delayed a notable iOS feature (remember the IDFA fiasco?); however, just when you think Apple can’t be any more confounding, they go and release something like SharePlay...and totally redeem themselves.

What Is SharePlay?

This new feature makes it possible for iPhone users to have shared media experiences across multiple devices when using FaceTime on devices running iOS 15.1 and above. In essence, SharePlay allows you to sync the audio and video playback controls for every device in a self-selected group, providing a more coordinated viewing experience when group-watching content with friends and family around the world.

How Does SharePlay Work in Practice?

Imagine that you and a few buddies want to watch basketball highlights together, but you’re not able to meet up in person to do it. If you watch those highlights on an app utilizing SharePlay on a FaceTime video, you can ensure a seamless, identical experience for each viewer. That means that if one of your friends decides to pause the video, the footage will pause across all the user devices taking part in the call.

Why Does SharePlay Matter for Brands?

While SharePlay is significant on its own, it’s also one of a number of improvements that Apple has made to FaceTime in the last year. These changes—which include the addition of a head-up display (HUD) allowing users to control their mic, video, and screen sharing and the newfound ability of users on Android, Windows, and other platforms to join FaceTime calls—are best understood as a response to the disruptions of the last two years and the growing importance of digital video to modern life.

Apple plays a significant role in today’s video-call zeitgeist: Nearly 48% of US adults were using FaceTime as their video conferencing app of choice as of March 2020. And on a more anecdotal level, I’ve found that my friends and family tend to say, “Do you want to ‘FaceTime’?” when they want to schedule a video call, highlighting FaceTime’s ubiquity and cultural currency. Before SharePlay, my friends and I would often share clips via text message and then view them individually, but with iOS 15.1, these interactions can be experienced together in your app.

For brands, one major selling point of SharePlay is that it provides a novel opportunity to introduce new users to their mobile apps. For users with iOS 15.1 and above, they’ll be able to initiate SharePlay while on FaceTime calls with other users—and when they do, those other users will see an “Open” button appear below with HUD on their screens, highlighting the app in question. When users click that button, it will trigger your app to launch (if they already have it on their phone) or direct them to Apple’s App Store to download your app; not every user will choose to download your app, of course, but this feature will create a seamless, organic way to acquire app users.

What does that look like in practice? Imagine that your app showcases content like trailers for upcoming movies or news clips from the previous day’s broadcast. With SharePlay, your users could easily watch these videos in groups via FaceTime, expanding the reach of your content and allowing them to engage with the content and each other at the same time.

It gets better: Apple’s new GroupActivities framework makes it possible for you to leverage SharePlay inside your own applications, opening up a new world of shared media experiences for your customers. The framework is flexible enough to support a range of use cases, but there’s one in particular that could add value for many brands right out of the gate: Synced in-app media playback.

How SharePlay Supports In-App Media Playback

Looking to showcase engaging content in your iOS app? One of the best ways to make that happen is by using in-app messages. This in-product messaging channel is designed to allow brands to easily surface memorable experiences inside the app and—fun fact!—can play videos natively with some lightweight developer work.

This, in turn, makes it possible for brands to take advantage of Apple AVPlayerVideoController features within in-app messages, including SharePlay. The in-app message I’ve showcased below is a subclassed ABKInAppMessageModalViewController that has a custom view to embed a native video player within the message body.

That said, while this functionality opens up a lot of possibilities for brands when it comes to highlighting videos and other playable content within in-app messages, there are some nuances that you’ll need to pay attention to:

  • When adding a video to an in-app message, the video itself cannot be attached as a media item to the message; instead, it should be set in the key-value pairs with the value being a URL. Keep in mind that you can add URL validity checking in beforeInAppMesageDisplayed as a guardrail prior to displaying the content.

  • These in-app messages should be set up to be eligible for all users with re-eligibility enabled. You’ll also need to ensure that they have two triggers enabled—your default tigger and a custom event trigger that can be associated with the SharePlay action. Users who aren’t yet on iOS 15.1 or higher would still be able to view the in-app message, though they would need to do so locally.

  • Be mindful of what other in-app messages you’re sending to the target audience. If you have other in-app messages that are triggered on session start, you may see conflicts with these messages, resulting in user experiences that don’t match your intentions.

If you’re using SharePlay in conjunction with in-app messages, it’s essential that you keep user experience front of mind. When a user opens your app via SharePlay, they’re going to expect the shared content to be ready to watch/listen to right when you app launches. The responsiveness of in-app messages and the fact that they can be launched from any screen within your app—including, but not limited to, your home screen—makes this seamless experience possible. (For the Content Card loyalists, it’s very possible to achieve a similar user experience; however, be aware that it will require more developer work.)

In practical terms, you’ll be able to use the GroupActivities API to determine if there is a video present. If so, you’ll want to trigger the custom event mentioned above to launch your SharePlay-enabled in-app message. (We’ll touch on the relevant code snippet for this logic in the next section). The SharePlay indicator should dynamically be hidden or shown via the following approach: Query the isEligibleForGroupSession variable to observe if the user in question is currently on a FaceTime call or not; if so, a button should be visible to share the video across the compatible devices in the chat.

The first time that a user initiates SharePlay, a prompt will appear on that user’s device to allow them to decide whether they want to share their content with other users. If they decide to enable sharing, a separate prompt will then appear on the devices of the other users on the call, allowing them to use SharePlay to view the content.

Key Code Examples for Leveraging SharePlay via In-App Messages

To help you begin the work of supporting in-app media playback via SharePlay, I thought it would be helpful to share a couple of notable code snippets. Let’s start off by creating an object that conforms to the GroupActivity protocol; the object is the metadata of the GroupSession shared throughout the SharePlay lifecycle.

When your app prepares to play the media item, each group activity has three states:

.activationDisabled — viewing individually

.activationPreferred — viewing together

.cancelled — ignore and handle gracefully

Accordingly, when the state comes back as activationPreferred, that is your app’s cue to activate the rest of the group activity lifecycle.

Then, to trigger an in-app message from SharePlay, our trusty BrazeManager.swift helper file takes the liberty of checking if there is an enqueued media item from the GroupActivity.

The CoordinationManager is responsible for the state changes of SharePlay such as if the user(s) leaves and/or joins the call.

Looking for additional assistance? If your brand is interested in taking advantage of SharePlay, I’d strongly recommend watching Apple’s WWDC 2021 videos on Group Activities and reading up on Apple’s Combine framework and related videos from WWDCs past; I’ve found that there’s a significant amount of SharePlay code provided by Apple in these resources that can be applied to other brands’ use cases related to SharePlay.

Final Thoughts

Now that SharePlay has (finally) made its public debut, brands should think long and hard about whether this powerful new functionality makes sense for their app. For companies that showcase videos and other playable media, the odds are good that integrating SharePlay into their own iOS applications will bolster their customer engagement efforts by impressing users, keeping them engaged, and maybe even acquiring a few new others.

Looking to learn more about customizing in-app messages to support exceptional customer experiences? Check out our exclusive webinar “An In-Depth Look at In-App Messages.”

Interested in digging deeper into how to use SharePlay together with Braze? Visit our documentation.


Justin Malandruccolo

Justin Malandruccolo

Justin Malandruccolo is a Forward Deployed Software Engineer at Braze who spends his days working on customer-facing engineering resources. Prior to Braze, he has written, maintained and scaled code as an iOS engineer on mobile, tablet, Apple Watch, and TvOS applications.

Related Content

How to Send More Effective In-App Messages

Read More

9 Tips and Tricks for In-App Messages

Read More

In-App Messages

The Do's and Don'ts of Customer App Ratings

Read More

Innovative Ways to Use In-App Messages in the Customer Journey

Read More