-
Notifications
You must be signed in to change notification settings - Fork 3k
feat!: add DAI support #4816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: add DAI support #4816
Conversation
android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
Outdated
Show resolved
Hide resolved
b89e478 to
4d15210
Compare
…ct-native-video into feat/add-dai-support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left 3 comments, overall lgtm 🚀 thanks again guys!
| func setupDaiLoader() { | ||
| let settings = IMASettings() | ||
| // Enable background playback for Picture-in-Picture support | ||
| settings.enableBackgroundPlayback = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn’t we set this only when playInBackground is true, not every time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The v6 documentation is on the master (v7) branch. We’ll need to update it there later as well
Note: This PR is based on #4765 (feat: add DAI support) by @maciekBudzinski
Summary
This PR adds Dynamic Ad Insertion (DAI) support for both Android and iOS, while also unifying the ad configuration API.
Motivation
Right now, react-native-video only supports client-side ad insertion (CSAI) where the player requests ads separately and plays them during breaks. Adding DAI support enables server-side ad insertion, expanding the types of ads that can be used with react-native-video.
This is also a feature requested by the community: #4399
Changes
Breaking Change: Unified Ad Configuration API
The ad configuration has been unified into a single
source.adproperty with atypediscriminator:Before (CSAI only):
After (CSAI):
After (DAI VOD):
After (DAI Live):
JS
AdConfigCSAI,AdConfigDAI,AdConfigDAIVod,AdConfigDAILive)Videocomponent to normalize ad configuration and handle both CSAI and DAI through the unifiedsource.adpropformatproperty to DAI configuration for HLS/DASH stream format selection (Android only)iOS
AdParamsdata structure to parse and store ad configuration from React Native bridgeadTagParametersAndroid
AdsPropsKotlin class to parse unified ad configuration with DAI propertiesImaServerSideAdInsertionMediaSource) for both VOD and Live streamsformatproperty support for HLS/DASH stream format selection viaImaServerSideAdInsertionUriBuilderwait()call in DAI initialization that could cause issues1.4.1to1.8.0to support DAI featuresDocumentation
source.adprop documentation with both CSAI and DAI configuration optionsformatproperty documentation for DAI streamsadTagUrlandadLanguageprops as deprecatedTest Plan
A complete test app is available at
examples/expo-dai/that demonstrates DAI functionality with both VOD and Live streams. The app includes a UI for configuring DAI parameters (including format selection), real-time event logging, and controls for testing various playback scenarios. The README inexamples/expo-dai/is worth reading before testing as it contains important setup instructions, usage guidelines, and known issues.Key Testing Scenarios:
contentSourceIdandvideoIdplay correctly on both iOS and AndroidassetKeyplay correctly on both iOS and AndroidonReceiveAdEventcallbackfallbackUriwhen DAI stream fails to loadadTagParametersare correctly passed through to the IMA SDKadTagUrlprop still works (with deprecation warning in docs)Note: Picture-in-Picture testing requires a real iOS device as simulators don't reliably support PiP. Google's official sample streams may have known issues with HLS VOD streams stopping around 1:10 (documented in the example app README).