feat(npaw): add @theoplayer/react-native-analytics-npaw connector#447
Merged
Conversation
…ctor Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
…AW via PlayerEventType Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
…se members Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
…dapter construction Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
…adata Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
…ssthrough Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
…sion end Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New JS-only analytics connector
@theoplayer/react-native-analytics-npaw(undernpaw/), structured like the youbora connector but stripped of all native iOS/Android/web modules. It integrates NPAW through thenpaw-plugin-react-nativeJS plugin only, so it works on iOS, Android and web via the unifiedreact-native-theoplayerfacade.The core idea: NPAW's bundled
Theoplayeradapter (in the separatenpaw-plugin-adapterspackage) is web-only — it hooks web-THEOplayer DOM events and reads web-only props. Instead, this package ships its own cross-platform adapter classes that NPAW instantiates viaregisterAdapterFromClass/registerAdsAdapterFromClass. NPAW copies our methods onto its own runtime adapter object and assignsthis.player, so our getters/listeners run against NPAW's adapter with the RN player attached — no native code required.What's here
NpawConnector(player, config)+useNpaw(config)hook. Config:Runtime option APIs:
setVideoOptions(options, videoKey?)(per-video),setAnalyticsOptions(options)(global),setLogLevel(level),destroy().TheoplayerAdapter— video adapter. Subscribes to unifiedPlayerEventTypeevents and maps them to NPAW'sfire*API:PLAY/PLAYING→fireStart/fireJoin/fireResume,PAUSE→firePause,WAITING→fireBufferBegin,SEEKING/SEEKED→fireSeekBegin/fireSeekEnd,TIME_UPDATEestablishes start/join + ends seek/buffer,SOURCE_CHANGE/ENDED→fireStop,ERROR→fireError.getSubtitles()(active showing subtitle/caption track language) andgetVideoLanguage()(active audio track language) — both feed NPAW's auto-detection of subtitle/audio-language usage.getVersion()is player-independent (static, manifest-based) because NPAW calls it during adapter construction beforethis.playeris set.TheoplayerAdsAdapter— ads adapter. Subscribes toAD_EVENTand maps subtypes:AD_BREAK_BEGIN/END→fireBreakStart/fireBreakStop,AD_BEGIN→fireStart+fireJoin, quartiles →fireQuartile(1|2|3),AD_SKIP→fireSkip,AD_CLICKED→fireClick,AD_END→fireStop,AD_ERROR→fireError. Getters serve ad duration/resource/title/position(pre|mid|post)/skippable.AD_BUFFERINGis intentionally skipped (THEOplayer has no reliable matching buffer-end event).Registered in the root workspaces; only dependency is
npaw-plugin-react-native.e2e app (
apps/e2e):useNpawConnector()wired intoApp.tsxlike the other connectors,Npaw.spec.tscreate/use/destroy test with a dummy account code,NPAW_ACCOUNT_CODEin.env.example, tsconfig path + metro connector entry. Sampleanalyticsdemonstratescontent.title+ acontent.metadataobject.Scope / gap check
Reviewed against NPAW's shipped plugin API + option registry. Content metadata, subtitles and audio language are wired; all other NPAW options (the full
content.*/user.*/ad.*/parse.*/… set) are supported generically viaanalytics/setVideoOptions/setAnalyticsOptions. Getters NPAW can't be reliably fed from the RN facade cross-platform (throughput, dropped frames, fps, codecs) are intentionally left to NPAW defaults.Notes / caveats
fire*mappings are verified against NPAW's shipped types and the plugin source, but a smoke test in an app (playback + ads) is worth doing before release.LogLevelis a local enum mirroring the plugin's numeric values, since the RN entry only default-exportsNpawPlugin.Link to Devin session: https://dolby.devinenterprise.com/sessions/6d52b6e8bd134e5caaa3d268e991711e
Requested by: @tvanlaerhoven