Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
392d2fb
feat(npaw): add JS-only @theoplayer/react-native-analytics-npaw conne…
devin-ai-integration[bot] Jul 22, 2026
60dd269
feat(npaw): cross-platform react-native-theoplayer adapter driving NP…
devin-ai-integration[bot] Jul 22, 2026
db707e7
refactor(npaw): rename adapter event handlers to onXxx
devin-ai-integration[bot] Jul 22, 2026
c4ec756
chore(npaw): remove unused bootstrap script; clarify injected NPAW ba…
devin-ai-integration[bot] Jul 22, 2026
646958b
Fix trivial warnings
tvanlaerhoven Jul 22, 2026
87ef533
test(npaw): add NPAW connector to e2e app, spec test, and .env.example
devin-ai-integration[bot] Jul 22, 2026
4ada36e
fix(npaw): make getVersion player-independent to avoid crash during a…
devin-ai-integration[bot] Jul 22, 2026
4c19974
feat(npaw): track active subtitles and expose setVideoOptions for met…
devin-ai-integration[bot] Jul 22, 2026
4fea2da
feat(npaw): add cross-platform ads adapter and setAnalyticsOptions pa…
devin-ai-integration[bot] Jul 22, 2026
234951a
feat(npaw): track active audio language via getVideoLanguage
devin-ai-integration[bot] Jul 22, 2026
6a0d032
fix(npaw): report playhead/duration in seconds
devin-ai-integration[bot] Jul 22, 2026
cb23703
fix(npaw): stop tracking CURRENT_SOURCE_CHANGE to avoid premature ses…
devin-ai-integration[bot] Jul 22, 2026
8ee4f46
fix(npaw): only treat infinite duration as live
devin-ai-integration[bot] Jul 22, 2026
17b6679
docs(npaw): refresh connector README and add to packages list
devin-ai-integration[bot] Jul 23, 2026
e5ae7fc
fix(npaw): end session on teardown and ignore no-op SOURCE_CHANGE
devin-ai-integration[bot] Jul 23, 2026
9a0359d
docs(npaw): note connector targets NPAW v7+
devin-ai-integration[bot] Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/e2e/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ CONVIVA_DEBUG=true
CONVIVA_TOUCHSTONE_SERVICE_URL=
CONVIVA_VIEWER_ID=e2e_viewer_id

# NPAW
NPAW_ACCOUNT_CODE=

# BITMOVIN
BITMOVIN_LICENSE_KEY=
BITMOVIN_LOG_LEVEL=DEBUG
Expand Down
5 changes: 2 additions & 3 deletions apps/e2e/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ function escapeRegExp(str) {

// Block these packages from being resolved out of root/node_modules.
// They are already explicitly mapped to the app-local copies via extraNodeModules.
const rootNodeModulesBlockList = packages.map(
(pkg) => new RegExp(`^${escapeRegExp(path.join(root, 'node_modules', pkg))}(/.*)?$`)
);
const rootNodeModulesBlockList = packages.map((pkg) => new RegExp(`^${escapeRegExp(path.join(root, 'node_modules', pkg))}(/.*)?$`));

const connectors = [
'adobe',
Expand All @@ -27,6 +25,7 @@ const connectors = [
'gemius',
'mux',
'nielsen',
'npaw',
'yospace',
'youbora',
];
Expand Down
5 changes: 4 additions & 1 deletion apps/e2e/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { ConnectorSubMenu } from './components/menu/ConnectorSubMenu';
import { ConnectorsMenuButton } from './components/menu/ConnectorMenu';
import { useAdobeEdgeConnector } from './connectors/adobe-edge';
import { muxOptions, useMuxConnector } from './connectors/mux';
import { useNpawConnector } from './connectors/npaw';

const playerConfig: PlayerConfiguration = {
// Get your THEOplayer license from https://portal.theoplayer.com/
Expand All @@ -63,14 +64,15 @@ export default function App() {
const { bitmovin, initBitmovin, onProgramChange: onBitmovinProgramChange, onUpdateCustomData: onBitmovinUpdateCustomData } = useBitmovinConnector();
const { adobeEdge, initAdobeEdge } = useAdobeEdgeConnector();
const { initMux } = useMuxConnector();
const { initNpaw } = useNpawConnector();

const onSourceChange = () => {
console.log('onSourceChange');
adobeEdge.current?.updateMetadata({
key1: 'value1',
key2: 'value2',
});
}
};

const onPlayerReady = (player: THEOplayer) => {
setPlayer(player);
Expand All @@ -79,6 +81,7 @@ export default function App() {
initBitmovin(player, bitmovinDefaultMetadata);
initConviva(player);
initMux(player, muxOptions);
initNpaw(player);

// optional debug logs
player.addEventListener(PlayerEventType.SOURCE_CHANGE, onSourceChange);
Expand Down
20 changes: 20 additions & 0 deletions apps/e2e/src/connectors/npaw.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { LogLevel, NpawConnectorConfig, useNpaw } from '@theoplayer/react-native-analytics-npaw';
import Config from 'react-native-config';

export const npawConfig: NpawConnectorConfig = {
accountCode: Config.NPAW_ACCOUNT_CODE,
analytics: {
'content.title': 'THEOplayer E2E',
'content.contentId': 'e2e-content',
'content.metadata': {
customCategory: 'demo',
customEnvironment: 'e2e',
},
},
logLevel: LogLevel.DEBUG,
};

export function useNpawConnector() {
const [, initNpaw] = useNpaw(npawConfig);
return { initNpaw };
}
22 changes: 22 additions & 0 deletions apps/e2e/src/tests/Npaw.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { TestScope } from 'cavy';
import { LogLevel, NpawConnector } from '@theoplayer/react-native-analytics-npaw';
import { THEOplayer } from 'react-native-theoplayer';
import { testConnector } from './ConnectorUtils';

export default function (spec: TestScope) {
spec.describe(`Setup NPAW connector`, function () {
let connector: NpawConnector;
testConnector(
spec,
(player: THEOplayer) => {
connector = new NpawConnector(player, { accountCode: 'testAccountCode' });
},
() => {
connector.setLogLevel(LogLevel.DEBUG);
},
() => {
connector.destroy();
},
);
});
}
3 changes: 2 additions & 1 deletion apps/e2e/src/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import Bitmovin from './Bitmovin.spec';
import Comscore from './Comscore.spec';
import Conviva from './Conviva.spec';
import Nielsen from './Nielsen.spec';
import Npaw from './Npaw.spec';

const tests = [Adobe, AdobeNative, AdobeEdge, Bitmovin, Comscore, Conviva, Nielsen];
const tests = [Adobe, AdobeNative, AdobeEdge, Bitmovin, Comscore, Conviva, Nielsen, Npaw];

export default tests;
1 change: 1 addition & 0 deletions apps/e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@theoplayer/react-native-analytics-conviva": ["../../conviva/src/index"],
"@theoplayer/react-native-analytics-mux": ["../../mux/src/index"],
"@theoplayer/react-native-analytics-nielsen": ["../../nielsen/src/index"],
"@theoplayer/react-native-analytics-npaw": ["../../npaw/src/index"],
"@theoplayer/react-native-yospace": ["../../yospace/src/index"],
"@theoplayer/react-native-adscript": ["../../adscript/src/index"],
"@theoplayer/react-native-gemius": ["../../gemius/src/index"]
Expand Down
70 changes: 70 additions & 0 deletions npaw/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# OSX
#
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
jsconfig.json

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml

# Cocoapods
#
example/ios/Pods

# Ruby
example/vendor/

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Expo
.expo/

# Turborepo
.turbo/

# generated by bob
lib/
5 changes: 5 additions & 0 deletions npaw/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @theoplayer/react-native-analytics-npaw

## 1.0.0

- Initial release.
33 changes: 33 additions & 0 deletions npaw/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
The Clear BSD License

Copyright (c) 2025 Dolby International AB
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the disclaimer
below) provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 changes: 35 additions & 0 deletions npaw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# THEOplayer React Native NPAW Connector

An NPAW analytics connector for `@theoplayer/react-native` that works across iOS, Android, and web.

## Installation

```sh
npm install @theoplayer/react-native-analytics-npaw
```

## Usage

```tsx
import { LogLevel, useNpaw } from '@theoplayer/react-native-analytics-npaw';

const App = () => {
const [_connector, initialize] = useNpaw({
accountCode: 'your-account-code',
analytics: {
'content.title': 'My Title',
'content.isLive': true,
},
logLevel: LogLevel.DEBUG,
});

const onPlayerReady = (player: THEOplayer) => {
initialize(player);
};

return <THEOplayerView config={playerConfig} onPlayerReady={onPlayerReady} />;
};
```

See the [NPAW React Native Video.js integration documentation](https://documentation.npaw.com/integration-docs/docs/react-native-video-js)
for available plugin and analytics options.
3 changes: 3 additions & 0 deletions npaw/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
6 changes: 6 additions & 0 deletions npaw/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const manifest = {
version: process.env.npm_package_version,
buildDate: new Date().toISOString(),
};

console.log(JSON.stringify(manifest));
75 changes: 75 additions & 0 deletions npaw/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "@theoplayer/react-native-analytics-npaw",
"version": "1.0.0",
"description": "NPAW analytics connector for @theoplayer/react-native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
"types": "lib/typescript/src/index.d.ts",
"react-native": "src/index",
"source": "src/index",
"files": [
"src",
"lib",
"*.tgz",
"CHANGELOG.md",
"!lib/typescript/example",
"!**/__tests__",
"!**/__fixtures__",
"!**/__mocks__",
"!**/.*"
],
"scripts": {
"typescript": "tsc --noEmit",
"build": "bob build",
"manifest": "node manifest.js > src/manifest.json",
"prepare": "npm run manifest && npm run build",
"clean": "rimraf lib"
},
"keywords": [
"react-native",
"THEOplayer",
"npaw"
],
"repository": {
"type": "git",
"url": "git@github.com:THEOplayer/react-native-connectors.git"
},
"author": "Dolby Laboratories, Inc.",
"license": "BSD-3-Clause-Clear",
"homepage": "https://github.com/THEOplayer/react-native-connectors/tree/main/npaw#readme",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"npaw-plugin-react-native": "^7.3.33"
},
"peerDependencies": {
"react": "*",
"react-native": "*",
"react-native-theoplayer": "^7 || ^8 || ^9 || ^10 || ^11",
"theoplayer": "^7 || ^8 || ^9 || ^10 || ^11"
},
"peerDependenciesMeta": {
"theoplayer": {
"optional": true
}
},
"eslintIgnore": [
"node_modules/",
"lib/"
],
"react-native-builder-bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
[
"typescript",
{
"project": "tsconfig.build.json"
}
]
]
}
}
1 change: 1 addition & 0 deletions npaw/src/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
8 changes: 8 additions & 0 deletions npaw/src/api/LogLevel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export enum LogLevel {
SILENT = 6,
ERROR = 5,
WARNING = 4,
NOTICE = 3,
DEBUG = 2,
VERBOSE = 1,
}
Loading
Loading