Skip to content

Video

To play a video in an HTML in-app message, include the following <video> element in your HTML, and replace the video names with your file’s name (or the remote asset’s URL). You can find other possible <video> options on MDN Web Docs.

1
2
3
4
5
<video class="video" autoplay muted playsinline controls>
  <source src="https://video-provider.com/YOUR_VIDEO_FILE.mp4" type="video/mp4">
  <source src="https://video-provider.com/YOUR_VIDEO_FILE.ogg" type="video/ogg">
  Your device does not support playing this video.
</video>

To use a local video asset, be sure to include this file when uploading assets to your campaign.

Android considerations

To embed video and other HTML5 content in HTML in-app messages on Android, hardware acceleration is required to be enabled in the Activity where the in-app message is displayed. For more information, refer to the Android developer guide.

auto-play: Even with hardware acceleration enabled, Android WebViews may require a user gesture to start media playback. If you need auto-play, configure the WebView used to render HTML in-app messages to disable the user gesture requirement by setting WebSettings.setMediaPlaybackRequiresUserGesture(false). This requires SDK-level customization of how HTML in-app messages are displayed. For setup guidance, see Customize in-app messages for the Braze SDK.

iOS considerations

To support iOS devices:

  • You must include the playsinline attribute because full screen playback is not supported.
  • auto-play is not guaranteed on iOS. iOS playback behavior depends on WKWebView and OS-level media policies, and may require a user gesture even when autoplay and muted are set. Test your HTML in-app message on your target iOS versions and devices.

If auto-play is required and your tests show it doesn’t work by default, you can customize the WKWebViewConfiguration used by HTML in-app messages to adjust the media playback user-action requirement, for example by setting the mediaTypesRequiringUserActionForPlayback property. This requires SDK-level customization. For Swift resources, see Customize in-app messages for the Braze SDK and Adding the Braze JavaScript interface to WebViews for Swift.

Web considerations

Most modern browsers allow auto-play only under certain conditions (commonly when the video is muted). If you use autoplay in a web in-app message, include muted and test across your supported browsers and devices, as browser policies vary and may still require a user gesture in some cases.

New Stuff!