35 Commits

Author SHA1 Message Date
79f243c7d3 Fix typescript 2025-10-21 23:28:15 +02:00
ceaf050caf Add text track handling 2025-10-21 22:39:17 +02:00
4f9204f27c Handle text track change event 2025-10-21 22:39:17 +02:00
aa2921c8b4 Add quality selector 2025-10-21 22:39:17 +02:00
2e856249b3 Add video track handling on web 2025-10-21 22:39:17 +02:00
fb99df1d58 Add audio track support 2025-10-21 22:39:17 +02:00
6ab3eb397c Fix media session for web 2025-10-21 22:39:16 +02:00
2984630e55 Add error handling for the web 2025-10-21 22:39:16 +02:00
70405e7052 Add optional mimeType string in source object 2025-10-21 22:39:16 +02:00
a964c83ecc Handle media sessions 2025-10-21 22:39:16 +02:00
92104b61f5 Rework everything to use videojs instead of shaka 2025-10-21 22:39:16 +02:00
e34df18ae7 Fix event listeners this 2025-10-21 22:39:16 +02:00
21cd8b9508 Fix typescript issues 2025-10-21 22:39:16 +02:00
1bd239c530 Some cleanup 2025-10-21 22:39:16 +02:00
684e9637e0 Fix package lock 2025-10-21 22:39:16 +02:00
b9211e00a0 Map source 2025-10-21 22:39:16 +02:00
1c2f1430f8 Implement event handlers for web 2025-10-21 22:39:16 +02:00
db6faf7d5a Implement html video properties using headless video 2025-10-21 22:39:16 +02:00
917e22f0b3 Implement VideoView for web 2025-10-21 22:39:16 +02:00
963d3d4003 Scaffold web 2025-10-21 22:39:16 +02:00
680453567c Add shaka as an optional dependency and fix their type 2025-10-21 22:39:16 +02:00
5d18e41254 Add shell.nix & editorconfig 2025-10-21 22:28:56 +02:00
Krzysztof Moch
01395f247b chore: release 7.0.0-alpha.7 2025-10-16 18:17:47 +02:00
Krzysztof Moch
9f2d1894ae chore(deps): bump nitro version 2025-10-15 18:52:30 +02:00
Krzysztof Moch
8ce38cab1b fix(android): call start foreground service if needed (#4733) 2025-10-15 15:50:47 +02:00
Krzysztof Moch
52499e5af7 chore: release 7.0.0-alpha.6 2025-10-10 15:57:09 +02:00
Krzysztof Moch
6f8282616c chore: rename drm plugin package name 2025-10-10 15:40:51 +02:00
Krzysztof Moch
9b74665fb4 chore: update release script (#4727) 2025-10-08 13:39:19 +02:00
Krzysztof Moch
1671c63dab feat(android): support flexible page sizes (#4726) 2025-10-08 13:14:53 +02:00
Krzysztof Moch
02044de0e9 feat: add notification controls (#4721) 2025-10-06 16:36:52 +02:00
Krzysztof Moch
375fbeb0eb feat: bump nitro modules (#4720) 2025-10-03 16:14:47 +02:00
Krzysztof Moch
4ebc9b7f05 feat(android): add surface type prop (#4719) 2025-10-03 15:58:29 +02:00
Krzysztof Moch
a97581ab8a chore: release 7.0.0-alpha.5 2025-10-02 13:33:03 +02:00
Krzysztof Moch
58a268c022 chore: cleanup events code 2025-10-02 13:31:21 +02:00
07b55755d1 refactor: event handler to use add/remove style (#4708) 2025-10-02 12:53:32 +02:00
164 changed files with 4856 additions and 2124 deletions

9
.editorconfig Normal file
View File

@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

View File

@@ -13,7 +13,7 @@ runs:
- name: Setup Bun - name: Setup Bun
uses: oven-sh/setup-bun@v2 uses: oven-sh/setup-bun@v2
with: with:
bun-version: 1.2.19 bun-version: 1.3.0
- name: Cache dependencies - name: Cache dependencies
id: bun-cache id: bun-cache
@@ -30,4 +30,4 @@ runs:
working-directory: ${{ inputs.working-directory }} working-directory: ${{ inputs.working-directory }}
run: bun install run: bun install
shell: bash shell: bash

1641
bun.lock

File diff suppressed because it is too large Load Diff

2
bunfig.toml Normal file
View File

@@ -0,0 +1,2 @@
[install]
linker = "hoisted"

View File

@@ -16,7 +16,7 @@
"allowUnusedLabels": false, "allowUnusedLabels": false,
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"lib": ["ESNext"], "lib": ["ESNext", "dom"],
"module": "ESNext", "module": "ESNext",
"moduleResolution": "bundler", "moduleResolution": "bundler",
"noEmit": true, "noEmit": true,
@@ -33,4 +33,4 @@
"target": "ESNext", "target": "ESNext",
"verbatimModuleSyntax": true "verbatimModuleSyntax": true
} }
} }

View File

@@ -87,17 +87,17 @@ import { VideoPlayer } from 'react-native-video';
const player = new VideoPlayer('https://example.com/video.mp4'); const player = new VideoPlayer('https://example.com/video.mp4');
player.onLoad = (data) => { player.addEventListener('onLoad', (data) => {
console.log('Video loaded! Duration:', data.duration); console.log('Video loaded! Duration:', data.duration);
}; });
player.onProgress = (data) => { player.addEventListener('onProgress', (data) => {
console.log('Current time:', data.currentTime); console.log('Current time:', data.currentTime);
}; });
player.onError = (error) => { player.addEventListener('onError', (error) => {
console.error('Player Error:', error.code, error.message); console.error('Player Error:', error.code, error.message);
}; });
player.play(); player.play();
``` ```
@@ -105,4 +105,4 @@ player.play();
## Clearing Events ## Clearing Events
- The `player.clearEvent(eventName)` method can be used to clear a specific native event handler. - The `player.clearEvent(eventName)` method can be used to clear a specific native event handler.
- When a player instance is no longer needed and `player.release()` is called, all event listeners are automatically cleared - When a player instance is no longer needed and `player.release()` is called, all event listeners are automatically cleared

View File

@@ -17,20 +17,20 @@ This page explains how to play DRMprotected content with React Native Video u
## Install and enable the DRM plugin ## Install and enable the DRM plugin
:::tip Pluginable Architecture :::tip Pluginable Architecture
React Native Video uses a plugin architecture. DRM support is provided by the `@twg/react-native-video-drm` plugin and is not built into the core package. React Native Video uses a plugin architecture. DRM support is provided by the `@react-native-video/drm` plugin and is not built into the core package.
::: :::
1) Install dependencies in your app: 1) Install dependencies in your app:
```sh ```sh
npm install @twg/react-native-video-drm npm install @react-native-video/drm
``` ```
2) Enable the plugin at app startup (before creating any players): 2) Enable the plugin at app startup (before creating any players):
```ts ```ts
// App.tsx (or any place you want to initialize the plugin) // App.tsx (or any place you want to initialize the plugin)
import { enable } from '@twg/react-native-video-drm'; import { enable } from '@react-native-video/drm';
enable(); enable();
``` ```
@@ -185,7 +185,7 @@ If you are looking for implementing offline playback with DRM, make sure to chec
## Troubleshooting ## Troubleshooting
- DRMPluginNotFound: Ensure you installed `@twg/react-native-video-drm`, imported it, and called `enable()` before creating any players. - DRMPluginNotFound: Ensure you installed `@react-native-video/drm`, imported it, and called `enable()` before creating any players.
- iOS headers: The default FairPlay flow uses `source.headers` for license requests; `drm.licenseHeaders` are not used on iOS. - iOS headers: The default FairPlay flow uses `source.headers` for license requests; `drm.licenseHeaders` are not used on iOS.
- Invalid CKC: `getLicense` must return a base64 string. Returning raw bytes or JSON will fail. - Invalid CKC: `getLicense` must return a base64 string. Returning raw bytes or JSON will fail.
- 403/415 from license server: Verify required auth headers, content type, and whether the server expects raw SPC bytes vs base64. - 403/415 from license server: Verify required auth headers, content type, and whether the server expects raw SPC bytes vs base64.

View File

@@ -145,6 +145,6 @@ Properties below are Apple platformsonly
Protected content is supported via a plugin. See the full DRM guide: [DRM](./drm.md). Protected content is supported via a plugin. See the full DRM guide: [DRM](./drm.md).
Quick notes: Quick notes:
- Install and enable the official plugin `@twg/react-native-video-drm` and call `enable()` at app startup before creating players. - Install and enable the official plugin `@react-native-video/drm` and call `enable()` at app startup before creating players.
- Pass DRM configuration on the source using the `drm` property of `VideoConfig` (see the DRM guide for platform specifics and `getLicense` examples). - Pass DRM configuration on the source using the `drm` property of `VideoConfig` (see the DRM guide for platform specifics and `getLicense` examples).
- If you defer initialization (`initializeOnCreation: false`), be sure to call `await player.initialize()` (or `preload()`) before expecting DRM license acquisition events. - If you defer initialization (`initializeOnCreation: false`), be sure to call `await player.initialize()` (or `preload()`) before expecting DRM license acquisition events.

View File

@@ -53,6 +53,7 @@ export default App;
| `autoEnterPictureInPicture` | `boolean` | No | `false` | Whether the video should automatically enter PiP mode when it starts playing and the app is backgrounded (behavior might vary by platform). | | `autoEnterPictureInPicture` | `boolean` | No | `false` | Whether the video should automatically enter PiP mode when it starts playing and the app is backgrounded (behavior might vary by platform). |
| `resizeMode` | `'contain' \| 'cover' \| 'stretch' \| 'none'` | No | `'none'` | How the video should be resized to fit the view. | | `resizeMode` | `'contain' \| 'cover' \| 'stretch' \| 'none'` | No | `'none'` | How the video should be resized to fit the view. |
| `keepScreenAwake` | `boolean` | No | `true` | Whether to keep the device screen awake while the video view is mounted. | | `keepScreenAwake` | `boolean` | No | `true` | Whether to keep the device screen awake while the video view is mounted. |
| `surfaceType` | `'surface' \| 'texture'` | No (Android only) | `'surface'` | (Android) Underlying native view type. `'surface'` uses a SurfaceView (better performance, no transforms/overlap), `'texture'` uses a TextureView (supports animations, transforms, overlapping UI) at a small performance cost. Ignored on iOS. |
## Events ## Events
@@ -104,4 +105,26 @@ Available methods on the `VideoViewRef`:
| `exitFullscreen()` | `() => void` | Programmatically requests the video view to exit fullscreen mode. | | `exitFullscreen()` | `() => void` | Programmatically requests the video view to exit fullscreen mode. |
| `enterPictureInPicture()` | `() => void` | Programmatically requests the video view to enter picture-in-picture mode. | | `enterPictureInPicture()` | `() => void` | Programmatically requests the video view to enter picture-in-picture mode. |
| `exitPictureInPicture()` | `() => void` | Programmatically requests the video view to exit picture-in-picture mode. | | `exitPictureInPicture()` | `() => void` | Programmatically requests the video view to exit picture-in-picture mode. |
| `canEnterPictureInPicture()` | `() => boolean` | Checks if picture-in-picture mode is currently available and supported. Returns `true` if PiP can be entered, `false` otherwise. | | `canEnterPictureInPicture()` | `() => boolean` | Checks if picture-in-picture mode is currently available and supported. Returns `true` if PiP can be entered, `false` otherwise. |
## Android: Choosing a surface type
On Android the default rendering path uses a `SurfaceView` (set via `surfaceType="surface"`) for optimal decoding performance and lower latency. However `SurfaceView` lives in a separate window and can't be:
- Animated with transforms (scale, rotate, opacity fade)
- Clipped by parent views (rounded corners, masks)
- Overlapped reliably with sibling views (z-order issues)
If you need those UI effects, switch to `TextureView`:
```tsx
<VideoView
player={player}
surfaceType="texture"
style={{ width: 300, height: 170, borderRadius: 16, overflow: 'hidden' }}
resizeMode="cover"
controls
/>
```
Use `TextureView` only when required, as it can be slightly less performant and may increase power consumption on some devices.

View File

@@ -8,7 +8,7 @@ PODS:
- hermes-engine (0.77.2): - hermes-engine (0.77.2):
- hermes-engine/Pre-built (= 0.77.2) - hermes-engine/Pre-built (= 0.77.2)
- hermes-engine/Pre-built (0.77.2) - hermes-engine/Pre-built (0.77.2)
- NitroModules (0.28.0): - NitroModules (0.29.8):
- DoubleConversion - DoubleConversion
- glog - glog
- hermes-engine - hermes-engine
@@ -1565,7 +1565,7 @@ PODS:
- React-logger (= 0.77.2) - React-logger (= 0.77.2)
- React-perflogger (= 0.77.2) - React-perflogger (= 0.77.2)
- React-utils (= 0.77.2) - React-utils (= 0.77.2)
- ReactNativeVideo (7.0.0-alpha.4): - ReactNativeVideo (7.0.0-alpha.6):
- DoubleConversion - DoubleConversion
- glog - glog
- hermes-engine - hermes-engine
@@ -1587,7 +1587,7 @@ PODS:
- ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core - ReactCommon/turbomodule/core
- Yoga - Yoga
- ReactNativeVideoDrm (0.1.0): - ReactNativeVideoDrm (7.0.0-alpha.6):
- DoubleConversion - DoubleConversion
- glog - glog
- hermes-engine - hermes-engine
@@ -1686,7 +1686,7 @@ DEPENDENCIES:
- ReactCodegen (from `build/generated/ios`) - ReactCodegen (from `build/generated/ios`)
- ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`) - ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`)
- ReactNativeVideo (from `../../node_modules/react-native-video`) - ReactNativeVideo (from `../../node_modules/react-native-video`)
- "ReactNativeVideoDrm (from `../../node_modules/@twg/react-native-video-drm`)" - "ReactNativeVideoDrm (from `../../node_modules/@react-native-video/drm`)"
- Yoga (from `../../node_modules/react-native/ReactCommon/yoga`) - Yoga (from `../../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS: SPEC REPOS:
@@ -1832,7 +1832,7 @@ EXTERNAL SOURCES:
ReactNativeVideo: ReactNativeVideo:
:path: "../../node_modules/react-native-video" :path: "../../node_modules/react-native-video"
ReactNativeVideoDrm: ReactNativeVideoDrm:
:path: "../../node_modules/@twg/react-native-video-drm" :path: "../../node_modules/@react-native-video/drm"
Yoga: Yoga:
:path: "../../node_modules/react-native/ReactCommon/yoga" :path: "../../node_modules/react-native/ReactCommon/yoga"
@@ -1844,7 +1844,7 @@ SPEC CHECKSUMS:
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
glog: eb93e2f488219332457c3c4eafd2738ddc7e80b8 glog: eb93e2f488219332457c3c4eafd2738ddc7e80b8
hermes-engine: 8eb265241fa1d7095d3a40d51fd90f7dce68217c hermes-engine: 8eb265241fa1d7095d3a40d51fd90f7dce68217c
NitroModules: 1e4150c3e3676e05209234a8a5e0e8886fc0311a NitroModules: b4cd8f92604355343f12fc93772ff5a19571d41f
RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82 RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82
RCTDeprecation: 85b72250b63cfb54f29ca96ceb108cb9ef3c2079 RCTDeprecation: 85b72250b63cfb54f29ca96ceb108cb9ef3c2079
RCTRequired: 567cb8f5d42b990331bfd93faad1d8999b1c1736 RCTRequired: 567cb8f5d42b990331bfd93faad1d8999b1c1736
@@ -1904,8 +1904,8 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: f334cebc0beed0a72490492e978007082c03d533 ReactAppDependencyProvider: f334cebc0beed0a72490492e978007082c03d533
ReactCodegen: 474fbb3e4bb0f1ee6c255d1955db76e13d509269 ReactCodegen: 474fbb3e4bb0f1ee6c255d1955db76e13d509269
ReactCommon: 7763e59534d58e15f8f22121cdfe319040e08888 ReactCommon: 7763e59534d58e15f8f22121cdfe319040e08888
ReactNativeVideo: f365bc4f1a57ab50ddb655cda2f47bc06698a53b ReactNativeVideo: 6290dbf881cdeb58c09b5aef1af1245aebf5a207
ReactNativeVideoDrm: 62840ae0e184f711a2e6495c18e342a74cb598f8 ReactNativeVideoDrm: 0664dcc3ccac781f6fd00329cb890b6d1f15c392
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: 31a098f74c16780569aebd614a0f37a907de0189 Yoga: 31a098f74c16780569aebd614a0f37a907de0189

View File

@@ -1,21 +1,23 @@
{ {
"name": "react-native-video-example", "name": "react-native-video-example",
"version": "7.0.0-alpha.4", "version": "7.0.0-alpha.7",
"private": true, "private": true,
"scripts": { "scripts": {
"android": "react-native run-android", "android": "react-native run-android",
"ios": "react-native run-ios", "ios": "react-native run-ios",
"lint": "eslint .", "lint": "eslint .",
"typecheck": "tsc", "typecheck": "tsc",
"start": "react-native start --client-logs" "start": "react-native start --client-logs",
"bundle-install": "bundle install",
"pods": "cd ios && pod install && cd .."
}, },
"dependencies": { "dependencies": {
"@react-native-community/slider": "^4.5.6", "@react-native-community/slider": "^4.5.6",
"react": "18.3.1", "react": "18.3.1",
"react-native": "^0.77.0", "react-native": "^0.77.0",
"react-native-nitro-modules": "^0.28.0", "react-native-nitro-modules": "^0.30.0",
"react-native-video": "*", "react-native-video": "*",
"@twg/react-native-video-drm": "*" "@react-native-video/drm": "*"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",

View File

@@ -146,6 +146,7 @@ const VideoDemo = () => {
player.playWhenInactive = settings.playWhenInactive; player.playWhenInactive = settings.playWhenInactive;
player.mixAudioMode = settings.mixAudioMode; player.mixAudioMode = settings.mixAudioMode;
player.ignoreSilentSwitchMode = settings.ignoreSilentSwitchMode; player.ignoreSilentSwitchMode = settings.ignoreSilentSwitchMode;
player.showNotificationControls = settings.showNotificationControls;
}, [settings, player]); }, [settings, player]);
const handleSeek = (val: number) => { const handleSeek = (val: number) => {
@@ -315,6 +316,13 @@ const VideoDemo = () => {
value={settings.playWhenInactive} value={settings.playWhenInactive}
onValueChange={(value) => updateSetting('playWhenInactive', value)} onValueChange={(value) => updateSetting('playWhenInactive', value)}
/> />
<SwitchControl
label="Notification Controls"
value={settings.showNotificationControls}
onValueChange={(value) =>
updateSetting('showNotificationControls', value)
}
/>
</View> </View>
</View> </View>

View File

@@ -17,6 +17,7 @@ export interface VideoSettings {
ignoreSilentSwitchMode: IgnoreSilentSwitchMode; ignoreSilentSwitchMode: IgnoreSilentSwitchMode;
playInBackground: boolean; playInBackground: boolean;
playWhenInactive: boolean; playWhenInactive: boolean;
showNotificationControls: boolean;
} }
export const defaultSettings: VideoSettings = { export const defaultSettings: VideoSettings = {
@@ -32,4 +33,5 @@ export const defaultSettings: VideoSettings = {
ignoreSilentSwitchMode: 'auto', ignoreSilentSwitchMode: 'auto',
playInBackground: true, playInBackground: true,
playWhenInactive: false, playWhenInactive: false,
showNotificationControls: true,
}; };

View File

@@ -4,7 +4,7 @@ import {
enable as enableDRMPlugin, enable as enableDRMPlugin,
disable as disableDRMPlugin, disable as disableDRMPlugin,
isEnabled as isDRMPluginEnabled, isEnabled as isDRMPluginEnabled,
} from '@twg/react-native-video-drm'; } from '@react-native-video/drm';
const getDRMSource = (): VideoConfig => { const getDRMSource = (): VideoConfig => {
const HLS = const HLS =
@@ -103,5 +103,14 @@ export const getVideoSource = (type: VideoType): VideoConfig => {
type: 'vtt', type: 'vtt',
}, },
], ],
metadata: {
title: 'Big Buck Bunny',
artist: 'Blender Foundation',
imageUri:
'https://peach.blender.org/wp-content/uploads/title_anouncement.jpg',
subtitle: 'By the Blender Institute',
description:
'Big Buck Bunny is a short computer-animated comedy film by the Blender Institute, part of the Blender Foundation. It was made using Blender, a free and open-source 3D creation suite.',
},
} as VideoConfig; } as VideoConfig;
}; };

View File

@@ -1,7 +1,7 @@
{ {
"name": "react-native-video-monorepo", "name": "react-native-video-monorepo",
"packageManager": "bun@1.1.42", "packageManager": "bun@1.1.42",
"version": "7.0.0-alpha.4", "version": "7.0.0-alpha.7",
"private": true, "private": true,
"repository": "https://github.com/TheWidlarzGroup/react-native-video", "repository": "https://github.com/TheWidlarzGroup/react-native-video",
"author": "TheWidlarzGroup <hi@thewidlarzgroup.com> (https://github.com/TheWidlarzGroup)", "author": "TheWidlarzGroup <hi@thewidlarzgroup.com> (https://github.com/TheWidlarzGroup)",
@@ -34,6 +34,7 @@
"@release-it/conventional-changelog": "^8.0.2", "@release-it/conventional-changelog": "^8.0.2",
"@tsconfig/react-native": "^2.0.2", "@tsconfig/react-native": "^2.0.2",
"@types/eslint__js": "^8.42.3", "@types/eslint__js": "^8.42.3",
"@types/node": "^24.9.1",
"@types/react": "^18.2.44", "@types/react": "^18.2.44",
"commitlint": "^17.0.2", "commitlint": "^17.0.2",
"eslint": "^8.51.0", "eslint": "^8.51.0",
@@ -64,7 +65,8 @@
"release": true "release": true
}, },
"hooks": { "hooks": {
"before:release": "bun run --cwd packages/react-native-video build" "before:release": "bun run --cwd packages/react-native-video build && bun run --cwd packages/drm-plugin build",
"before:git": "bun install && bun example bundle-install && bun example pods && git add bun.lock && git add example/ios/Podfile.lock"
}, },
"plugins": { "plugins": {
"@release-it/bumper": { "@release-it/bumper": {
@@ -73,6 +75,10 @@
"file": "packages/react-native-video/package.json", "file": "packages/react-native-video/package.json",
"path": "version" "path": "version"
}, },
{
"file": "packages/drm-plugin/package.json",
"path": "version"
},
{ {
"file": "example/package.json", "file": "example/package.json",
"path": "version" "path": "version"
@@ -91,6 +97,10 @@
"type": "fix", "type": "fix",
"section": "Bug Fixes 🐛" "section": "Bug Fixes 🐛"
}, },
{
"type": "refactor",
"section": "Code Refactoring 🛠"
},
{ {
"type": "chore(deps)", "type": "chore(deps)",
"section": "Dependency Upgrades 📦" "section": "Dependency Upgrades 📦"

View File

@@ -1,4 +1,4 @@
# @twg/react-native-video-drm # @react-native-video/drm
DRM plugin for react-native-video. It adds Widevine (Android) and FairPlay (iOS, visionOS) playback support via the react-native-video plugin system. DRM plugin for react-native-video. It adds Widevine (Android) and FairPlay (iOS, visionOS) playback support via the react-native-video plugin system.
@@ -10,7 +10,7 @@ DRM plugin for react-native-video. It adds Widevine (Android) and FairPlay (iOS,
## Installation ## Installation
```sh ```sh
npm install @twg/react-native-video-drm react-native-video react-native-nitro-modules npm install @react-native-video/drm react-native-video react-native-nitro-modules
# then for iOS # then for iOS
npx pod-install npx pod-install
``` ```
@@ -27,7 +27,7 @@ Enable the plugin once at app start, then pass DRM params on your video source.
import React from 'react'; import React from 'react';
import { Platform } from 'react-native'; import { Platform } from 'react-native';
import { VideoView, useVideoPlayer } from 'react-native-video'; import { VideoView, useVideoPlayer } from 'react-native-video';
import { enable, isEnabled } from '@twg/react-native-video-drm'; import { enable, isEnabled } from '@react-native-video/drm';
// Enable at startup (required on Android; safe on iOS) // Enable at startup (required on Android; safe on iOS)
enable(); enable();
@@ -59,7 +59,7 @@ export default function Player() {
## API ## API
From `@twg/react-native-video-drm`: From `@react-native-video/drm`:
- `enable(): void` — registers the plugin. Call once during app startup (Android requires it; iOS tries to auto-enable, but calling is safe). - `enable(): void` — registers the plugin. Call once during app startup (Android requires it; iOS tries to auto-enable, but calling is safe).
- `disable(): void` — unregisters the plugin. - `disable(): void` — unregisters the plugin.

View File

@@ -13,6 +13,12 @@
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/ReactNativeVideoDrm+autolinking.cmake) # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/ReactNativeVideoDrm+autolinking.cmake)
# ``` # ```
# Define a flag to check if we are building properly
add_definitions(-DBUILDING_REACTNATIVEVIDEODRM_WITH_GENERATED_CMAKE_PROJECT)
# Enable Raw Props parsing in react-native (for Nitro Views)
add_definitions(-DRN_SERIALIZABLE_STATE)
# Add all headers that were generated by Nitrogen # Add all headers that were generated by Nitrogen
include_directories( include_directories(
"../nitrogen/generated/shared/c++" "../nitrogen/generated/shared/c++"
@@ -32,12 +38,9 @@ target_sources(
../nitrogen/generated/android/c++/JHybridPluginManagerSpec.cpp ../nitrogen/generated/android/c++/JHybridPluginManagerSpec.cpp
) )
# Define a flag to check if we are building properly
add_definitions(-DBUILDING_REACTNATIVEVIDEODRM_WITH_GENERATED_CMAKE_PROJECT)
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
target_compile_definitions( target_compile_definitions(
ReactNativeVideoDrm PRIVATE ReactNativeVideoDrm PRIVATE
-DFOLLY_NO_CONFIG=1 -DFOLLY_NO_CONFIG=1
-DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_CLOCK_GETTIME=1

View File

@@ -35,8 +35,7 @@ int initialize(JavaVM* vm) {
[]() -> std::shared_ptr<HybridObject> { []() -> std::shared_ptr<HybridObject> {
static DefaultConstructableObject<JHybridPluginManagerSpec::javaobject> object("com/margelo/nitro/videodrm/PluginManager"); static DefaultConstructableObject<JHybridPluginManagerSpec::javaobject> object("com/margelo/nitro/videodrm/PluginManager");
auto instance = object.create(); auto instance = object.create();
auto globalRef = jni::make_global(instance); return instance->cthis()->shared();
return globalRef->cthis()->shared();
} }
); );
}); });

View File

@@ -53,6 +53,6 @@ abstract class HybridPluginManagerSpec: HybridObject() {
private external fun initHybrid(): HybridData private external fun initHybrid(): HybridData
companion object { companion object {
private const val TAG = "HybridPluginManagerSpec" protected const val TAG = "HybridPluginManagerSpec"
} }
} }

View File

@@ -14,11 +14,11 @@
namespace margelo::nitro::videodrm::bridge::swift { namespace margelo::nitro::videodrm::bridge::swift {
// pragma MARK: std::shared_ptr<HybridPluginManagerSpec> // pragma MARK: std::shared_ptr<HybridPluginManagerSpec>
std::shared_ptr<HybridPluginManagerSpec> create_std__shared_ptr_HybridPluginManagerSpec_(void* _Nonnull swiftUnsafePointer) { std::shared_ptr<HybridPluginManagerSpec> create_std__shared_ptr_HybridPluginManagerSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
ReactNativeVideoDrm::HybridPluginManagerSpec_cxx swiftPart = ReactNativeVideoDrm::HybridPluginManagerSpec_cxx::fromUnsafe(swiftUnsafePointer); ReactNativeVideoDrm::HybridPluginManagerSpec_cxx swiftPart = ReactNativeVideoDrm::HybridPluginManagerSpec_cxx::fromUnsafe(swiftUnsafePointer);
return std::make_shared<margelo::nitro::videodrm::HybridPluginManagerSpecSwift>(swiftPart); return std::make_shared<margelo::nitro::videodrm::HybridPluginManagerSpecSwift>(swiftPart);
} }
void* _Nonnull get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType) { void* NON_NULL get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType) {
std::shared_ptr<margelo::nitro::videodrm::HybridPluginManagerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::videodrm::HybridPluginManagerSpecSwift>(cppType); std::shared_ptr<margelo::nitro::videodrm::HybridPluginManagerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::videodrm::HybridPluginManagerSpecSwift>(cppType);
#ifdef NITRO_DEBUG #ifdef NITRO_DEBUG
if (swiftWrapper == nullptr) [[unlikely]] { if (swiftWrapper == nullptr) [[unlikely]] {

View File

@@ -32,19 +32,19 @@ namespace margelo::nitro::videodrm::bridge::swift {
* Specialized version of `std::shared_ptr<HybridPluginManagerSpec>`. * Specialized version of `std::shared_ptr<HybridPluginManagerSpec>`.
*/ */
using std__shared_ptr_HybridPluginManagerSpec_ = std::shared_ptr<HybridPluginManagerSpec>; using std__shared_ptr_HybridPluginManagerSpec_ = std::shared_ptr<HybridPluginManagerSpec>;
std::shared_ptr<HybridPluginManagerSpec> create_std__shared_ptr_HybridPluginManagerSpec_(void* _Nonnull swiftUnsafePointer); std::shared_ptr<HybridPluginManagerSpec> create_std__shared_ptr_HybridPluginManagerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
void* _Nonnull get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType); void* NON_NULL get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType);
// pragma MARK: std::weak_ptr<HybridPluginManagerSpec> // pragma MARK: std::weak_ptr<HybridPluginManagerSpec>
using std__weak_ptr_HybridPluginManagerSpec_ = std::weak_ptr<HybridPluginManagerSpec>; using std__weak_ptr_HybridPluginManagerSpec_ = std::weak_ptr<HybridPluginManagerSpec>;
inline std__weak_ptr_HybridPluginManagerSpec_ weakify_std__shared_ptr_HybridPluginManagerSpec_(const std::shared_ptr<HybridPluginManagerSpec>& strong) { return strong; } inline std__weak_ptr_HybridPluginManagerSpec_ weakify_std__shared_ptr_HybridPluginManagerSpec_(const std::shared_ptr<HybridPluginManagerSpec>& strong) noexcept { return strong; }
// pragma MARK: Result<void> // pragma MARK: Result<void>
using Result_void_ = Result<void>; using Result_void_ = Result<void>;
inline Result_void_ create_Result_void_() { inline Result_void_ create_Result_void_() noexcept {
return Result<void>::withValue(); return Result<void>::withValue();
} }
inline Result_void_ create_Result_void_(const std::exception_ptr& error) { inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
return Result<void>::withError(error); return Result<void>::withError(error);
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@twg/react-native-video-drm", "name": "@react-native-video/drm",
"version": "0.1.0", "version": "7.0.0-alpha.7",
"description": "DRM plugin for react-native-video", "description": "DRM plugin for react-native-video",
"main": "./lib/module/index.js", "main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts", "types": "./lib/typescript/src/index.d.ts",
@@ -40,8 +40,8 @@
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib", "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepare": "bun run build", "prepare": "bun run build",
"build": "bob build", "build": "bob build",
"specs": "nitro-codegen", "specs": "nitrogen",
"release": "release-it --only-version" "release": "release-it --preRelease alpha --npm.tag=next"
}, },
"keywords": [ "keywords": [
"react-native", "react-native",
@@ -61,7 +61,8 @@
}, },
"homepage": "https://github.com/TheWidlarzGroup/react-native-video#readme", "homepage": "https://github.com/TheWidlarzGroup/react-native-video#readme",
"publishConfig": { "publishConfig": {
"registry": "https://registry.npmjs.org/" "registry": "https://registry.npmjs.org/",
"access": "public"
}, },
"devDependencies": { "devDependencies": {
"@react-native/babel-preset": "0.79.2", "@react-native/babel-preset": "0.79.2",
@@ -71,12 +72,12 @@
"eslint": "^8.51.0", "eslint": "^8.51.0",
"eslint-config-prettier": "9.0.0", "eslint-config-prettier": "9.0.0",
"eslint-plugin-prettier": "^5.0.1", "eslint-plugin-prettier": "^5.0.1",
"nitro-codegen": "^0.28.0", "nitrogen": "^0.30.0",
"prettier": "^3.0.3", "prettier": "^3.0.3",
"react": "18.3.1", "react": "18.3.1",
"react-native": "^0.77.0", "react-native": "^0.77.0",
"react-native-builder-bob": "^0.40.13", "react-native-builder-bob": "^0.40.13",
"react-native-nitro-modules": "^0.28.0", "react-native-nitro-modules": "^0.30.0",
"release-it": "^17.10.0", "release-it": "^17.10.0",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"react-native-video": "*" "react-native-video": "*"
@@ -97,7 +98,8 @@
"release-it": { "release-it": {
"git": false, "git": false,
"npm": { "npm": {
"publish": true "publish": true,
"publishArgs": "--access public"
}, },
"github": { "github": {
"release": false "release": false

View File

@@ -120,7 +120,7 @@ android {
externalNativeBuild { externalNativeBuild {
cmake { cmake {
cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all" cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all"
arguments "-DANDROID_STL=c++_shared" arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
abiFilters (*reactNativeArchitectures()) abiFilters (*reactNativeArchitectures())
} }
} }

View File

@@ -1,9 +1,9 @@
RNVideo_kotlinVersion=1.9.24 RNVideo_kotlinVersion=1.9.24
RNVideo_minKotlinVersion=1.8.0 RNVideo_minKotlinVersion=1.8.0
RNVideo_minSdkVersion=23 RNVideo_minSdkVersion=24
RNVideo_targetSdkVersion=34 RNVideo_targetSdkVersion=35
RNVideo_compileSdkVersion=34 RNVideo_compileSdkVersion=35
RNVideo_ndkversion=26.1.10909125 RNVideo_ndkversion=27.1.12297006
RNVideo_useExoplayerDash=true RNVideo_useExoplayerDash=true
RNVideo_useExoplayerHls=true RNVideo_useExoplayerHls=true

View File

@@ -21,10 +21,17 @@ fun VideoPlaybackService.Companion.startService(
val intent = Intent(context, VideoPlaybackService::class.java) val intent = Intent(context, VideoPlaybackService::class.java)
intent.action = VIDEO_PLAYBACK_SERVICE_INTERFACE intent.action = VIDEO_PLAYBACK_SERVICE_INTERFACE
// Use startForegroundService on O+ so the service has the opportunity to call
// startForeground(...) quickly and avoid ForegroundServiceDidNotStartInTimeException.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
reactContext.startForegroundService(intent); try {
reactContext.startForegroundService(intent)
} catch (_: Exception) {
// Fall back to startService if anything goes wrong
try { reactContext.startService(intent) } catch (_: Exception) {}
}
} else { } else {
reactContext.startService(intent); reactContext.startService(intent)
} }
val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
@@ -42,7 +49,11 @@ fun VideoPlaybackService.Companion.stopService(
serviceConnection: VideoPlaybackServiceConnection serviceConnection: VideoPlaybackServiceConnection
) { ) {
try { try {
NitroModules.applicationContext?.currentActivity?.unbindService(serviceConnection) // Unregister the player first; this might stop the service if no players remain
serviceConnection.unregisterPlayer(player) serviceConnection.unregisterPlayer(player)
// Ask service (if still connected) to stop when idle
try { serviceConnection.serviceBinder?.service?.stopIfNoPlayers() } catch (_: Exception) {}
// Then unbind
NitroModules.applicationContext?.currentActivity?.unbindService(serviceConnection)
} catch (_: Exception) {} } catch (_: Exception) {}
} }

View File

@@ -6,9 +6,11 @@ import androidx.annotation.OptIn
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.media3.common.MediaItem import androidx.media3.common.MediaItem
import androidx.media3.common.C import androidx.media3.common.C
import androidx.media3.common.MediaMetadata
import androidx.media3.common.MimeTypes import androidx.media3.common.MimeTypes
import androidx.media3.common.util.UnstableApi import androidx.media3.common.util.UnstableApi
import com.margelo.nitro.video.BufferConfig import com.margelo.nitro.video.BufferConfig
import com.margelo.nitro.video.CustomVideoMetadata
import com.margelo.nitro.video.HybridVideoPlayerSource import com.margelo.nitro.video.HybridVideoPlayerSource
import com.margelo.nitro.video.LivePlaybackParams import com.margelo.nitro.video.LivePlaybackParams
import com.margelo.nitro.video.NativeDrmParams import com.margelo.nitro.video.NativeDrmParams
@@ -39,6 +41,10 @@ fun createMediaItemFromVideoConfig(
mediaItemBuilder.setLiveConfiguration(getLiveConfiguration(livePlaybackParams)) mediaItemBuilder.setLiveConfiguration(getLiveConfiguration(livePlaybackParams))
} }
source.config.metadata?.let { metadata ->
mediaItemBuilder.setMediaMetadata(getCustomMetadata(metadata))
}
return PluginsRegistry.shared.overrideMediaItemBuilder( return PluginsRegistry.shared.overrideMediaItemBuilder(
source, source,
mediaItemBuilder mediaItemBuilder
@@ -122,3 +128,14 @@ fun getLiveConfiguration(
return liveConfiguration.build() return liveConfiguration.build()
} }
fun getCustomMetadata(metadata: CustomVideoMetadata): MediaMetadata {
return MediaMetadata.Builder()
.setDisplayTitle(metadata.title)
.setTitle(metadata.title)
.setSubtitle(metadata.subtitle)
.setDescription(metadata.description)
.setArtist(metadata.artist)
.setArtworkUri(metadata.imageUri?.toUri())
.build()
}

View File

@@ -77,6 +77,10 @@ fun buildExternalSubtitlesMediaSource(context: Context, source: HybridVideoPlaye
.setUri(source.uri.toUri()) .setUri(source.uri.toUri())
.setSubtitleConfigurations(getSubtitlesConfiguration(source.config)) .setSubtitleConfigurations(getSubtitlesConfiguration(source.config))
source.config.metadata?.let { metadata ->
mediaItemBuilderWithSubtitles.setMediaMetadata(getCustomMetadata(metadata))
}
val mediaItemBuilder = PluginsRegistry.shared.overrideMediaItemBuilder( val mediaItemBuilder = PluginsRegistry.shared.overrideMediaItemBuilder(
source, source,
mediaItemBuilderWithSubtitles mediaItemBuilderWithSubtitles

View File

@@ -0,0 +1,147 @@
package com.twg.video.core.services.playback
import android.content.Context
import android.app.PendingIntent
import android.content.Intent
import android.util.Log
import androidx.annotation.OptIn
import androidx.media3.common.MediaMetadata
import androidx.media3.common.Player
import androidx.media3.common.util.UnstableApi
import androidx.media3.session.CommandButton
import androidx.media3.session.DefaultMediaNotificationProvider
import androidx.media3.session.MediaSession
import com.google.common.collect.ImmutableList
import androidx.core.os.bundleOf
import android.os.Bundle
import com.margelo.nitro.NitroModules
import com.twg.video.core.LibraryError
@OptIn(UnstableApi::class)
class CustomMediaNotificationProvider(context: Context) : DefaultMediaNotificationProvider(context) {
init {
setSmallIcon(androidx.media3.session.R.drawable.media3_notification_small_icon)
}
fun getContext(): Context {
return NitroModules.applicationContext ?: run {
throw LibraryError.ApplicationContextNotFound
}
}
override fun getNotificationContentTitle(metadata: MediaMetadata): CharSequence? {
return metadata.title
?: metadata.displayTitle
?: metadata.subtitle
?: metadata.description
?: "${getAppName()} is playing"
}
override fun getNotificationContentText(metadata: MediaMetadata): CharSequence? {
return metadata.artist
?: metadata.subtitle
?: metadata.description
}
companion object {
private const val SEEK_INTERVAL_MS = 10000L
private const val TAG = "CustomMediaNotificationProvider"
enum class COMMAND(val stringValue: String) {
NONE("NONE"),
SEEK_FORWARD("COMMAND_SEEK_FORWARD"),
SEEK_BACKWARD("COMMAND_SEEK_BACKWARD"),
TOGGLE_PLAY("COMMAND_TOGGLE_PLAY"),
PLAY("COMMAND_PLAY"),
PAUSE("COMMAND_PAUSE")
}
fun commandFromString(value: String): COMMAND =
when (value) {
COMMAND.SEEK_FORWARD.stringValue -> COMMAND.SEEK_FORWARD
COMMAND.SEEK_BACKWARD.stringValue -> COMMAND.SEEK_BACKWARD
COMMAND.TOGGLE_PLAY.stringValue -> COMMAND.TOGGLE_PLAY
COMMAND.PLAY.stringValue -> COMMAND.PLAY
COMMAND.PAUSE.stringValue -> COMMAND.PAUSE
else -> COMMAND.NONE
}
fun handleCommand(command: COMMAND, session: MediaSession) {
// TODO: get somehow ControlsConfig here - for now hardcoded 10000ms
when (command) {
COMMAND.SEEK_BACKWARD -> session.player.seekTo(session.player.contentPosition - SEEK_INTERVAL_MS)
COMMAND.SEEK_FORWARD -> session.player.seekTo(session.player.contentPosition + SEEK_INTERVAL_MS)
COMMAND.TOGGLE_PLAY -> handleCommand(if (session.player.isPlaying) COMMAND.PAUSE else COMMAND.PLAY, session)
COMMAND.PLAY -> session.player.play()
COMMAND.PAUSE -> session.player.pause()
else -> Log.w(TAG, "Received COMMAND.NONE - was there an error?")
}
}
}
private fun getAppName(): String {
return try {
val context = getContext()
val pm = context.packageManager
val label = pm.getApplicationLabel(context.applicationInfo)
label.toString()
} catch (e: Exception) {
return "Unknown"
}
}
override fun getMediaButtons(
session: MediaSession,
playerCommands: Player.Commands,
mediaButtonPreferences: ImmutableList<CommandButton>,
showPauseButton: Boolean
): ImmutableList<CommandButton> {
val rewind = CommandButton.Builder()
.setDisplayName("Rewind")
.setSessionCommand(androidx.media3.session.SessionCommand(
COMMAND.SEEK_BACKWARD.stringValue,
Bundle.EMPTY
))
.setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_back_10)
.setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 0))
.build()
val toggle = CommandButton.Builder()
.setDisplayName(if (showPauseButton) "Pause" else "Play")
.setSessionCommand(androidx.media3.session.SessionCommand(
COMMAND.TOGGLE_PLAY.stringValue,
Bundle.EMPTY
))
.setIconResId(
if (showPauseButton) androidx.media3.session.R.drawable.media3_icon_pause
else androidx.media3.session.R.drawable.media3_icon_play
)
.setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 1))
.build()
val forward = CommandButton.Builder()
.setDisplayName("Forward")
.setSessionCommand(androidx.media3.session.SessionCommand(
COMMAND.SEEK_FORWARD.stringValue,
Bundle.EMPTY
))
.setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_forward_10)
.setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 2))
.build()
return ImmutableList.of(rewind, toggle, forward)
}
override fun addNotificationActions(
mediaSession: MediaSession,
mediaButtons: ImmutableList<CommandButton>,
builder: androidx.core.app.NotificationCompat.Builder,
actionFactory: androidx.media3.session.MediaNotification.ActionFactory
): IntArray {
// Use default behavior to add actions from our custom buttons and return compact indices
val compact = super.addNotificationActions(mediaSession, mediaButtons, builder, actionFactory)
return if (compact.isEmpty()) intArrayOf(0, 1, 2) else compact
}
}

View File

@@ -4,13 +4,41 @@ import android.os.Bundle
import androidx.annotation.OptIn import androidx.annotation.OptIn
import androidx.media3.common.Player import androidx.media3.common.Player
import androidx.media3.common.util.UnstableApi import androidx.media3.common.util.UnstableApi
import androidx.media3.session.CommandButton
import androidx.media3.session.MediaSession import androidx.media3.session.MediaSession
import androidx.media3.session.SessionCommand import androidx.media3.session.SessionCommand
import androidx.media3.session.SessionResult import androidx.media3.session.SessionResult
import com.google.common.util.concurrent.ListenableFuture import com.google.common.util.concurrent.ListenableFuture
import com.google.common.collect.ImmutableList
@OptIn(UnstableApi::class) @OptIn(UnstableApi::class)
class VideoPlaybackCallback : MediaSession.Callback { class VideoPlaybackCallback : MediaSession.Callback {
// For Android 13+
private fun buildCustomButtons(): ImmutableList<CommandButton> {
val rewind = CommandButton.Builder()
.setDisplayName("Rewind")
.setSessionCommand(
SessionCommand(
CustomMediaNotificationProvider.Companion.COMMAND.SEEK_BACKWARD.stringValue,
Bundle.EMPTY
)
)
.setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_back_10)
.build()
val forward = CommandButton.Builder()
.setDisplayName("Forward")
.setSessionCommand(
SessionCommand(
CustomMediaNotificationProvider.Companion.COMMAND.SEEK_FORWARD.stringValue,
Bundle.EMPTY
)
)
.setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_forward_10)
.build()
return ImmutableList.of(rewind, forward)
}
override fun onConnect(session: MediaSession, controller: MediaSession.ControllerInfo): MediaSession.ConnectionResult { override fun onConnect(session: MediaSession, controller: MediaSession.ControllerInfo): MediaSession.ConnectionResult {
try { try {
@@ -23,36 +51,46 @@ class VideoPlaybackCallback : MediaSession.Callback {
).setAvailableSessionCommands( ).setAvailableSessionCommands(
MediaSession.ConnectionResult.DEFAULT_SESSION_COMMANDS.buildUpon() MediaSession.ConnectionResult.DEFAULT_SESSION_COMMANDS.buildUpon()
.add( .add(
SessionCommand( SessionCommand(
VideoPlaybackService.Companion.COMMAND.SEEK_FORWARD.stringValue, CustomMediaNotificationProvider.Companion.COMMAND.SEEK_FORWARD.stringValue,
Bundle.EMPTY Bundle.EMPTY
) )
) )
.add( .add(
SessionCommand( SessionCommand(
VideoPlaybackService.Companion.COMMAND.SEEK_BACKWARD.stringValue, CustomMediaNotificationProvider.Companion.COMMAND.SEEK_BACKWARD.stringValue,
Bundle.EMPTY Bundle.EMPTY
) )
) )
.build() .add(
) SessionCommand(
.build() CustomMediaNotificationProvider.Companion.COMMAND.TOGGLE_PLAY.stringValue,
Bundle.EMPTY
)
).build()
).build()
} catch (e: Exception) { } catch (e: Exception) {
return MediaSession.ConnectionResult.reject() return MediaSession.ConnectionResult.reject()
} }
} }
override fun onPostConnect(session: MediaSession, controller: MediaSession.ControllerInfo) {
session.setCustomLayout(buildCustomButtons())
super.onPostConnect(session, controller)
}
override fun onCustomCommand( override fun onCustomCommand(
session: MediaSession, session: MediaSession,
controller: MediaSession.ControllerInfo, controller: MediaSession.ControllerInfo,
customCommand: SessionCommand, customCommand: SessionCommand,
args: Bundle args: Bundle
): ListenableFuture<SessionResult> { ): ListenableFuture<SessionResult> {
VideoPlaybackService.Companion.handleCommand( CustomMediaNotificationProvider.Companion.handleCommand(
VideoPlaybackService.Companion.commandFromString( CustomMediaNotificationProvider.Companion.commandFromString(
customCommand.customAction customCommand.customAction
), session ), session
) )
return super.onCustomCommand(session, controller, customCommand, args) return super.onCustomCommand(session, controller, customCommand, args)
} }
} }

View File

@@ -1,30 +1,27 @@
package com.twg.video.core.services.playback package com.twg.video.core.services.playback
import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent import android.app.PendingIntent
import android.content.Intent import android.content.Intent
import android.os.Binder import android.os.Binder
import android.os.Build
import android.os.Bundle
import android.os.IBinder import android.os.IBinder
import android.util.Log import android.util.Log
import androidx.annotation.OptIn import androidx.annotation.OptIn
import androidx.core.app.NotificationCompat import androidx.media3.common.util.BitmapLoader
import androidx.lifecycle.OnLifecycleEvent
import androidx.media3.common.util.UnstableApi import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.ExoPlayer import androidx.media3.session.DefaultMediaNotificationProvider
import androidx.media3.session.CommandButton import androidx.media3.session.SimpleBitmapLoader
import androidx.media3.session.MediaSession import androidx.media3.session.MediaSession
import androidx.media3.session.MediaSessionService import androidx.media3.session.MediaSessionService
import androidx.media3.session.MediaStyleNotificationHelper import android.app.Notification
import androidx.media3.session.SessionCommand import android.app.NotificationChannel
import androidx.media3.ui.R import android.app.NotificationManager
import android.os.Build
import androidx.core.app.NotificationCompat
import com.margelo.nitro.NitroModules
import com.margelo.nitro.video.HybridVideoPlayer import com.margelo.nitro.video.HybridVideoPlayer
import okhttp3.internal.immutableListOf import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
class VideoPlaybackServiceBinder(val service: VideoPlaybackService): Binder() class VideoPlaybackServiceBinder(val service: VideoPlaybackService): Binder()
@@ -32,26 +29,28 @@ class VideoPlaybackServiceBinder(val service: VideoPlaybackService): Binder()
class VideoPlaybackService : MediaSessionService() { class VideoPlaybackService : MediaSessionService() {
private var mediaSessionsList = mutableMapOf<HybridVideoPlayer, MediaSession>() private var mediaSessionsList = mutableMapOf<HybridVideoPlayer, MediaSession>()
private var binder = VideoPlaybackServiceBinder(this) private var binder = VideoPlaybackServiceBinder(this)
private var sourceActivity: Class<Activity>? = null private var sourceActivity: Class<Activity>? = null // retained for future deep-links; currently unused
private var placeholderCanceled = false private var isForeground = false
// Controls for Android 13+ - see buildNotification function override fun onCreate() {
private val commandSeekForward = SessionCommand(COMMAND.SEEK_FORWARD.stringValue, Bundle.EMPTY) super.onCreate()
private val commandSeekBackward = SessionCommand(COMMAND.SEEK_BACKWARD.stringValue, Bundle.EMPTY) setMediaNotificationProvider(CustomMediaNotificationProvider(this))
}
@SuppressLint("PrivateResource") override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
private val seekForwardBtn = CommandButton.Builder() // Ensure we call startForeground quickly on newer Android versions to avoid
.setDisplayName("forward") // ForegroundServiceDidNotStartInTimeException when startForegroundService(...) was used.
.setSessionCommand(commandSeekForward) try {
.setIconResId(R.drawable.exo_notification_fastforward) if (!isForeground && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
.build() startForeground(PLACEHOLDER_NOTIFICATION_ID, createPlaceholderNotification())
isForeground = true
}
} catch (_: Exception) {
Log.e(TAG, "Failed to start foreground service!")
}
@SuppressLint("PrivateResource") return super.onStartCommand(intent, flags, startId)
private val seekBackwardBtn = CommandButton.Builder() }
.setDisplayName("backward")
.setSessionCommand(commandSeekBackward)
.setIconResId(R.drawable.exo_notification_rewind)
.build()
// Player Registry // Player Registry
fun registerPlayer(player: HybridVideoPlayer, from: Class<Activity>) { fun registerPlayer(player: HybridVideoPlayer, from: Class<Activity>) {
@@ -60,27 +59,54 @@ class VideoPlaybackService : MediaSessionService() {
} }
sourceActivity = from sourceActivity = from
val mediaSession = MediaSession.Builder(this, player.player) val builder = MediaSession.Builder(this, player.player)
.setId("RNVideoPlaybackService_" + player.hashCode()) .setId("RNVideoPlaybackService_" + player.hashCode())
.setCallback(VideoPlaybackCallback()) .setCallback(VideoPlaybackCallback())
.setCustomLayout(immutableListOf(seekBackwardBtn, seekForwardBtn))
.build() // Ensure tapping the notification opens the app via sessionActivity
try {
val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
if (launchIntent != null) {
launchIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)
val contentIntent = PendingIntent.getActivity(
this,
0,
launchIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
builder.setSessionActivity(contentIntent)
}
} catch (_: Exception) {}
val mediaSession = builder.build()
mediaSessionsList[player] = mediaSession mediaSessionsList[player] = mediaSession
addSession(mediaSession) addSession(mediaSession)
// Manually trigger initial notification creation for the registered player
// This ensures the player notification appears immediately, even if not playing
onUpdateNotification(mediaSession, true)
} }
fun unregisterPlayer(player: HybridVideoPlayer) { fun unregisterPlayer(player: HybridVideoPlayer) {
hidePlayerNotification(player.player)
val session = mediaSessionsList.remove(player) val session = mediaSessionsList.remove(player)
session?.release() session?.release()
if (mediaSessionsList.isEmpty()) { stopIfNoPlayers()
cleanup() }
stopSelf()
fun updatePlayerPreferences(player: HybridVideoPlayer) {
val session = mediaSessionsList[player]
if (session == null) {
// If not registered but now needs it, register
if (player.playInBackground || player.showNotificationControls) {
val activity = try { NitroModules.applicationContext?.currentActivity } catch (_: Exception) { null }
if (activity != null) registerPlayer(player, activity.javaClass)
}
return
}
// If no longer needs registration, unregister and possibly stop service
if (!player.playInBackground && !player.showNotificationControls) {
unregisterPlayer(player)
stopIfNoPlayers()
return
} }
} }
@@ -93,235 +119,82 @@ class VideoPlaybackService : MediaSessionService() {
return binder return binder
} }
override fun onUpdateNotification(session: MediaSession, startInForegroundRequired: Boolean) {
val notification = buildNotification(session)
val notificationId = session.player.hashCode()
val notificationManager: NotificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
// Always cancel the placeholder notification once we have a real player notification
if (!placeholderCanceled) {
notificationManager.cancel(PLACEHOLDER_NOTIFICATION_ID)
placeholderCanceled = true
}
if (startInForegroundRequired) {
startForeground(notificationId, notification)
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationManager.createNotificationChannel(
NotificationChannel(
NOTIFICATION_CHANEL_ID,
NOTIFICATION_CHANEL_ID,
NotificationManager.IMPORTANCE_LOW
)
)
}
if (session.player.currentMediaItem == null) {
notificationManager.cancel(notificationId)
return
}
notificationManager.notify(notificationId, notification)
}
}
override fun onTaskRemoved(rootIntent: Intent?) { override fun onTaskRemoved(rootIntent: Intent?) {
stopForegroundSafely()
cleanup() cleanup()
stopSelf() stopSelf()
} }
override fun onDestroy() { override fun onDestroy() {
stopForegroundSafely()
cleanup() cleanup()
val notificationManager: NotificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationManager.deleteNotificationChannel(NOTIFICATION_CHANEL_ID)
}
super.onDestroy() super.onDestroy()
} }
private fun buildNotification(session: MediaSession): Notification { private fun stopForegroundSafely() {
val returnToPlayer = Intent(this, sourceActivity ?: this.javaClass).apply { try {
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP stopForeground(STOP_FOREGROUND_REMOVE)
} catch (_: Exception) {
Log.e(TAG, "Failed to stop foreground service!")
} }
/*
* On Android 13+ controls are automatically handled via media session
* On Android 12 and bellow we need to add controls manually
*/
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
NotificationCompat.Builder(this, NOTIFICATION_CHANEL_ID)
.setSmallIcon(androidx.media3.session.R.drawable.media3_icon_circular_play)
.setStyle(MediaStyleNotificationHelper.MediaStyle(session))
.setContentIntent(PendingIntent.getActivity(this, 0, returnToPlayer, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
.build()
} else {
val playerId = session.player.hashCode()
// Action for COMMAND.SEEK_BACKWARD
val seekBackwardIntent = Intent(this, VideoPlaybackService::class.java).apply {
putExtra("PLAYER_ID", playerId)
putExtra("ACTION", COMMAND.SEEK_BACKWARD.stringValue)
}
val seekBackwardPendingIntent = PendingIntent.getService(
this,
playerId * 10,
seekBackwardIntent,
PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
// ACTION FOR COMMAND.TOGGLE_PLAY
val togglePlayIntent = Intent(this, VideoPlaybackService::class.java).apply {
putExtra("PLAYER_ID", playerId)
putExtra("ACTION", COMMAND.TOGGLE_PLAY.stringValue)
}
val togglePlayPendingIntent = PendingIntent.getService(
this,
playerId * 10 + 1,
togglePlayIntent,
PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
// ACTION FOR COMMAND.SEEK_FORWARD
val seekForwardIntent = Intent(this, VideoPlaybackService::class.java).apply {
putExtra("PLAYER_ID", playerId)
putExtra("ACTION", COMMAND.SEEK_FORWARD.stringValue)
}
val seekForwardPendingIntent = PendingIntent.getService(
this,
playerId * 10 + 2,
seekForwardIntent,
PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
NotificationCompat.Builder(this, NOTIFICATION_CHANEL_ID)
// Show controls on lock screen even when user hides sensitive content.
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setSmallIcon(androidx.media3.session.R.drawable.media3_icon_circular_play)
// Add media control buttons that invoke intents in your media service
.addAction(androidx.media3.session.R.drawable.media3_icon_rewind, "Seek Backward", seekBackwardPendingIntent) // #0
.addAction(
if (session.player.isPlaying) {
androidx.media3.session.R.drawable.media3_icon_pause
} else {
androidx.media3.session.R.drawable.media3_icon_play
},
"Toggle Play",
togglePlayPendingIntent
) // #1
.addAction(androidx.media3.session.R.drawable.media3_icon_fast_forward, "Seek Forward", seekForwardPendingIntent) // #2
// Apply the media style template
.setStyle(MediaStyleNotificationHelper.MediaStyle(session).setShowActionsInCompactView(0, 1, 2))
.setContentTitle(session.player.mediaMetadata.title)
.setContentText(session.player.mediaMetadata.description)
.setContentIntent(PendingIntent.getActivity(this, 0, returnToPlayer, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE))
.setLargeIcon(session.player.mediaMetadata.artworkUri?.let { session.bitmapLoader.loadBitmap(it).get() })
.setOngoing(true)
.build()
}
}
private fun hidePlayerNotification(player: ExoPlayer) {
val notificationManager: NotificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
notificationManager.cancel(player.hashCode())
}
private fun hideAllNotifications() {
val notificationManager: NotificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
notificationManager.cancelAll()
} }
private fun cleanup() { private fun cleanup() {
hideAllNotifications() stopForegroundSafely()
stopSelf()
mediaSessionsList.forEach { (_, session) -> mediaSessionsList.forEach { (_, session) ->
session.release() session.release()
} }
mediaSessionsList.clear() mediaSessionsList.clear()
placeholderCanceled = false
} }
private fun createPlaceholderNotification(): Notification { // Stop the service if there are no active media sessions (no players need it)
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager fun stopIfNoPlayers() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (mediaSessionsList.isEmpty()) {
notificationManager.createNotificationChannel( // Remove placeholder notification and stop the service when no active players exist
NotificationChannel( try {
NOTIFICATION_CHANEL_ID, if (isForeground) {
NOTIFICATION_CHANEL_ID, stopForegroundSafely()
NotificationManager.IMPORTANCE_LOW isForeground = false
) }
) } catch (_: Exception) {
} Log.e(TAG, "Failed to stop foreground service!")
return NotificationCompat.Builder(this, NOTIFICATION_CHANEL_ID)
.setSmallIcon(androidx.media3.session.R.drawable.media3_icon_circular_play)
.setContentTitle("Media playback")
.setContentText("Preparing playback")
.build()
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !placeholderCanceled) {
startForeground(PLACEHOLDER_NOTIFICATION_ID, createPlaceholderNotification())
}
intent?.let {
val playerId = it.getIntExtra("PLAYER_ID", -1)
val actionCommand = it.getStringExtra("ACTION")
if (playerId < 0) {
Log.w(TAG, "Received Command without playerId")
return super.onStartCommand(intent, flags, startId)
} }
cleanup()
if (actionCommand == null) {
Log.w(TAG, "Received Command without action command")
return super.onStartCommand(intent, flags, startId)
}
val session = mediaSessionsList.values.find { s -> s.player.hashCode() == playerId } ?: return super.onStartCommand(intent, flags, startId)
handleCommand(commandFromString(actionCommand), session)
} }
return super.onStartCommand(intent, flags, startId)
} }
companion object { companion object {
private const val SEEK_INTERVAL_MS = 10000L const val TAG = "VideoPlaybackService"
private const val TAG = "VideoPlaybackService"
private const val PLACEHOLDER_NOTIFICATION_ID = 9999
const val NOTIFICATION_CHANEL_ID = "RNVIDEO_SESSION_NOTIFICATION"
const val VIDEO_PLAYBACK_SERVICE_INTERFACE = SERVICE_INTERFACE const val VIDEO_PLAYBACK_SERVICE_INTERFACE = SERVICE_INTERFACE
private const val PLACEHOLDER_NOTIFICATION_ID = 1729
private const val NOTIFICATION_CHANNEL_ID = "twg_video_playback"
}
enum class COMMAND(val stringValue: String) { private fun createPlaceholderNotification(): Notification {
NONE("NONE"), val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
SEEK_FORWARD("COMMAND_SEEK_FORWARD"), if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
SEEK_BACKWARD("COMMAND_SEEK_BACKWARD"), try {
TOGGLE_PLAY("COMMAND_TOGGLE_PLAY"), val channel = NotificationChannel(
PLAY("COMMAND_PLAY"), NOTIFICATION_CHANNEL_ID,
PAUSE("COMMAND_PAUSE") "Media playback",
} NotificationManager.IMPORTANCE_LOW
)
fun commandFromString(value: String): COMMAND = channel.setShowBadge(false)
when (value) { nm.createNotificationChannel(channel)
COMMAND.SEEK_FORWARD.stringValue -> COMMAND.SEEK_FORWARD } catch (_: Exception) {
COMMAND.SEEK_BACKWARD.stringValue -> COMMAND.SEEK_BACKWARD Log.e(TAG, "Failed to create notification channel!")
COMMAND.TOGGLE_PLAY.stringValue -> COMMAND.TOGGLE_PLAY
COMMAND.PLAY.stringValue -> COMMAND.PLAY
COMMAND.PAUSE.stringValue -> COMMAND.PAUSE
else -> COMMAND.NONE
}
fun handleCommand(command: COMMAND, session: MediaSession) {
// TODO: get somehow ControlsConfig here - for now hardcoded 10000ms
when (command) {
COMMAND.SEEK_BACKWARD -> session.player.seekTo(session.player.contentPosition - SEEK_INTERVAL_MS)
COMMAND.SEEK_FORWARD -> session.player.seekTo(session.player.contentPosition + SEEK_INTERVAL_MS)
COMMAND.TOGGLE_PLAY -> handleCommand(if (session.player.isPlaying) COMMAND.PAUSE else COMMAND.PLAY, session)
COMMAND.PLAY -> session.player.play()
COMMAND.PAUSE -> session.player.pause()
else -> Log.w(TAG, "Received COMMAND.NONE - was there an error?")
} }
} }
val appName = try { applicationInfo.loadLabel(packageManager).toString() } catch (_: Exception) { "Media Playback" }
return NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(android.R.drawable.ic_media_play)
.setContentTitle(appName)
.setContentText("")
.setOngoing(true)
.setCategory(Notification.CATEGORY_SERVICE)
.build()
} }
} }

View File

@@ -25,7 +25,10 @@ class VideoPlaybackServiceConnection (private val player: WeakReference<HybridVi
} }
serviceBinder = binder as? VideoPlaybackServiceBinder serviceBinder = binder as? VideoPlaybackServiceBinder
serviceBinder?.service?.registerPlayer(player, activity.javaClass) // Only register when the player actually needs background service/notification
if (player.playInBackground || player.showNotificationControls) {
serviceBinder?.service?.registerPlayer(player, activity.javaClass)
}
} catch (err: Exception) { } catch (err: Exception) {
Log.e("VideoPlaybackServiceConnection", "Could not bind to playback service", err) Log.e("VideoPlaybackServiceConnection", "Could not bind to playback service", err)
} }

View File

@@ -102,6 +102,23 @@ class HybridVideoPlayer() : HybridVideoPlayerSpec() {
field = value field = value
} }
override var showNotificationControls: Boolean = false
set(value) {
val wasRunning = (field || playInBackground)
val shouldRun = (value || playInBackground)
if (shouldRun && !wasRunning) {
VideoPlaybackService.startService(context, videoPlaybackServiceConnection)
}
if (!shouldRun && wasRunning) {
VideoPlaybackService.stopService(this, videoPlaybackServiceConnection)
}
field = value
// Inform service to refresh notification/session layout
try { videoPlaybackServiceConnection.serviceBinder?.service?.updatePlayerPreferences(this) } catch (_: Exception) {}
}
// Player Properties // Player Properties
override var currentTime: Double by mainThreadProperty( override var currentTime: Double by mainThreadProperty(
get = { player.currentPosition.toDouble() / 1000.0 }, get = { player.currentPosition.toDouble() / 1000.0 },
@@ -172,16 +189,18 @@ class HybridVideoPlayer() : HybridVideoPlayerSpec() {
override var playInBackground: Boolean = false override var playInBackground: Boolean = false
set(value) { set(value) {
// playback in background was disabled and is now enabled val shouldRun = (value || showNotificationControls)
if (value == true && field == false) { val wasRunning = (field || showNotificationControls)
if (shouldRun && !wasRunning) {
VideoPlaybackService.startService(context, videoPlaybackServiceConnection) VideoPlaybackService.startService(context, videoPlaybackServiceConnection)
field = true
} }
// playback in background was enabled and is now disabled if (!shouldRun && wasRunning) {
else if (field == true) {
VideoPlaybackService.stopService(this, videoPlaybackServiceConnection) VideoPlaybackService.stopService(this, videoPlaybackServiceConnection)
field = false
} }
field = value
// Update preferences to refresh notifications/registration
try { videoPlaybackServiceConnection.serviceBinder?.service?.updatePlayerPreferences(this) } catch (_: Exception) {}
} }
override var playWhenInactive: Boolean = false override var playWhenInactive: Boolean = false
@@ -323,7 +342,7 @@ class HybridVideoPlayer() : HybridVideoPlayerSpec() {
} }
private fun release() { private fun release() {
if (playInBackground) { if (playInBackground || showNotificationControls) {
VideoPlaybackService.stopService(this, videoPlaybackServiceConnection) VideoPlaybackService.stopService(this, videoPlaybackServiceConnection)
} }

View File

@@ -5,7 +5,16 @@ import com.facebook.proguard.annotations.DoNotStrip
@DoNotStrip @DoNotStrip
class HybridVideoPlayerSourceFactory: HybridVideoPlayerSourceFactorySpec() { class HybridVideoPlayerSourceFactory: HybridVideoPlayerSourceFactorySpec() {
override fun fromUri(uri: String): HybridVideoPlayerSourceSpec { override fun fromUri(uri: String): HybridVideoPlayerSourceSpec {
val config = NativeVideoConfig(uri, null, null, null, null, true) val config = NativeVideoConfig(
uri = uri,
externalSubtitles = null,
drm = null,
headers = null,
bufferConfig = null,
metadata = null,
initializeOnCreation = true
)
return HybridVideoPlayerSource(config) return HybridVideoPlayerSource(config)
} }

View File

@@ -78,6 +78,12 @@ class HybridVideoViewViewManager(nitroId: Int): HybridVideoViewViewManagerSpec()
videoView.get()?.keepScreenAwake = value videoView.get()?.keepScreenAwake = value
} }
override var surfaceType: SurfaceType
get() = videoView.get()?.surfaceType ?: SurfaceType.SURFACE
set(value) {
videoView.get()?.surfaceType = value
}
// View callbacks // View callbacks
override var onPictureInPictureChange: ((Boolean) -> Unit)? = null override var onPictureInPictureChange: ((Boolean) -> Unit)? = null
set(value) { set(value) {

View File

@@ -8,6 +8,7 @@ import android.os.Build
import android.util.AttributeSet import android.util.AttributeSet
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.util.Log import android.util.Log
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
@@ -22,6 +23,7 @@ import com.facebook.react.bridge.ReactApplicationContext
import com.margelo.nitro.NitroModules import com.margelo.nitro.NitroModules
import com.margelo.nitro.video.HybridVideoPlayer import com.margelo.nitro.video.HybridVideoPlayer
import com.margelo.nitro.video.ResizeMode import com.margelo.nitro.video.ResizeMode
import com.margelo.nitro.video.SurfaceType
import com.margelo.nitro.video.VideoViewEvents import com.margelo.nitro.video.VideoViewEvents
import com.twg.video.core.LibraryError import com.twg.video.core.LibraryError
import com.twg.video.core.VideoManager import com.twg.video.core.VideoManager
@@ -36,6 +38,8 @@ import com.twg.video.core.extensions.toAspectRatioFrameLayout
import com.twg.video.core.utils.PictureInPictureUtils import com.twg.video.core.utils.PictureInPictureUtils
import com.twg.video.core.utils.PictureInPictureUtils.createDisabledPictureInPictureParams import com.twg.video.core.utils.PictureInPictureUtils.createDisabledPictureInPictureParams
import com.twg.video.core.utils.SmallVideoPlayerOptimizer import com.twg.video.core.utils.SmallVideoPlayerOptimizer
import com.twg.video.R.layout.player_view_surface
import com.twg.video.R.layout.player_view_texture
@UnstableApi @UnstableApi
class VideoView @JvmOverloads constructor( class VideoView @JvmOverloads constructor(
@@ -90,6 +94,20 @@ class VideoView @JvmOverloads constructor(
var pictureInPictureEnabled: Boolean = false var pictureInPictureEnabled: Boolean = false
var surfaceType: SurfaceType = SurfaceType.SURFACE
set(value) {
if (field == value) return
field = value
runOnMainThread {
removeView(playerView)
playerView.player = null
playerView = createPlayerView()
playerView.player = hybridPlayer?.player
addView(playerView)
}
}
var resizeMode: ResizeMode = ResizeMode.NONE var resizeMode: ResizeMode = ResizeMode.NONE
set(value) { set(value) {
field = value field = value
@@ -101,7 +119,9 @@ class VideoView @JvmOverloads constructor(
var keepScreenAwake: Boolean var keepScreenAwake: Boolean
get() = playerView.keepScreenOn get() = playerView.keepScreenOn
set(value) { set(value) {
playerView.keepScreenOn = value runOnMainThread {
playerView.keepScreenOn = value
}
} }
var events = object : VideoViewEvents { var events = object : VideoViewEvents {
@@ -114,15 +134,7 @@ class VideoView @JvmOverloads constructor(
} }
var onNitroIdChange: ((Int?) -> Unit)? = null var onNitroIdChange: ((Int?) -> Unit)? = null
var playerView = PlayerView(context).apply { var playerView = createPlayerView()
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
setShutterBackgroundColor(Color.TRANSPARENT)
setShowSubtitleButton(true)
useController = false
// Apply optimizations based on video player size if needed
configureForSmallPlayer()
}
var isInFullscreen: Boolean = false var isInFullscreen: Boolean = false
set(value) { set(value) {
field = value field = value
@@ -153,6 +165,22 @@ class VideoView @JvmOverloads constructor(
playerView.resizeMode = resizeMode.toAspectRatioFrameLayout() playerView.resizeMode = resizeMode.toAspectRatioFrameLayout()
} }
@SuppressLint("InflateParams")
private fun createPlayerView(): PlayerView {
return when (surfaceType) {
SurfaceType.SURFACE -> LayoutInflater.from(context).inflate(player_view_surface, null) as PlayerView
SurfaceType.TEXTURE -> LayoutInflater.from(context).inflate(player_view_texture, null) as PlayerView
}.apply {
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
setShutterBackgroundColor(Color.TRANSPARENT)
setShowSubtitleButton(true)
useController = false
// Apply optimizations based on video player size if needed
configureForSmallPlayer()
}
}
private val layoutRunnable = Runnable { private val layoutRunnable = Runnable {
measure( measure(
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),

View File

@@ -0,0 +1,14 @@
<androidx.media3.ui.PlayerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/player_view_surface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
app:surface_type="surface_view"
app:scrubber_enabled_size="0dp"
app:scrubber_disabled_size="0dp"
app:scrubber_dragged_size="0dp"
app:touch_target_height="12dp"
app:bar_height="5dp" />

View File

@@ -0,0 +1,15 @@
<androidx.media3.ui.PlayerView
android:id="@+id/player_view_texture"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:surface_type="texture_view"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clipChildren="false"
android:clipToPadding="false"
app:scrubber_enabled_size="0dp"
app:scrubber_disabled_size="0dp"
app:scrubber_dragged_size="0dp"
app:touch_target_height="12dp"
app:bar_height="5dp"
/>

View File

@@ -0,0 +1,323 @@
import Foundation
import MediaPlayer
class NowPlayingInfoCenterManager {
static let shared = NowPlayingInfoCenterManager()
private let SEEK_INTERVAL_SECONDS: Double = 10
private weak var currentPlayer: AVPlayer?
private var players = NSHashTable<AVPlayer>.weakObjects()
private var observers: [Int: NSKeyValueObservation] = [:]
private var playbackObserver: Any?
private var playTarget: Any?
private var pauseTarget: Any?
private var skipForwardTarget: Any?
private var skipBackwardTarget: Any?
private var playbackPositionTarget: Any?
private var seekTarget: Any?
private var togglePlayPauseTarget: Any?
private let remoteCommandCenter = MPRemoteCommandCenter.shared()
var receivingRemoteControlEvents = false {
didSet {
if receivingRemoteControlEvents {
DispatchQueue.main.async {
VideoManager.shared.setRemoteControlEventsActive(true)
UIApplication.shared.beginReceivingRemoteControlEvents()
}
} else {
DispatchQueue.main.async {
UIApplication.shared.endReceivingRemoteControlEvents()
VideoManager.shared.setRemoteControlEventsActive(false)
}
}
}
}
deinit {
cleanup()
}
func registerPlayer(player: AVPlayer) {
if players.contains(player) {
return
}
if receivingRemoteControlEvents == false {
receivingRemoteControlEvents = true
}
if let oldObserver = observers[player.hashValue] {
oldObserver.invalidate()
}
observers[player.hashValue] = observePlayers(player: player)
players.add(player)
if currentPlayer == nil {
setCurrentPlayer(player: player)
}
}
func removePlayer(player: AVPlayer) {
if !players.contains(player) {
return
}
if let observer = observers[player.hashValue] {
observer.invalidate()
}
observers.removeValue(forKey: player.hashValue)
players.remove(player)
if currentPlayer == player {
currentPlayer = nil
updateNowPlayingInfo()
}
if players.allObjects.isEmpty {
cleanup()
}
}
public func cleanup() {
observers.removeAll()
players.removeAllObjects()
if let playbackObserver {
currentPlayer?.removeTimeObserver(playbackObserver)
}
invalidateCommandTargets()
MPNowPlayingInfoCenter.default().nowPlayingInfo = [:]
receivingRemoteControlEvents = false
}
private func setCurrentPlayer(player: AVPlayer) {
if player == currentPlayer {
return
}
if let playbackObserver {
currentPlayer?.removeTimeObserver(playbackObserver)
}
currentPlayer = player
registerCommandTargets()
updateNowPlayingInfo()
playbackObserver = player.addPeriodicTimeObserver(
forInterval: CMTime(value: 1, timescale: 4),
queue: .global(),
using: { [weak self] _ in
self?.updateNowPlayingInfo()
}
)
}
private func registerCommandTargets() {
invalidateCommandTargets()
playTarget = remoteCommandCenter.playCommand.addTarget { [weak self] _ in
guard let self, let player = self.currentPlayer else {
return .commandFailed
}
if player.rate == 0 {
player.play()
}
return .success
}
pauseTarget = remoteCommandCenter.pauseCommand.addTarget { [weak self] _ in
guard let self, let player = self.currentPlayer else {
return .commandFailed
}
if player.rate != 0 {
player.pause()
}
return .success
}
skipBackwardTarget = remoteCommandCenter.skipBackwardCommand.addTarget {
[weak self] _ in
guard let self, let player = self.currentPlayer else {
return .commandFailed
}
let newTime =
player.currentTime()
- CMTime(seconds: self.SEEK_INTERVAL_SECONDS, preferredTimescale: .max)
player.seek(to: newTime)
return .success
}
skipForwardTarget = remoteCommandCenter.skipForwardCommand.addTarget {
[weak self] _ in
guard let self, let player = self.currentPlayer else {
return .commandFailed
}
let newTime =
player.currentTime()
+ CMTime(seconds: self.SEEK_INTERVAL_SECONDS, preferredTimescale: .max)
player.seek(to: newTime)
return .success
}
playbackPositionTarget = remoteCommandCenter.changePlaybackPositionCommand
.addTarget { [weak self] event in
guard let self, let player = self.currentPlayer else {
return .commandFailed
}
if let event = event as? MPChangePlaybackPositionCommandEvent {
player.seek(
to: CMTime(seconds: event.positionTime, preferredTimescale: .max)
)
return .success
}
return .commandFailed
}
// Handler for togglePlayPauseCommand, sent by Apple's Earpods wired headphones
togglePlayPauseTarget = remoteCommandCenter.togglePlayPauseCommand.addTarget
{ [weak self] _ in
guard let self, let player = self.currentPlayer else {
return .commandFailed
}
if player.rate == 0 {
player.play()
} else {
player.pause()
}
return .success
}
}
private func invalidateCommandTargets() {
remoteCommandCenter.playCommand.removeTarget(playTarget)
remoteCommandCenter.pauseCommand.removeTarget(pauseTarget)
remoteCommandCenter.skipForwardCommand.removeTarget(skipForwardTarget)
remoteCommandCenter.skipBackwardCommand.removeTarget(skipBackwardTarget)
remoteCommandCenter.changePlaybackPositionCommand.removeTarget(
playbackPositionTarget
)
remoteCommandCenter.togglePlayPauseCommand.removeTarget(
togglePlayPauseTarget
)
}
public func updateNowPlayingInfo() {
guard let player = currentPlayer, let currentItem = player.currentItem
else {
invalidateCommandTargets()
MPNowPlayingInfoCenter.default().nowPlayingInfo = [:]
return
}
// commonMetadata is metadata from asset, externalMetadata is custom metadata set by user
// externalMetadata should override commonMetadata to allow override metadata from source
// When the metadata has the tag "iTunSMPB" or "iTunNORM" then the metadata is not converted correctly and comes [nil, nil, ...]
// This leads to a crash of the app
let metadata: [AVMetadataItem] = {
let common = processMetadataItems(currentItem.asset.commonMetadata)
let external = processMetadataItems(currentItem.externalMetadata)
return Array(common.merging(external) { _, new in new }.values)
}()
let titleItem =
AVMetadataItem.metadataItems(
from: metadata,
filteredByIdentifier: .commonIdentifierTitle
).first?.stringValue ?? ""
let artistItem =
AVMetadataItem.metadataItems(
from: metadata,
filteredByIdentifier: .commonIdentifierArtist
).first?.stringValue ?? ""
// I have some issue with this - setting artworkItem when it not set dont return nil but also is crashing application
// this is very hacky workaround for it
let imgData = AVMetadataItem.metadataItems(
from: metadata,
filteredByIdentifier: .commonIdentifierArtwork
).first?.dataValue
let image = imgData.flatMap { UIImage(data: $0) } ?? UIImage()
let artworkItem = MPMediaItemArtwork(boundsSize: image.size) { _ in image }
let newNowPlayingInfo: [String: Any] = [
MPMediaItemPropertyTitle: titleItem,
MPMediaItemPropertyArtist: artistItem,
MPMediaItemPropertyArtwork: artworkItem,
MPMediaItemPropertyPlaybackDuration: currentItem.duration.seconds,
MPNowPlayingInfoPropertyElapsedPlaybackTime: currentItem.currentTime()
.seconds.rounded(),
MPNowPlayingInfoPropertyPlaybackRate: player.rate,
MPNowPlayingInfoPropertyIsLiveStream: CMTIME_IS_INDEFINITE(
currentItem.asset.duration
),
]
let currentNowPlayingInfo =
MPNowPlayingInfoCenter.default().nowPlayingInfo ?? [:]
MPNowPlayingInfoCenter.default().nowPlayingInfo =
currentNowPlayingInfo.merging(newNowPlayingInfo) { _, new in new }
}
private func findNewCurrentPlayer() {
if let newPlayer = players.allObjects.first(where: {
$0.rate != 0
}) {
setCurrentPlayer(player: newPlayer)
}
}
// We will observe players rate to find last active player that info will be displayed
private func observePlayers(player: AVPlayer) -> NSKeyValueObservation {
return player.observe(\.rate) { [weak self] player, change in
guard let self else { return }
let rate = change.newValue
// case where there is new player that is not paused
// In this case event is triggered by non currentPlayer
if rate != 0 && self.currentPlayer != player {
self.setCurrentPlayer(player: player)
return
}
// case where currentPlayer was paused
// In this case event is triggered by currentPlayer
if rate == 0 && self.currentPlayer == player {
self.findNewCurrentPlayer()
}
}
}
private func processMetadataItems(_ items: [AVMetadataItem]) -> [String:
AVMetadataItem]
{
var result = [String: AVMetadataItem]()
for item in items {
if let id = item.identifier?.rawValue, !id.isEmpty, result[id] == nil {
result[id] = item
}
}
return result
}
}

View File

@@ -95,6 +95,16 @@ class VideoManager {
updateAudioSessionConfiguration() updateAudioSessionConfiguration()
} }
// MARK: - Remote Control Events
func setRemoteControlEventsActive(_ active: Bool) {
if isAudioSessionManagementDisabled || remoteControlEventsActive == active {
return
}
remoteControlEventsActive = active
requestAudioSessionUpdate()
}
// MARK: - Audio Session Management // MARK: - Audio Session Management
private func activateAudioSession() { private func activateAudioSession() {
if isAudioSessionActive { if isAudioSessionActive {
@@ -133,7 +143,11 @@ class VideoManager {
player.mixAudioMode == .donotmix player.mixAudioMode == .donotmix
} }
if isAnyPlayerPlaying || anyPlayerNeedsNotMixWithOthers { let anyPlayerNeedsNotificationControls = players.allObjects.contains { player in
player.showNotificationControls
}
if isAnyPlayerPlaying || anyPlayerNeedsNotMixWithOthers || anyPlayerNeedsNotificationControls || remoteControlEventsActive {
activateAudioSession() activateAudioSession()
} else { } else {
deactivateAudioSession() deactivateAudioSession()
@@ -162,6 +176,10 @@ class VideoManager {
player.playInBackground player.playInBackground
} }
let anyPlayerNeedsNotificationControls = players.allObjects.contains { player in
player.showNotificationControls
}
if isAudioSessionManagementDisabled { if isAudioSessionManagementDisabled {
return return
} }
@@ -172,7 +190,7 @@ class VideoManager {
earpiece: false, // TODO: Pass actual value after we add prop earpiece: false, // TODO: Pass actual value after we add prop
pip: anyViewNeedsPictureInPicture, pip: anyViewNeedsPictureInPicture,
backgroundPlayback: anyPlayerNeedsBackgroundPlayback, backgroundPlayback: anyPlayerNeedsBackgroundPlayback,
notificationControls: false // TODO: Pass actual value after we add prop notificationControls: anyPlayerNeedsNotificationControls
) )
let audioMixingMode = determineAudioMixingMode() let audioMixingMode = determineAudioMixingMode()

View File

@@ -22,6 +22,7 @@ extension HybridVideoPlayer: VideoPlayerObserverDelegate {
func onRateChanged(rate: Float) { func onRateChanged(rate: Float) {
eventEmitter.onPlaybackRateChange(Double(rate)) eventEmitter.onPlaybackRateChange(Double(rate))
NowPlayingInfoCenterManager.shared.updateNowPlayingInfo()
updateAndEmitPlaybackState() updateAndEmitPlaybackState()
} }

View File

@@ -158,6 +158,16 @@ class HybridVideoPlayer: HybridVideoPlayerSpec, NativeVideoPlayerSpec {
return player.rate != 0 return player.rate != 0
} }
var showNotificationControls: Bool = false {
didSet {
if showNotificationControls {
NowPlayingInfoCenterManager.shared.registerPlayer(player: player)
} else {
NowPlayingInfoCenterManager.shared.removePlayer(player: player)
}
}
}
func initialize() throws -> Promise<Void> { func initialize() throws -> Promise<Void> {
return Promise.async { [weak self] in return Promise.async { [weak self] in
guard let self else { guard let self else {
@@ -174,6 +184,7 @@ class HybridVideoPlayer: HybridVideoPlayerSpec, NativeVideoPlayerSpec {
} }
func release() { func release() {
NowPlayingInfoCenterManager.shared.removePlayer(player: player)
self.player.replaceCurrentItem(with: nil) self.player.replaceCurrentItem(with: nil)
self.playerItem = nil self.playerItem = nil
@@ -270,6 +281,7 @@ class HybridVideoPlayer: HybridVideoPlayerSpec, NativeVideoPlayerSpec {
self.source = source self.source = source
self.playerItem = try await self.initializePlayerItem() self.playerItem = try await self.initializePlayerItem()
self.player.replaceCurrentItem(with: self.playerItem) self.player.replaceCurrentItem(with: self.playerItem)
NowPlayingInfoCenterManager.shared.updateNowPlayingInfo()
promise.resolve(withResult: ()) promise.resolve(withResult: ())
} }

View File

@@ -8,12 +8,22 @@
import Foundation import Foundation
class HybridVideoPlayerSourceFactory: HybridVideoPlayerSourceFactorySpec { class HybridVideoPlayerSourceFactory: HybridVideoPlayerSourceFactorySpec {
func fromVideoConfig(config: NativeVideoConfig) throws -> any HybridVideoPlayerSourceSpec { func fromVideoConfig(config: NativeVideoConfig) throws
-> any HybridVideoPlayerSourceSpec
{
return try HybridVideoPlayerSource(config: config) return try HybridVideoPlayerSource(config: config)
} }
func fromUri(uri: String) throws -> HybridVideoPlayerSourceSpec { func fromUri(uri: String) throws -> HybridVideoPlayerSourceSpec {
let config = NativeVideoConfig(uri: uri, externalSubtitles: nil, drm: nil, headers: nil, bufferConfig: nil, initializeOnCreation: true) let config = NativeVideoConfig(
uri: uri,
externalSubtitles: nil,
drm: nil,
headers: nil,
bufferConfig: nil,
metadata: nil,
initializeOnCreation: true
)
return try HybridVideoPlayerSource(config: config) return try HybridVideoPlayerSource(config: config)
} }
} }

View File

@@ -138,6 +138,9 @@ class HybridVideoViewViewManager: HybridVideoViewViewManagerSpec {
} }
} }
// Android only - no-op on iOS
var surfaceType: SurfaceType = .surface
func enterFullscreen() throws { func enterFullscreen() throws {
guard let view else { guard let view else {
throw VideoViewError.viewIsDeallocated.error() throw VideoViewError.viewIsDeallocated.error()

View File

@@ -148,6 +148,9 @@ import AVKit
controller.view.autoresizingMask = [.flexibleWidth, .flexibleHeight] controller.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
controller.view.backgroundColor = .clear controller.view.backgroundColor = .clear
// We manage this manually in NowPlayingInfoCenterManager
controller.updatesNowPlayingInfoCenter = false
if #available(iOS 16.0, *) { if #available(iOS 16.0, *) {
if let initialSpeed = controller.speeds.first(where: { $0.rate == player.rate }) { if let initialSpeed = controller.speeds.first(where: { $0.rate == player.rate }) {
controller.selectSpeed(initialSpeed) controller.selectSpeed(initialSpeed)

View File

@@ -13,6 +13,12 @@
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/ReactNativeVideo+autolinking.cmake) # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/ReactNativeVideo+autolinking.cmake)
# ``` # ```
# Define a flag to check if we are building properly
add_definitions(-DBUILDING_REACTNATIVEVIDEO_WITH_GENERATED_CMAKE_PROJECT)
# Enable Raw Props parsing in react-native (for Nitro Views)
add_definitions(-DRN_SERIALIZABLE_STATE)
# Add all headers that were generated by Nitrogen # Add all headers that were generated by Nitrogen
include_directories( include_directories(
"../nitrogen/generated/shared/c++" "../nitrogen/generated/shared/c++"
@@ -44,12 +50,9 @@ target_sources(
../nitrogen/generated/android/c++/JHybridVideoViewViewManagerFactorySpec.cpp ../nitrogen/generated/android/c++/JHybridVideoViewViewManagerFactorySpec.cpp
) )
# Define a flag to check if we are building properly
add_definitions(-DBUILDING_REACTNATIVEVIDEO_WITH_GENERATED_CMAKE_PROJECT)
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
target_compile_definitions( target_compile_definitions(
ReactNativeVideo PRIVATE ReactNativeVideo PRIVATE
-DFOLLY_NO_CONFIG=1 -DFOLLY_NO_CONFIG=1
-DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_CLOCK_GETTIME=1

View File

@@ -75,8 +75,7 @@ int initialize(JavaVM* vm) {
[]() -> std::shared_ptr<HybridObject> { []() -> std::shared_ptr<HybridObject> {
static DefaultConstructableObject<JHybridVideoPlayerFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoPlayerFactory"); static DefaultConstructableObject<JHybridVideoPlayerFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoPlayerFactory");
auto instance = object.create(); auto instance = object.create();
auto globalRef = jni::make_global(instance); return instance->cthis()->shared();
return globalRef->cthis()->shared();
} }
); );
HybridObjectRegistry::registerHybridObjectConstructor( HybridObjectRegistry::registerHybridObjectConstructor(
@@ -84,8 +83,7 @@ int initialize(JavaVM* vm) {
[]() -> std::shared_ptr<HybridObject> { []() -> std::shared_ptr<HybridObject> {
static DefaultConstructableObject<JHybridVideoPlayerSourceFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoPlayerSourceFactory"); static DefaultConstructableObject<JHybridVideoPlayerSourceFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoPlayerSourceFactory");
auto instance = object.create(); auto instance = object.create();
auto globalRef = jni::make_global(instance); return instance->cthis()->shared();
return globalRef->cthis()->shared();
} }
); );
HybridObjectRegistry::registerHybridObjectConstructor( HybridObjectRegistry::registerHybridObjectConstructor(
@@ -93,8 +91,7 @@ int initialize(JavaVM* vm) {
[]() -> std::shared_ptr<HybridObject> { []() -> std::shared_ptr<HybridObject> {
static DefaultConstructableObject<JHybridVideoViewViewManagerFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoViewViewManagerFactory"); static DefaultConstructableObject<JHybridVideoViewViewManagerFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoViewViewManagerFactory");
auto instance = object.create(); auto instance = object.create();
auto globalRef = jni::make_global(instance); return instance->cthis()->shared();
return globalRef->cthis()->shared();
} }
); );
}); });

View File

@@ -50,7 +50,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JBandwidthData::javaobject> fromCpp(const BandwidthData& value) { static jni::local_ref<JBandwidthData::javaobject> fromCpp(const BandwidthData& value) {
return newInstance( using JSignature = JBandwidthData(double, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.bitrate, value.bitrate,
value.width.has_value() ? jni::JDouble::valueOf(value.width.value()) : nullptr, value.width.has_value() ? jni::JDouble::valueOf(value.width.value()) : nullptr,
value.height.has_value() ? jni::JDouble::valueOf(value.height.value()) : nullptr value.height.has_value() ? jni::JDouble::valueOf(value.height.value()) : nullptr

View File

@@ -78,7 +78,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JBufferConfig::javaobject> fromCpp(const BufferConfig& value) { static jni::local_ref<JBufferConfig::javaobject> fromCpp(const BufferConfig& value) {
return newInstance( using JSignature = JBufferConfig(jni::alias_ref<JLivePlaybackParams>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JResolution>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JResolution>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.livePlayback.has_value() ? JLivePlaybackParams::fromCpp(value.livePlayback.value()) : nullptr, value.livePlayback.has_value() ? JLivePlaybackParams::fromCpp(value.livePlayback.value()) : nullptr,
value.minBufferMs.has_value() ? jni::JDouble::valueOf(value.minBufferMs.value()) : nullptr, value.minBufferMs.has_value() ? jni::JDouble::valueOf(value.minBufferMs.value()) : nullptr,
value.maxBufferMs.has_value() ? jni::JDouble::valueOf(value.maxBufferMs.value()) : nullptr, value.maxBufferMs.has_value() ? jni::JDouble::valueOf(value.maxBufferMs.value()) : nullptr,

View File

@@ -0,0 +1,74 @@
///
/// JCustomVideoMetadata.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 Marc Rousavy @ Margelo
///
#pragma once
#include <fbjni/fbjni.h>
#include "CustomVideoMetadata.hpp"
#include <optional>
#include <string>
namespace margelo::nitro::video {
using namespace facebook;
/**
* The C++ JNI bridge between the C++ struct "CustomVideoMetadata" and the the Kotlin data class "CustomVideoMetadata".
*/
struct JCustomVideoMetadata final: public jni::JavaClass<JCustomVideoMetadata> {
public:
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/video/CustomVideoMetadata;";
public:
/**
* Convert this Java/Kotlin-based struct to the C++ struct CustomVideoMetadata by copying all values to C++.
*/
[[maybe_unused]]
[[nodiscard]]
CustomVideoMetadata toCpp() const {
static const auto clazz = javaClassStatic();
static const auto fieldTitle = clazz->getField<jni::JString>("title");
jni::local_ref<jni::JString> title = this->getFieldValue(fieldTitle);
static const auto fieldSubtitle = clazz->getField<jni::JString>("subtitle");
jni::local_ref<jni::JString> subtitle = this->getFieldValue(fieldSubtitle);
static const auto fieldDescription = clazz->getField<jni::JString>("description");
jni::local_ref<jni::JString> description = this->getFieldValue(fieldDescription);
static const auto fieldArtist = clazz->getField<jni::JString>("artist");
jni::local_ref<jni::JString> artist = this->getFieldValue(fieldArtist);
static const auto fieldImageUri = clazz->getField<jni::JString>("imageUri");
jni::local_ref<jni::JString> imageUri = this->getFieldValue(fieldImageUri);
return CustomVideoMetadata(
title != nullptr ? std::make_optional(title->toStdString()) : std::nullopt,
subtitle != nullptr ? std::make_optional(subtitle->toStdString()) : std::nullopt,
description != nullptr ? std::make_optional(description->toStdString()) : std::nullopt,
artist != nullptr ? std::make_optional(artist->toStdString()) : std::nullopt,
imageUri != nullptr ? std::make_optional(imageUri->toStdString()) : std::nullopt
);
}
public:
/**
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
*/
[[maybe_unused]]
static jni::local_ref<JCustomVideoMetadata::javaobject> fromCpp(const CustomVideoMetadata& value) {
using JSignature = JCustomVideoMetadata(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.title.has_value() ? jni::make_jstring(value.title.value()) : nullptr,
value.subtitle.has_value() ? jni::make_jstring(value.subtitle.value()) : nullptr,
value.description.has_value() ? jni::make_jstring(value.description.value()) : nullptr,
value.artist.has_value() ? jni::make_jstring(value.artist.value()) : nullptr,
value.imageUri.has_value() ? jni::make_jstring(value.imageUri.value()) : nullptr
);
}
};
} // namespace margelo::nitro::video

View File

@@ -25,6 +25,8 @@ namespace margelo::nitro::video { struct BufferConfig; }
namespace margelo::nitro::video { struct LivePlaybackParams; } namespace margelo::nitro::video { struct LivePlaybackParams; }
// Forward declaration of `Resolution` to properly resolve imports. // Forward declaration of `Resolution` to properly resolve imports.
namespace margelo::nitro::video { struct Resolution; } namespace margelo::nitro::video { struct Resolution; }
// Forward declaration of `CustomVideoMetadata` to properly resolve imports.
namespace margelo::nitro::video { struct CustomVideoMetadata; }
#include <memory> #include <memory>
#include "HybridVideoPlayerSourceSpec.hpp" #include "HybridVideoPlayerSourceSpec.hpp"
@@ -53,6 +55,8 @@ namespace margelo::nitro::video { struct Resolution; }
#include "JLivePlaybackParams.hpp" #include "JLivePlaybackParams.hpp"
#include "Resolution.hpp" #include "Resolution.hpp"
#include "JResolution.hpp" #include "JResolution.hpp"
#include "CustomVideoMetadata.hpp"
#include "JCustomVideoMetadata.hpp"
namespace margelo::nitro::video { namespace margelo::nitro::video {

View File

@@ -23,6 +23,8 @@ namespace margelo::nitro::video { struct BufferConfig; }
namespace margelo::nitro::video { struct LivePlaybackParams; } namespace margelo::nitro::video { struct LivePlaybackParams; }
// Forward declaration of `Resolution` to properly resolve imports. // Forward declaration of `Resolution` to properly resolve imports.
namespace margelo::nitro::video { struct Resolution; } namespace margelo::nitro::video { struct Resolution; }
// Forward declaration of `CustomVideoMetadata` to properly resolve imports.
namespace margelo::nitro::video { struct CustomVideoMetadata; }
// Forward declaration of `VideoInformation` to properly resolve imports. // Forward declaration of `VideoInformation` to properly resolve imports.
namespace margelo::nitro::video { struct VideoInformation; } namespace margelo::nitro::video { struct VideoInformation; }
// Forward declaration of `VideoOrientation` to properly resolve imports. // Forward declaration of `VideoOrientation` to properly resolve imports.
@@ -52,6 +54,8 @@ namespace margelo::nitro::video { enum class VideoOrientation; }
#include "JLivePlaybackParams.hpp" #include "JLivePlaybackParams.hpp"
#include "Resolution.hpp" #include "Resolution.hpp"
#include "JResolution.hpp" #include "JResolution.hpp"
#include "CustomVideoMetadata.hpp"
#include "JCustomVideoMetadata.hpp"
#include "VideoInformation.hpp" #include "VideoInformation.hpp"
#include "JVideoInformation.hpp" #include "JVideoInformation.hpp"
#include "VideoOrientation.hpp" #include "VideoOrientation.hpp"

View File

@@ -72,6 +72,15 @@ namespace margelo::nitro::video {
auto __result = method(_javaPart); auto __result = method(_javaPart);
return __result->cthis()->shared_cast<JHybridVideoPlayerEventEmitterSpec>(); return __result->cthis()->shared_cast<JHybridVideoPlayerEventEmitterSpec>();
} }
bool JHybridVideoPlayerSpec::getShowNotificationControls() {
static const auto method = javaClassStatic()->getMethod<jboolean()>("getShowNotificationControls");
auto __result = method(_javaPart);
return static_cast<bool>(__result);
}
void JHybridVideoPlayerSpec::setShowNotificationControls(bool showNotificationControls) {
static const auto method = javaClassStatic()->getMethod<void(jboolean /* showNotificationControls */)>("setShowNotificationControls");
method(_javaPart, showNotificationControls);
}
VideoPlayerStatus JHybridVideoPlayerSpec::getStatus() { VideoPlayerStatus JHybridVideoPlayerSpec::getStatus() {
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JVideoPlayerStatus>()>("getStatus"); static const auto method = javaClassStatic()->getMethod<jni::local_ref<JVideoPlayerStatus>()>("getStatus");
auto __result = method(_javaPart); auto __result = method(_javaPart);

View File

@@ -51,6 +51,8 @@ namespace margelo::nitro::video {
// Properties // Properties
std::shared_ptr<HybridVideoPlayerSourceSpec> getSource() override; std::shared_ptr<HybridVideoPlayerSourceSpec> getSource() override;
std::shared_ptr<HybridVideoPlayerEventEmitterSpec> getEventEmitter() override; std::shared_ptr<HybridVideoPlayerEventEmitterSpec> getEventEmitter() override;
bool getShowNotificationControls() override;
void setShowNotificationControls(bool showNotificationControls) override;
VideoPlayerStatus getStatus() override; VideoPlayerStatus getStatus() override;
double getDuration() override; double getDuration() override;
double getVolume() override; double getVolume() override;

View File

@@ -11,6 +11,8 @@
namespace margelo::nitro::video { class HybridVideoPlayerSpec; } namespace margelo::nitro::video { class HybridVideoPlayerSpec; }
// Forward declaration of `ResizeMode` to properly resolve imports. // Forward declaration of `ResizeMode` to properly resolve imports.
namespace margelo::nitro::video { enum class ResizeMode; } namespace margelo::nitro::video { enum class ResizeMode; }
// Forward declaration of `SurfaceType` to properly resolve imports.
namespace margelo::nitro::video { enum class SurfaceType; }
#include <memory> #include <memory>
#include "HybridVideoPlayerSpec.hpp" #include "HybridVideoPlayerSpec.hpp"
@@ -18,6 +20,8 @@ namespace margelo::nitro::video { enum class ResizeMode; }
#include "JHybridVideoPlayerSpec.hpp" #include "JHybridVideoPlayerSpec.hpp"
#include "ResizeMode.hpp" #include "ResizeMode.hpp"
#include "JResizeMode.hpp" #include "JResizeMode.hpp"
#include "SurfaceType.hpp"
#include "JSurfaceType.hpp"
#include <functional> #include <functional>
#include "JFunc_void_bool.hpp" #include "JFunc_void_bool.hpp"
#include "JFunc_void.hpp" #include "JFunc_void.hpp"
@@ -99,6 +103,15 @@ namespace margelo::nitro::video {
static const auto method = javaClassStatic()->getMethod<void(jboolean /* keepScreenAwake */)>("setKeepScreenAwake"); static const auto method = javaClassStatic()->getMethod<void(jboolean /* keepScreenAwake */)>("setKeepScreenAwake");
method(_javaPart, keepScreenAwake); method(_javaPart, keepScreenAwake);
} }
SurfaceType JHybridVideoViewViewManagerSpec::getSurfaceType() {
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JSurfaceType>()>("getSurfaceType");
auto __result = method(_javaPart);
return __result->toCpp();
}
void JHybridVideoViewViewManagerSpec::setSurfaceType(SurfaceType surfaceType) {
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JSurfaceType> /* surfaceType */)>("setSurfaceType");
method(_javaPart, JSurfaceType::fromCpp(surfaceType));
}
std::optional<std::function<void(bool /* isInPictureInPicture */)>> JHybridVideoViewViewManagerSpec::getOnPictureInPictureChange() { std::optional<std::function<void(bool /* isInPictureInPicture */)>> JHybridVideoViewViewManagerSpec::getOnPictureInPictureChange() {
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_bool::javaobject>()>("getOnPictureInPictureChange_cxx"); static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_bool::javaobject>()>("getOnPictureInPictureChange_cxx");
auto __result = method(_javaPart); auto __result = method(_javaPart);

View File

@@ -61,6 +61,8 @@ namespace margelo::nitro::video {
void setResizeMode(ResizeMode resizeMode) override; void setResizeMode(ResizeMode resizeMode) override;
bool getKeepScreenAwake() override; bool getKeepScreenAwake() override;
void setKeepScreenAwake(bool keepScreenAwake) override; void setKeepScreenAwake(bool keepScreenAwake) override;
SurfaceType getSurfaceType() override;
void setSurfaceType(SurfaceType surfaceType) override;
std::optional<std::function<void(bool /* isInPictureInPicture */)>> getOnPictureInPictureChange() override; std::optional<std::function<void(bool /* isInPictureInPicture */)>> getOnPictureInPictureChange() override;
void setOnPictureInPictureChange(const std::optional<std::function<void(bool /* isInPictureInPicture */)>>& onPictureInPictureChange) override; void setOnPictureInPictureChange(const std::optional<std::function<void(bool /* isInPictureInPicture */)>>& onPictureInPictureChange) override;
std::optional<std::function<void(bool /* fullscreen */)>> getOnFullscreenChange() override; std::optional<std::function<void(bool /* fullscreen */)>> getOnFullscreenChange() override;

View File

@@ -56,7 +56,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JLivePlaybackParams::javaobject> fromCpp(const LivePlaybackParams& value) { static jni::local_ref<JLivePlaybackParams::javaobject> fromCpp(const LivePlaybackParams& value) {
return newInstance( using JSignature = JLivePlaybackParams(jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.minPlaybackSpeed.has_value() ? jni::JDouble::valueOf(value.minPlaybackSpeed.value()) : nullptr, value.minPlaybackSpeed.has_value() ? jni::JDouble::valueOf(value.minPlaybackSpeed.value()) : nullptr,
value.maxPlaybackSpeed.has_value() ? jni::JDouble::valueOf(value.maxPlaybackSpeed.value()) : nullptr, value.maxPlaybackSpeed.has_value() ? jni::JDouble::valueOf(value.maxPlaybackSpeed.value()) : nullptr,
value.maxOffsetMs.has_value() ? jni::JDouble::valueOf(value.maxOffsetMs.value()) : nullptr, value.maxOffsetMs.has_value() ? jni::JDouble::valueOf(value.maxOffsetMs.value()) : nullptr,

View File

@@ -87,7 +87,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JNativeDrmParams::javaobject> fromCpp(const NativeDrmParams& value) { static jni::local_ref<JNativeDrmParams::javaobject> fromCpp(const NativeDrmParams& value) {
return newInstance( using JSignature = JNativeDrmParams(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JMap<jni::JString, jni::JString>>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload::javaobject>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.type.has_value() ? jni::make_jstring(value.type.value()) : nullptr, value.type.has_value() ? jni::make_jstring(value.type.value()) : nullptr,
value.licenseUrl.has_value() ? jni::make_jstring(value.licenseUrl.value()) : nullptr, value.licenseUrl.has_value() ? jni::make_jstring(value.licenseUrl.value()) : nullptr,
value.certificateUrl.has_value() ? jni::make_jstring(value.certificateUrl.value()) : nullptr, value.certificateUrl.has_value() ? jni::make_jstring(value.certificateUrl.value()) : nullptr,

View File

@@ -55,7 +55,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JNativeExternalSubtitle::javaobject> fromCpp(const NativeExternalSubtitle& value) { static jni::local_ref<JNativeExternalSubtitle::javaobject> fromCpp(const NativeExternalSubtitle& value) {
return newInstance( using JSignature = JNativeExternalSubtitle(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JSubtitleType>, jni::alias_ref<jni::JString>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
jni::make_jstring(value.uri), jni::make_jstring(value.uri),
jni::make_jstring(value.label), jni::make_jstring(value.label),
JSubtitleType::fromCpp(value.type), JSubtitleType::fromCpp(value.type),

View File

@@ -11,7 +11,9 @@
#include "NativeVideoConfig.hpp" #include "NativeVideoConfig.hpp"
#include "BufferConfig.hpp" #include "BufferConfig.hpp"
#include "CustomVideoMetadata.hpp"
#include "JBufferConfig.hpp" #include "JBufferConfig.hpp"
#include "JCustomVideoMetadata.hpp"
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp" #include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp"
#include "JLivePlaybackParams.hpp" #include "JLivePlaybackParams.hpp"
#include "JNativeDrmParams.hpp" #include "JNativeDrmParams.hpp"
@@ -62,6 +64,8 @@ namespace margelo::nitro::video {
jni::local_ref<jni::JMap<jni::JString, jni::JString>> headers = this->getFieldValue(fieldHeaders); jni::local_ref<jni::JMap<jni::JString, jni::JString>> headers = this->getFieldValue(fieldHeaders);
static const auto fieldBufferConfig = clazz->getField<JBufferConfig>("bufferConfig"); static const auto fieldBufferConfig = clazz->getField<JBufferConfig>("bufferConfig");
jni::local_ref<JBufferConfig> bufferConfig = this->getFieldValue(fieldBufferConfig); jni::local_ref<JBufferConfig> bufferConfig = this->getFieldValue(fieldBufferConfig);
static const auto fieldMetadata = clazz->getField<JCustomVideoMetadata>("metadata");
jni::local_ref<JCustomVideoMetadata> metadata = this->getFieldValue(fieldMetadata);
static const auto fieldInitializeOnCreation = clazz->getField<jni::JBoolean>("initializeOnCreation"); static const auto fieldInitializeOnCreation = clazz->getField<jni::JBoolean>("initializeOnCreation");
jni::local_ref<jni::JBoolean> initializeOnCreation = this->getFieldValue(fieldInitializeOnCreation); jni::local_ref<jni::JBoolean> initializeOnCreation = this->getFieldValue(fieldInitializeOnCreation);
return NativeVideoConfig( return NativeVideoConfig(
@@ -86,6 +90,7 @@ namespace margelo::nitro::video {
return __map; return __map;
}()) : std::nullopt, }()) : std::nullopt,
bufferConfig != nullptr ? std::make_optional(bufferConfig->toCpp()) : std::nullopt, bufferConfig != nullptr ? std::make_optional(bufferConfig->toCpp()) : std::nullopt,
metadata != nullptr ? std::make_optional(metadata->toCpp()) : std::nullopt,
initializeOnCreation != nullptr ? std::make_optional(static_cast<bool>(initializeOnCreation->value())) : std::nullopt initializeOnCreation != nullptr ? std::make_optional(static_cast<bool>(initializeOnCreation->value())) : std::nullopt
); );
} }
@@ -96,7 +101,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JNativeVideoConfig::javaobject> fromCpp(const NativeVideoConfig& value) { static jni::local_ref<JNativeVideoConfig::javaobject> fromCpp(const NativeVideoConfig& value) {
return newInstance( using JSignature = JNativeVideoConfig(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JNativeExternalSubtitle>>, jni::alias_ref<JNativeDrmParams>, jni::alias_ref<jni::JMap<jni::JString, jni::JString>>, jni::alias_ref<JBufferConfig>, jni::alias_ref<JCustomVideoMetadata>, jni::alias_ref<jni::JBoolean>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
jni::make_jstring(value.uri), jni::make_jstring(value.uri),
value.externalSubtitles.has_value() ? [&]() { value.externalSubtitles.has_value() ? [&]() {
size_t __size = value.externalSubtitles.value().size(); size_t __size = value.externalSubtitles.value().size();
@@ -116,6 +125,7 @@ namespace margelo::nitro::video {
return __map; return __map;
}() : nullptr, }() : nullptr,
value.bufferConfig.has_value() ? JBufferConfig::fromCpp(value.bufferConfig.value()) : nullptr, value.bufferConfig.has_value() ? JBufferConfig::fromCpp(value.bufferConfig.value()) : nullptr,
value.metadata.has_value() ? JCustomVideoMetadata::fromCpp(value.metadata.value()) : nullptr,
value.initializeOnCreation.has_value() ? jni::JBoolean::valueOf(value.initializeOnCreation.value()) : nullptr value.initializeOnCreation.has_value() ? jni::JBoolean::valueOf(value.initializeOnCreation.value()) : nullptr
); );
} }

View File

@@ -53,7 +53,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JOnGetLicensePayload::javaobject> fromCpp(const OnGetLicensePayload& value) { static jni::local_ref<JOnGetLicensePayload::javaobject> fromCpp(const OnGetLicensePayload& value) {
return newInstance( using JSignature = JOnGetLicensePayload(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
jni::make_jstring(value.contentId), jni::make_jstring(value.contentId),
jni::make_jstring(value.licenseUrl), jni::make_jstring(value.licenseUrl),
jni::make_jstring(value.keyUrl), jni::make_jstring(value.keyUrl),

View File

@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JResolution::javaobject> fromCpp(const Resolution& value) { static jni::local_ref<JResolution::javaobject> fromCpp(const Resolution& value) {
return newInstance( using JSignature = JResolution(double, double);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.width, value.width,
value.height value.height
); );

View File

@@ -0,0 +1,59 @@
///
/// JSurfaceType.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 Marc Rousavy @ Margelo
///
#pragma once
#include <fbjni/fbjni.h>
#include "SurfaceType.hpp"
namespace margelo::nitro::video {
using namespace facebook;
/**
* The C++ JNI bridge between the C++ enum "SurfaceType" and the the Kotlin enum "SurfaceType".
*/
struct JSurfaceType final: public jni::JavaClass<JSurfaceType> {
public:
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/video/SurfaceType;";
public:
/**
* Convert this Java/Kotlin-based enum to the C++ enum SurfaceType.
*/
[[maybe_unused]]
[[nodiscard]]
SurfaceType toCpp() const {
static const auto clazz = javaClassStatic();
static const auto fieldOrdinal = clazz->getField<int>("value");
int ordinal = this->getFieldValue(fieldOrdinal);
return static_cast<SurfaceType>(ordinal);
}
public:
/**
* Create a Java/Kotlin-based enum with the given C++ enum's value.
*/
[[maybe_unused]]
static jni::alias_ref<JSurfaceType> fromCpp(SurfaceType value) {
static const auto clazz = javaClassStatic();
static const auto fieldSURFACE = clazz->getStaticField<JSurfaceType>("SURFACE");
static const auto fieldTEXTURE = clazz->getStaticField<JSurfaceType>("TEXTURE");
switch (value) {
case SurfaceType::SURFACE:
return clazz->getStaticFieldValue(fieldSURFACE);
case SurfaceType::TEXTURE:
return clazz->getStaticFieldValue(fieldTEXTURE);
default:
std::string stringValue = std::to_string(static_cast<int>(value));
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
}
}
};
} // namespace margelo::nitro::video

View File

@@ -54,7 +54,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JTextTrack::javaobject> fromCpp(const TextTrack& value) { static jni::local_ref<JTextTrack::javaobject> fromCpp(const TextTrack& value) {
return newInstance( using JSignature = JTextTrack(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jboolean);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
jni::make_jstring(value.id), jni::make_jstring(value.id),
jni::make_jstring(value.label), jni::make_jstring(value.label),
value.language.has_value() ? jni::make_jstring(value.language.value()) : nullptr, value.language.has_value() ? jni::make_jstring(value.language.value()) : nullptr,

View File

@@ -56,7 +56,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JTimedMetadata::javaobject> fromCpp(const TimedMetadata& value) { static jni::local_ref<JTimedMetadata::javaobject> fromCpp(const TimedMetadata& value) {
return newInstance( using JSignature = JTimedMetadata(jni::alias_ref<jni::JArrayClass<JTimedMetadataObject>>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
[&]() { [&]() {
size_t __size = value.metadata.size(); size_t __size = value.metadata.size();
jni::local_ref<jni::JArrayClass<JTimedMetadataObject>> __array = jni::JArrayClass<JTimedMetadataObject>::newArray(__size); jni::local_ref<jni::JArrayClass<JTimedMetadataObject>> __array = jni::JArrayClass<JTimedMetadataObject>::newArray(__size);

View File

@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JTimedMetadataObject::javaobject> fromCpp(const TimedMetadataObject& value) { static jni::local_ref<JTimedMetadataObject::javaobject> fromCpp(const TimedMetadataObject& value) {
return newInstance( using JSignature = JTimedMetadataObject(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
jni::make_jstring(value.value), jni::make_jstring(value.value),
jni::make_jstring(value.identifier) jni::make_jstring(value.identifier)
); );

View File

@@ -66,7 +66,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JVideoInformation::javaobject> fromCpp(const VideoInformation& value) { static jni::local_ref<JVideoInformation::javaobject> fromCpp(const VideoInformation& value) {
return newInstance( using JSignature = JVideoInformation(double, double, double, int64_t, int64_t, jboolean, jboolean, jni::alias_ref<JVideoOrientation>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.bitrate, value.bitrate,
value.width, value.width,
value.height, value.height,

View File

@@ -57,7 +57,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JonLoadData::javaobject> fromCpp(const onLoadData& value) { static jni::local_ref<JonLoadData::javaobject> fromCpp(const onLoadData& value) {
return newInstance( using JSignature = JonLoadData(double, double, double, double, jni::alias_ref<JVideoOrientation>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.currentTime, value.currentTime,
value.duration, value.duration,
value.height, value.height,

View File

@@ -51,7 +51,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JonLoadStartData::javaobject> fromCpp(const onLoadStartData& value) { static jni::local_ref<JonLoadStartData::javaobject> fromCpp(const onLoadStartData& value) {
return newInstance( using JSignature = JonLoadStartData(jni::alias_ref<JSourceType>, jni::alias_ref<JHybridVideoPlayerSourceSpec::javaobject>);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
JSourceType::fromCpp(value.sourceType), JSourceType::fromCpp(value.sourceType),
std::dynamic_pointer_cast<JHybridVideoPlayerSourceSpec>(value.source)->getJavaPart() std::dynamic_pointer_cast<JHybridVideoPlayerSourceSpec>(value.source)->getJavaPart()
); );

View File

@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JonPlaybackStateChangeData::javaobject> fromCpp(const onPlaybackStateChangeData& value) { static jni::local_ref<JonPlaybackStateChangeData::javaobject> fromCpp(const onPlaybackStateChangeData& value) {
return newInstance( using JSignature = JonPlaybackStateChangeData(jboolean, jboolean);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.isPlaying, value.isPlaying,
value.isBuffering value.isBuffering
); );

View File

@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JonProgressData::javaobject> fromCpp(const onProgressData& value) { static jni::local_ref<JonProgressData::javaobject> fromCpp(const onProgressData& value) {
return newInstance( using JSignature = JonProgressData(double, double);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.currentTime, value.currentTime,
value.bufferDuration value.bufferDuration
); );

View File

@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
*/ */
[[maybe_unused]] [[maybe_unused]]
static jni::local_ref<JonVolumeChangeData::javaobject> fromCpp(const onVolumeChangeData& value) { static jni::local_ref<JonVolumeChangeData::javaobject> fromCpp(const onVolumeChangeData& value) {
return newInstance( using JSignature = JonVolumeChangeData(double, jboolean);
static const auto clazz = javaClassStatic();
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
return create(
clazz,
value.volume, value.volume,
value.muted value.muted
); );

View File

@@ -17,19 +17,27 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class BandwidthData data class BandwidthData(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val bitrate: Double,
@DoNotStrip
@Keep
val width: Double?,
@DoNotStrip
@Keep
val height: Double?
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val bitrate: Double, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(bitrate: Double, width: Double?, height: Double?): BandwidthData {
val width: Double?, return BandwidthData(bitrate, width, height)
@DoNotStrip }
@Keep }
val height: Double?
) {
/* main constructor */
} }

View File

@@ -17,43 +17,51 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class BufferConfig data class BufferConfig(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val livePlayback: LivePlaybackParams?,
@DoNotStrip
@Keep
val minBufferMs: Double?,
@DoNotStrip
@Keep
val maxBufferMs: Double?,
@DoNotStrip
@Keep
val bufferForPlaybackMs: Double?,
@DoNotStrip
@Keep
val bufferForPlaybackAfterRebufferMs: Double?,
@DoNotStrip
@Keep
val backBufferDurationMs: Double?,
@DoNotStrip
@Keep
val preferredForwardBufferDurationMs: Double?,
@DoNotStrip
@Keep
val preferredPeakBitRate: Double?,
@DoNotStrip
@Keep
val preferredMaximumResolution: Resolution?,
@DoNotStrip
@Keep
val preferredPeakBitRateForExpensiveNetworks: Double?,
@DoNotStrip
@Keep
val preferredMaximumResolutionForExpensiveNetworks: Resolution?
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val livePlayback: LivePlaybackParams?, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(livePlayback: LivePlaybackParams?, minBufferMs: Double?, maxBufferMs: Double?, bufferForPlaybackMs: Double?, bufferForPlaybackAfterRebufferMs: Double?, backBufferDurationMs: Double?, preferredForwardBufferDurationMs: Double?, preferredPeakBitRate: Double?, preferredMaximumResolution: Resolution?, preferredPeakBitRateForExpensiveNetworks: Double?, preferredMaximumResolutionForExpensiveNetworks: Resolution?): BufferConfig {
val minBufferMs: Double?, return BufferConfig(livePlayback, minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs, backBufferDurationMs, preferredForwardBufferDurationMs, preferredPeakBitRate, preferredMaximumResolution, preferredPeakBitRateForExpensiveNetworks, preferredMaximumResolutionForExpensiveNetworks)
@DoNotStrip }
@Keep }
val maxBufferMs: Double?,
@DoNotStrip
@Keep
val bufferForPlaybackMs: Double?,
@DoNotStrip
@Keep
val bufferForPlaybackAfterRebufferMs: Double?,
@DoNotStrip
@Keep
val backBufferDurationMs: Double?,
@DoNotStrip
@Keep
val preferredForwardBufferDurationMs: Double?,
@DoNotStrip
@Keep
val preferredPeakBitRate: Double?,
@DoNotStrip
@Keep
val preferredMaximumResolution: Resolution?,
@DoNotStrip
@Keep
val preferredPeakBitRateForExpensiveNetworks: Double?,
@DoNotStrip
@Keep
val preferredMaximumResolutionForExpensiveNetworks: Resolution?
) {
/* main constructor */
} }

View File

@@ -0,0 +1,49 @@
///
/// CustomVideoMetadata.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 Marc Rousavy @ Margelo
///
package com.margelo.nitro.video
import androidx.annotation.Keep
import com.facebook.proguard.annotations.DoNotStrip
import com.margelo.nitro.core.*
/**
* Represents the JavaScript object/struct "CustomVideoMetadata".
*/
@DoNotStrip
@Keep
data class CustomVideoMetadata(
@DoNotStrip
@Keep
val title: String?,
@DoNotStrip
@Keep
val subtitle: String?,
@DoNotStrip
@Keep
val description: String?,
@DoNotStrip
@Keep
val artist: String?,
@DoNotStrip
@Keep
val imageUri: String?
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip
@Keep
@Suppress("unused")
@JvmStatic
private fun fromCpp(title: String?, subtitle: String?, description: String?, artist: String?, imageUri: String?): CustomVideoMetadata {
return CustomVideoMetadata(title, subtitle, description, artist, imageUri)
}
}
}

View File

@@ -309,6 +309,6 @@ abstract class HybridVideoPlayerEventEmitterSpec: HybridObject() {
private external fun initHybrid(): HybridData private external fun initHybrid(): HybridData
companion object { companion object {
private const val TAG = "HybridVideoPlayerEventEmitterSpec" protected const val TAG = "HybridVideoPlayerEventEmitterSpec"
} }
} }

View File

@@ -47,6 +47,6 @@ abstract class HybridVideoPlayerFactorySpec: HybridObject() {
private external fun initHybrid(): HybridData private external fun initHybrid(): HybridData
companion object { companion object {
private const val TAG = "HybridVideoPlayerFactorySpec" protected const val TAG = "HybridVideoPlayerFactorySpec"
} }
} }

View File

@@ -51,6 +51,6 @@ abstract class HybridVideoPlayerSourceFactorySpec: HybridObject() {
private external fun initHybrid(): HybridData private external fun initHybrid(): HybridData
companion object { companion object {
private const val TAG = "HybridVideoPlayerSourceFactorySpec" protected const val TAG = "HybridVideoPlayerSourceFactorySpec"
} }
} }

View File

@@ -53,6 +53,6 @@ abstract class HybridVideoPlayerSourceSpec: HybridObject() {
private external fun initHybrid(): HybridData private external fun initHybrid(): HybridData
companion object { companion object {
private const val TAG = "HybridVideoPlayerSourceSpec" protected const val TAG = "HybridVideoPlayerSourceSpec"
} }
} }

View File

@@ -45,6 +45,12 @@ abstract class HybridVideoPlayerSpec: HybridObject() {
@get:Keep @get:Keep
abstract val eventEmitter: HybridVideoPlayerEventEmitterSpec abstract val eventEmitter: HybridVideoPlayerEventEmitterSpec
@get:DoNotStrip
@get:Keep
@set:DoNotStrip
@set:Keep
abstract var showNotificationControls: Boolean
@get:DoNotStrip @get:DoNotStrip
@get:Keep @get:Keep
abstract val status: VideoPlayerStatus abstract val status: VideoPlayerStatus
@@ -155,6 +161,6 @@ abstract class HybridVideoPlayerSpec: HybridObject() {
private external fun initHybrid(): HybridData private external fun initHybrid(): HybridData
companion object { companion object {
private const val TAG = "HybridVideoPlayerSpec" protected const val TAG = "HybridVideoPlayerSpec"
} }
} }

View File

@@ -47,6 +47,6 @@ abstract class HybridVideoViewViewManagerFactorySpec: HybridObject() {
private external fun initHybrid(): HybridData private external fun initHybrid(): HybridData
companion object { companion object {
private const val TAG = "HybridVideoViewViewManagerFactorySpec" protected const val TAG = "HybridVideoViewViewManagerFactorySpec"
} }
} }

View File

@@ -73,6 +73,12 @@ abstract class HybridVideoViewViewManagerSpec: HybridObject() {
@set:Keep @set:Keep
abstract var keepScreenAwake: Boolean abstract var keepScreenAwake: Boolean
@get:DoNotStrip
@get:Keep
@set:DoNotStrip
@set:Keep
abstract var surfaceType: SurfaceType
abstract var onPictureInPictureChange: ((isInPictureInPicture: Boolean) -> Unit)? abstract var onPictureInPictureChange: ((isInPictureInPicture: Boolean) -> Unit)?
private var onPictureInPictureChange_cxx: Func_void_bool? private var onPictureInPictureChange_cxx: Func_void_bool?
@@ -181,6 +187,6 @@ abstract class HybridVideoViewViewManagerSpec: HybridObject() {
private external fun initHybrid(): HybridData private external fun initHybrid(): HybridData
companion object { companion object {
private const val TAG = "HybridVideoViewViewManagerSpec" protected const val TAG = "HybridVideoViewViewManagerSpec"
} }
} }

View File

@@ -17,25 +17,33 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class LivePlaybackParams data class LivePlaybackParams(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val minPlaybackSpeed: Double?,
@DoNotStrip
@Keep
val maxPlaybackSpeed: Double?,
@DoNotStrip
@Keep
val maxOffsetMs: Double?,
@DoNotStrip
@Keep
val minOffsetMs: Double?,
@DoNotStrip
@Keep
val targetOffsetMs: Double?
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val minPlaybackSpeed: Double?, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(minPlaybackSpeed: Double?, maxPlaybackSpeed: Double?, maxOffsetMs: Double?, minOffsetMs: Double?, targetOffsetMs: Double?): LivePlaybackParams {
val maxPlaybackSpeed: Double?, return LivePlaybackParams(minPlaybackSpeed, maxPlaybackSpeed, maxOffsetMs, minOffsetMs, targetOffsetMs)
@DoNotStrip }
@Keep }
val maxOffsetMs: Double?,
@DoNotStrip
@Keep
val minOffsetMs: Double?,
@DoNotStrip
@Keep
val targetOffsetMs: Double?
) {
/* main constructor */
} }

View File

@@ -17,35 +17,39 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class NativeDrmParams data class NativeDrmParams(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val type: String?,
@DoNotStrip
@Keep
val licenseUrl: String?,
@DoNotStrip
@Keep
val certificateUrl: String?,
@DoNotStrip
@Keep
val contentId: String?,
@DoNotStrip
@Keep
val licenseHeaders: Map<String, String>?,
@DoNotStrip
@Keep
val multiSession: Boolean?,
@DoNotStrip
@Keep
val getLicense: ((payload: OnGetLicensePayload) -> Promise<Promise<String>>)?
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val type: String?, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(type: String?, licenseUrl: String?, certificateUrl: String?, contentId: String?, licenseHeaders: Map<String, String>?, multiSession: Boolean?, getLicense: Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload?): NativeDrmParams {
val licenseUrl: String?, return NativeDrmParams(type, licenseUrl, certificateUrl, contentId, licenseHeaders, multiSession, getLicense?.let { it })
@DoNotStrip }
@Keep }
val certificateUrl: String?,
@DoNotStrip
@Keep
val contentId: String?,
@DoNotStrip
@Keep
val licenseHeaders: Map<String, String>?,
@DoNotStrip
@Keep
val multiSession: Boolean?,
@DoNotStrip
@Keep
val getLicense: Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload?
) {
/**
* Initialize a new instance of `NativeDrmParams` from Kotlin.
*/
constructor(type: String?, licenseUrl: String?, certificateUrl: String?, contentId: String?, licenseHeaders: Map<String, String>?, multiSession: Boolean?, getLicense: ((payload: OnGetLicensePayload) -> Promise<Promise<String>>)?)
: this(type, licenseUrl, certificateUrl, contentId, licenseHeaders, multiSession, getLicense?.let { Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_java(it) })
} }

View File

@@ -17,22 +17,30 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class NativeExternalSubtitle data class NativeExternalSubtitle(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val uri: String,
@DoNotStrip
@Keep
val label: String,
@DoNotStrip
@Keep
val type: SubtitleType,
@DoNotStrip
@Keep
val language: String
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val uri: String, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(uri: String, label: String, type: SubtitleType, language: String): NativeExternalSubtitle {
val label: String, return NativeExternalSubtitle(uri, label, type, language)
@DoNotStrip }
@Keep }
val type: SubtitleType,
@DoNotStrip
@Keep
val language: String
) {
/* main constructor */
} }

View File

@@ -17,28 +17,39 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class NativeVideoConfig data class NativeVideoConfig(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val uri: String,
@DoNotStrip
@Keep
val externalSubtitles: Array<NativeExternalSubtitle>?,
@DoNotStrip
@Keep
val drm: NativeDrmParams?,
@DoNotStrip
@Keep
val headers: Map<String, String>?,
@DoNotStrip
@Keep
val bufferConfig: BufferConfig?,
@DoNotStrip
@Keep
val metadata: CustomVideoMetadata?,
@DoNotStrip
@Keep
val initializeOnCreation: Boolean?
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val uri: String, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(uri: String, externalSubtitles: Array<NativeExternalSubtitle>?, drm: NativeDrmParams?, headers: Map<String, String>?, bufferConfig: BufferConfig?, metadata: CustomVideoMetadata?, initializeOnCreation: Boolean?): NativeVideoConfig {
val externalSubtitles: Array<NativeExternalSubtitle>?, return NativeVideoConfig(uri, externalSubtitles, drm, headers, bufferConfig, metadata, initializeOnCreation)
@DoNotStrip }
@Keep }
val drm: NativeDrmParams?,
@DoNotStrip
@Keep
val headers: Map<String, String>?,
@DoNotStrip
@Keep
val bufferConfig: BufferConfig?,
@DoNotStrip
@Keep
val initializeOnCreation: Boolean?
) {
/* main constructor */
} }

View File

@@ -17,22 +17,30 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class OnGetLicensePayload data class OnGetLicensePayload(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val contentId: String,
@DoNotStrip
@Keep
val licenseUrl: String,
@DoNotStrip
@Keep
val keyUrl: String,
@DoNotStrip
@Keep
val spc: String
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val contentId: String, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(contentId: String, licenseUrl: String, keyUrl: String, spc: String): OnGetLicensePayload {
val licenseUrl: String, return OnGetLicensePayload(contentId, licenseUrl, keyUrl, spc)
@DoNotStrip }
@Keep }
val keyUrl: String,
@DoNotStrip
@Keep
val spc: String
) {
/* main constructor */
} }

View File

@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class Resolution data class Resolution(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val width: Double,
@DoNotStrip
@Keep
val height: Double
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val width: Double, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(width: Double, height: Double): Resolution {
val height: Double return Resolution(width, height)
) { }
/* main constructor */ }
} }

View File

@@ -0,0 +1,21 @@
///
/// SurfaceType.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 Marc Rousavy @ Margelo
///
package com.margelo.nitro.video
import androidx.annotation.Keep
import com.facebook.proguard.annotations.DoNotStrip
/**
* Represents the JavaScript enum/union "SurfaceType".
*/
@DoNotStrip
@Keep
enum class SurfaceType(@DoNotStrip @Keep val value: Int) {
SURFACE(0),
TEXTURE(1);
}

View File

@@ -17,22 +17,30 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class TextTrack data class TextTrack(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val id: String,
@DoNotStrip
@Keep
val label: String,
@DoNotStrip
@Keep
val language: String?,
@DoNotStrip
@Keep
val selected: Boolean
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val id: String, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(id: String, label: String, language: String?, selected: Boolean): TextTrack {
val label: String, return TextTrack(id, label, language, selected)
@DoNotStrip }
@Keep }
val language: String?,
@DoNotStrip
@Keep
val selected: Boolean
) {
/* main constructor */
} }

View File

@@ -17,13 +17,21 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class TimedMetadata data class TimedMetadata(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val metadata: Array<TimedMetadataObject>
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val metadata: Array<TimedMetadataObject> @Suppress("unused")
) { @JvmStatic
/* main constructor */ private fun fromCpp(metadata: Array<TimedMetadataObject>): TimedMetadata {
return TimedMetadata(metadata)
}
}
} }

View File

@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class TimedMetadataObject data class TimedMetadataObject(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val value: String,
@DoNotStrip
@Keep
val identifier: String
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val value: String, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(value: String, identifier: String): TimedMetadataObject {
val identifier: String return TimedMetadataObject(value, identifier)
) { }
/* main constructor */ }
} }

View File

@@ -17,34 +17,42 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class VideoInformation data class VideoInformation(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val bitrate: Double,
@DoNotStrip
@Keep
val width: Double,
@DoNotStrip
@Keep
val height: Double,
@DoNotStrip
@Keep
val duration: Long,
@DoNotStrip
@Keep
val fileSize: Long,
@DoNotStrip
@Keep
val isHDR: Boolean,
@DoNotStrip
@Keep
val isLive: Boolean,
@DoNotStrip
@Keep
val orientation: VideoOrientation
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val bitrate: Double, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(bitrate: Double, width: Double, height: Double, duration: Long, fileSize: Long, isHDR: Boolean, isLive: Boolean, orientation: VideoOrientation): VideoInformation {
val width: Double, return VideoInformation(bitrate, width, height, duration, fileSize, isHDR, isLive, orientation)
@DoNotStrip }
@Keep }
val height: Double,
@DoNotStrip
@Keep
val duration: Long,
@DoNotStrip
@Keep
val fileSize: Long,
@DoNotStrip
@Keep
val isHDR: Boolean,
@DoNotStrip
@Keep
val isLive: Boolean,
@DoNotStrip
@Keep
val orientation: VideoOrientation
) {
/* main constructor */
} }

View File

@@ -17,25 +17,33 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class onLoadData data class onLoadData(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val currentTime: Double,
@DoNotStrip
@Keep
val duration: Double,
@DoNotStrip
@Keep
val height: Double,
@DoNotStrip
@Keep
val width: Double,
@DoNotStrip
@Keep
val orientation: VideoOrientation
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val currentTime: Double, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(currentTime: Double, duration: Double, height: Double, width: Double, orientation: VideoOrientation): onLoadData {
val duration: Double, return onLoadData(currentTime, duration, height, width, orientation)
@DoNotStrip }
@Keep }
val height: Double,
@DoNotStrip
@Keep
val width: Double,
@DoNotStrip
@Keep
val orientation: VideoOrientation
) {
/* main constructor */
} }

View File

@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class onLoadStartData data class onLoadStartData(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val sourceType: SourceType,
@DoNotStrip
@Keep
val source: HybridVideoPlayerSourceSpec
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val sourceType: SourceType, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(sourceType: SourceType, source: HybridVideoPlayerSourceSpec): onLoadStartData {
val source: HybridVideoPlayerSourceSpec return onLoadStartData(sourceType, source)
) { }
/* main constructor */ }
} }

View File

@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class onPlaybackStateChangeData data class onPlaybackStateChangeData(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val isPlaying: Boolean,
@DoNotStrip
@Keep
val isBuffering: Boolean
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val isPlaying: Boolean, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(isPlaying: Boolean, isBuffering: Boolean): onPlaybackStateChangeData {
val isBuffering: Boolean return onPlaybackStateChangeData(isPlaying, isBuffering)
) { }
/* main constructor */ }
} }

View File

@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class onProgressData data class onProgressData(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val currentTime: Double,
@DoNotStrip
@Keep
val bufferDuration: Double
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val currentTime: Double, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(currentTime: Double, bufferDuration: Double): onProgressData {
val bufferDuration: Double return onProgressData(currentTime, bufferDuration)
) { }
/* main constructor */ }
} }

View File

@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
*/ */
@DoNotStrip @DoNotStrip
@Keep @Keep
data class onVolumeChangeData data class onVolumeChangeData(
@DoNotStrip @DoNotStrip
@Keep @Keep
constructor( val volume: Double,
@DoNotStrip
@Keep
val muted: Boolean
) {
private companion object {
/**
* Constructor called from C++
*/
@DoNotStrip @DoNotStrip
@Keep @Keep
val volume: Double, @Suppress("unused")
@DoNotStrip @JvmStatic
@Keep private fun fromCpp(volume: Double, muted: Boolean): onVolumeChangeData {
val muted: Boolean return onVolumeChangeData(volume, muted)
) { }
/* main constructor */ }
} }

View File

@@ -20,11 +20,11 @@
namespace margelo::nitro::video::bridge::swift { namespace margelo::nitro::video::bridge::swift {
// pragma MARK: std::shared_ptr<HybridVideoPlayerSourceSpec> // pragma MARK: std::shared_ptr<HybridVideoPlayerSourceSpec>
std::shared_ptr<HybridVideoPlayerSourceSpec> create_std__shared_ptr_HybridVideoPlayerSourceSpec_(void* _Nonnull swiftUnsafePointer) { std::shared_ptr<HybridVideoPlayerSourceSpec> create_std__shared_ptr_HybridVideoPlayerSourceSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
ReactNativeVideo::HybridVideoPlayerSourceSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSourceSpec_cxx::fromUnsafe(swiftUnsafePointer); ReactNativeVideo::HybridVideoPlayerSourceSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSourceSpec_cxx::fromUnsafe(swiftUnsafePointer);
return std::make_shared<margelo::nitro::video::HybridVideoPlayerSourceSpecSwift>(swiftPart); return std::make_shared<margelo::nitro::video::HybridVideoPlayerSourceSpecSwift>(swiftPart);
} }
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSourceSpec_(std__shared_ptr_HybridVideoPlayerSourceSpec_ cppType) { void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSourceSpec_(std__shared_ptr_HybridVideoPlayerSourceSpec_ cppType) {
std::shared_ptr<margelo::nitro::video::HybridVideoPlayerSourceSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerSourceSpecSwift>(cppType); std::shared_ptr<margelo::nitro::video::HybridVideoPlayerSourceSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerSourceSpecSwift>(cppType);
#ifdef NITRO_DEBUG #ifdef NITRO_DEBUG
if (swiftWrapper == nullptr) [[unlikely]] { if (swiftWrapper == nullptr) [[unlikely]] {
@@ -36,11 +36,11 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::shared_ptr<HybridVideoPlayerEventEmitterSpec> // pragma MARK: std::shared_ptr<HybridVideoPlayerEventEmitterSpec>
std::shared_ptr<HybridVideoPlayerEventEmitterSpec> create_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(void* _Nonnull swiftUnsafePointer) { std::shared_ptr<HybridVideoPlayerEventEmitterSpec> create_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
ReactNativeVideo::HybridVideoPlayerEventEmitterSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerEventEmitterSpec_cxx::fromUnsafe(swiftUnsafePointer); ReactNativeVideo::HybridVideoPlayerEventEmitterSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerEventEmitterSpec_cxx::fromUnsafe(swiftUnsafePointer);
return std::make_shared<margelo::nitro::video::HybridVideoPlayerEventEmitterSpecSwift>(swiftPart); return std::make_shared<margelo::nitro::video::HybridVideoPlayerEventEmitterSpecSwift>(swiftPart);
} }
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ cppType) { void* NON_NULL get_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ cppType) {
std::shared_ptr<margelo::nitro::video::HybridVideoPlayerEventEmitterSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerEventEmitterSpecSwift>(cppType); std::shared_ptr<margelo::nitro::video::HybridVideoPlayerEventEmitterSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerEventEmitterSpecSwift>(cppType);
#ifdef NITRO_DEBUG #ifdef NITRO_DEBUG
if (swiftWrapper == nullptr) [[unlikely]] { if (swiftWrapper == nullptr) [[unlikely]] {
@@ -52,7 +52,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void()> // pragma MARK: std::function<void()>
Func_void create_Func_void(void* _Nonnull swiftClosureWrapper) { Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)]() mutable -> void { return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
swiftClosure.call(); swiftClosure.call();
@@ -60,7 +60,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)> // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* _Nonnull swiftClosureWrapper) { Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
swiftClosure.call(error); swiftClosure.call(error);
@@ -68,11 +68,11 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::shared_ptr<HybridVideoPlayerSpec> // pragma MARK: std::shared_ptr<HybridVideoPlayerSpec>
std::shared_ptr<HybridVideoPlayerSpec> create_std__shared_ptr_HybridVideoPlayerSpec_(void* _Nonnull swiftUnsafePointer) { std::shared_ptr<HybridVideoPlayerSpec> create_std__shared_ptr_HybridVideoPlayerSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
ReactNativeVideo::HybridVideoPlayerSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSpec_cxx::fromUnsafe(swiftUnsafePointer); ReactNativeVideo::HybridVideoPlayerSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSpec_cxx::fromUnsafe(swiftUnsafePointer);
return std::make_shared<margelo::nitro::video::HybridVideoPlayerSpecSwift>(swiftPart); return std::make_shared<margelo::nitro::video::HybridVideoPlayerSpecSwift>(swiftPart);
} }
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSpec_(std__shared_ptr_HybridVideoPlayerSpec_ cppType) { void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSpec_(std__shared_ptr_HybridVideoPlayerSpec_ cppType) {
std::shared_ptr<margelo::nitro::video::HybridVideoPlayerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerSpecSwift>(cppType); std::shared_ptr<margelo::nitro::video::HybridVideoPlayerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerSpecSwift>(cppType);
#ifdef NITRO_DEBUG #ifdef NITRO_DEBUG
if (swiftWrapper == nullptr) [[unlikely]] { if (swiftWrapper == nullptr) [[unlikely]] {
@@ -84,11 +84,11 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::shared_ptr<HybridVideoPlayerFactorySpec> // pragma MARK: std::shared_ptr<HybridVideoPlayerFactorySpec>
std::shared_ptr<HybridVideoPlayerFactorySpec> create_std__shared_ptr_HybridVideoPlayerFactorySpec_(void* _Nonnull swiftUnsafePointer) { std::shared_ptr<HybridVideoPlayerFactorySpec> create_std__shared_ptr_HybridVideoPlayerFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept {
ReactNativeVideo::HybridVideoPlayerFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerFactorySpec_cxx::fromUnsafe(swiftUnsafePointer); ReactNativeVideo::HybridVideoPlayerFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerFactorySpec_cxx::fromUnsafe(swiftUnsafePointer);
return std::make_shared<margelo::nitro::video::HybridVideoPlayerFactorySpecSwift>(swiftPart); return std::make_shared<margelo::nitro::video::HybridVideoPlayerFactorySpecSwift>(swiftPart);
} }
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerFactorySpec_(std__shared_ptr_HybridVideoPlayerFactorySpec_ cppType) { void* NON_NULL get_std__shared_ptr_HybridVideoPlayerFactorySpec_(std__shared_ptr_HybridVideoPlayerFactorySpec_ cppType) {
std::shared_ptr<margelo::nitro::video::HybridVideoPlayerFactorySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerFactorySpecSwift>(cppType); std::shared_ptr<margelo::nitro::video::HybridVideoPlayerFactorySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerFactorySpecSwift>(cppType);
#ifdef NITRO_DEBUG #ifdef NITRO_DEBUG
if (swiftWrapper == nullptr) [[unlikely]] { if (swiftWrapper == nullptr) [[unlikely]] {
@@ -100,7 +100,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(bool /* hasAudioFocus */)> // pragma MARK: std::function<void(bool /* hasAudioFocus */)>
Func_void_bool create_Func_void_bool(void* _Nonnull swiftClosureWrapper) { Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_bool::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_bool::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](bool hasAudioFocus) mutable -> void { return [swiftClosure = std::move(swiftClosure)](bool hasAudioFocus) mutable -> void {
swiftClosure.call(hasAudioFocus); swiftClosure.call(hasAudioFocus);
@@ -108,7 +108,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const BandwidthData& /* data */)> // pragma MARK: std::function<void(const BandwidthData& /* data */)>
Func_void_BandwidthData create_Func_void_BandwidthData(void* _Nonnull swiftClosureWrapper) { Func_void_BandwidthData create_Func_void_BandwidthData(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_BandwidthData::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_BandwidthData::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const BandwidthData& data) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const BandwidthData& data) mutable -> void {
swiftClosure.call(data); swiftClosure.call(data);
@@ -116,7 +116,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const onLoadData& /* data */)> // pragma MARK: std::function<void(const onLoadData& /* data */)>
Func_void_onLoadData create_Func_void_onLoadData(void* _Nonnull swiftClosureWrapper) { Func_void_onLoadData create_Func_void_onLoadData(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_onLoadData::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_onLoadData::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const onLoadData& data) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const onLoadData& data) mutable -> void {
swiftClosure.call(data); swiftClosure.call(data);
@@ -124,7 +124,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const onLoadStartData& /* data */)> // pragma MARK: std::function<void(const onLoadStartData& /* data */)>
Func_void_onLoadStartData create_Func_void_onLoadStartData(void* _Nonnull swiftClosureWrapper) { Func_void_onLoadStartData create_Func_void_onLoadStartData(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_onLoadStartData::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_onLoadStartData::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const onLoadStartData& data) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const onLoadStartData& data) mutable -> void {
swiftClosure.call(data); swiftClosure.call(data);
@@ -132,7 +132,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const onPlaybackStateChangeData& /* data */)> // pragma MARK: std::function<void(const onPlaybackStateChangeData& /* data */)>
Func_void_onPlaybackStateChangeData create_Func_void_onPlaybackStateChangeData(void* _Nonnull swiftClosureWrapper) { Func_void_onPlaybackStateChangeData create_Func_void_onPlaybackStateChangeData(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_onPlaybackStateChangeData::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_onPlaybackStateChangeData::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const onPlaybackStateChangeData& data) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const onPlaybackStateChangeData& data) mutable -> void {
swiftClosure.call(data); swiftClosure.call(data);
@@ -140,7 +140,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(double /* rate */)> // pragma MARK: std::function<void(double /* rate */)>
Func_void_double create_Func_void_double(void* _Nonnull swiftClosureWrapper) { Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_double::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_double::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](double rate) mutable -> void { return [swiftClosure = std::move(swiftClosure)](double rate) mutable -> void {
swiftClosure.call(rate); swiftClosure.call(rate);
@@ -148,7 +148,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const onProgressData& /* data */)> // pragma MARK: std::function<void(const onProgressData& /* data */)>
Func_void_onProgressData create_Func_void_onProgressData(void* _Nonnull swiftClosureWrapper) { Func_void_onProgressData create_Func_void_onProgressData(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_onProgressData::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_onProgressData::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const onProgressData& data) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const onProgressData& data) mutable -> void {
swiftClosure.call(data); swiftClosure.call(data);
@@ -156,7 +156,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const TimedMetadata& /* metadata */)> // pragma MARK: std::function<void(const TimedMetadata& /* metadata */)>
Func_void_TimedMetadata create_Func_void_TimedMetadata(void* _Nonnull swiftClosureWrapper) { Func_void_TimedMetadata create_Func_void_TimedMetadata(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_TimedMetadata::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_TimedMetadata::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const TimedMetadata& metadata) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const TimedMetadata& metadata) mutable -> void {
swiftClosure.call(metadata); swiftClosure.call(metadata);
@@ -164,7 +164,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const std::vector<std::string>& /* texts */)> // pragma MARK: std::function<void(const std::vector<std::string>& /* texts */)>
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* _Nonnull swiftClosureWrapper) { Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& texts) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& texts) mutable -> void {
swiftClosure.call(texts); swiftClosure.call(texts);
@@ -172,7 +172,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const std::optional<TextTrack>& /* track */)> // pragma MARK: std::function<void(const std::optional<TextTrack>& /* track */)>
Func_void_std__optional_TextTrack_ create_Func_void_std__optional_TextTrack_(void* _Nonnull swiftClosureWrapper) { Func_void_std__optional_TextTrack_ create_Func_void_std__optional_TextTrack_(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_std__optional_TextTrack_::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_std__optional_TextTrack_::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const std::optional<TextTrack>& track) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const std::optional<TextTrack>& track) mutable -> void {
swiftClosure.call(track); swiftClosure.call(track);
@@ -180,7 +180,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const onVolumeChangeData& /* data */)> // pragma MARK: std::function<void(const onVolumeChangeData& /* data */)>
Func_void_onVolumeChangeData create_Func_void_onVolumeChangeData(void* _Nonnull swiftClosureWrapper) { Func_void_onVolumeChangeData create_Func_void_onVolumeChangeData(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_onVolumeChangeData::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_onVolumeChangeData::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const onVolumeChangeData& data) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const onVolumeChangeData& data) mutable -> void {
swiftClosure.call(data); swiftClosure.call(data);
@@ -188,7 +188,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(VideoPlayerStatus /* status */)> // pragma MARK: std::function<void(VideoPlayerStatus /* status */)>
Func_void_VideoPlayerStatus create_Func_void_VideoPlayerStatus(void* _Nonnull swiftClosureWrapper) { Func_void_VideoPlayerStatus create_Func_void_VideoPlayerStatus(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_VideoPlayerStatus::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_VideoPlayerStatus::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](VideoPlayerStatus status) mutable -> void { return [swiftClosure = std::move(swiftClosure)](VideoPlayerStatus status) mutable -> void {
swiftClosure.call(static_cast<int>(status)); swiftClosure.call(static_cast<int>(status));
@@ -196,7 +196,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const std::string& /* result */)> // pragma MARK: std::function<void(const std::string& /* result */)>
Func_void_std__string create_Func_void_std__string(void* _Nonnull swiftClosureWrapper) { Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_std__string::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const std::string& result) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const std::string& result) mutable -> void {
swiftClosure.call(result); swiftClosure.call(result);
@@ -204,7 +204,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)> // pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>
Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload(void* _Nonnull swiftClosureWrapper) { Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const OnGetLicensePayload& payload) mutable -> std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> { return [swiftClosure = std::move(swiftClosure)](const OnGetLicensePayload& payload) mutable -> std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> {
auto __result = swiftClosure.call(payload); auto __result = swiftClosure.call(payload);
@@ -213,7 +213,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)> // pragma MARK: std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)>
Func_void_std__shared_ptr_Promise_std__string__ create_Func_void_std__shared_ptr_Promise_std__string__(void* _Nonnull swiftClosureWrapper) { Func_void_std__shared_ptr_Promise_std__string__ create_Func_void_std__shared_ptr_Promise_std__string__(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_std__shared_ptr_Promise_std__string__::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_std__shared_ptr_Promise_std__string__::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr<Promise<std::string>>& result) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr<Promise<std::string>>& result) mutable -> void {
swiftClosure.call(result); swiftClosure.call(result);
@@ -221,7 +221,7 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::function<void(const VideoInformation& /* result */)> // pragma MARK: std::function<void(const VideoInformation& /* result */)>
Func_void_VideoInformation create_Func_void_VideoInformation(void* _Nonnull swiftClosureWrapper) { Func_void_VideoInformation create_Func_void_VideoInformation(void* NON_NULL swiftClosureWrapper) noexcept {
auto swiftClosure = ReactNativeVideo::Func_void_VideoInformation::fromUnsafe(swiftClosureWrapper); auto swiftClosure = ReactNativeVideo::Func_void_VideoInformation::fromUnsafe(swiftClosureWrapper);
return [swiftClosure = std::move(swiftClosure)](const VideoInformation& result) mutable -> void { return [swiftClosure = std::move(swiftClosure)](const VideoInformation& result) mutable -> void {
swiftClosure.call(result); swiftClosure.call(result);
@@ -229,11 +229,11 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::shared_ptr<HybridVideoPlayerSourceFactorySpec> // pragma MARK: std::shared_ptr<HybridVideoPlayerSourceFactorySpec>
std::shared_ptr<HybridVideoPlayerSourceFactorySpec> create_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(void* _Nonnull swiftUnsafePointer) { std::shared_ptr<HybridVideoPlayerSourceFactorySpec> create_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept {
ReactNativeVideo::HybridVideoPlayerSourceFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSourceFactorySpec_cxx::fromUnsafe(swiftUnsafePointer); ReactNativeVideo::HybridVideoPlayerSourceFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSourceFactorySpec_cxx::fromUnsafe(swiftUnsafePointer);
return std::make_shared<margelo::nitro::video::HybridVideoPlayerSourceFactorySpecSwift>(swiftPart); return std::make_shared<margelo::nitro::video::HybridVideoPlayerSourceFactorySpecSwift>(swiftPart);
} }
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ cppType) { void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ cppType) {
std::shared_ptr<margelo::nitro::video::HybridVideoPlayerSourceFactorySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerSourceFactorySpecSwift>(cppType); std::shared_ptr<margelo::nitro::video::HybridVideoPlayerSourceFactorySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoPlayerSourceFactorySpecSwift>(cppType);
#ifdef NITRO_DEBUG #ifdef NITRO_DEBUG
if (swiftWrapper == nullptr) [[unlikely]] { if (swiftWrapper == nullptr) [[unlikely]] {
@@ -245,11 +245,11 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::shared_ptr<HybridVideoViewViewManagerSpec> // pragma MARK: std::shared_ptr<HybridVideoViewViewManagerSpec>
std::shared_ptr<HybridVideoViewViewManagerSpec> create_std__shared_ptr_HybridVideoViewViewManagerSpec_(void* _Nonnull swiftUnsafePointer) { std::shared_ptr<HybridVideoViewViewManagerSpec> create_std__shared_ptr_HybridVideoViewViewManagerSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
ReactNativeVideo::HybridVideoViewViewManagerSpec_cxx swiftPart = ReactNativeVideo::HybridVideoViewViewManagerSpec_cxx::fromUnsafe(swiftUnsafePointer); ReactNativeVideo::HybridVideoViewViewManagerSpec_cxx swiftPart = ReactNativeVideo::HybridVideoViewViewManagerSpec_cxx::fromUnsafe(swiftUnsafePointer);
return std::make_shared<margelo::nitro::video::HybridVideoViewViewManagerSpecSwift>(swiftPart); return std::make_shared<margelo::nitro::video::HybridVideoViewViewManagerSpecSwift>(swiftPart);
} }
void* _Nonnull get_std__shared_ptr_HybridVideoViewViewManagerSpec_(std__shared_ptr_HybridVideoViewViewManagerSpec_ cppType) { void* NON_NULL get_std__shared_ptr_HybridVideoViewViewManagerSpec_(std__shared_ptr_HybridVideoViewViewManagerSpec_ cppType) {
std::shared_ptr<margelo::nitro::video::HybridVideoViewViewManagerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoViewViewManagerSpecSwift>(cppType); std::shared_ptr<margelo::nitro::video::HybridVideoViewViewManagerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoViewViewManagerSpecSwift>(cppType);
#ifdef NITRO_DEBUG #ifdef NITRO_DEBUG
if (swiftWrapper == nullptr) [[unlikely]] { if (swiftWrapper == nullptr) [[unlikely]] {
@@ -261,11 +261,11 @@ namespace margelo::nitro::video::bridge::swift {
} }
// pragma MARK: std::shared_ptr<HybridVideoViewViewManagerFactorySpec> // pragma MARK: std::shared_ptr<HybridVideoViewViewManagerFactorySpec>
std::shared_ptr<HybridVideoViewViewManagerFactorySpec> create_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(void* _Nonnull swiftUnsafePointer) { std::shared_ptr<HybridVideoViewViewManagerFactorySpec> create_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept {
ReactNativeVideo::HybridVideoViewViewManagerFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoViewViewManagerFactorySpec_cxx::fromUnsafe(swiftUnsafePointer); ReactNativeVideo::HybridVideoViewViewManagerFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoViewViewManagerFactorySpec_cxx::fromUnsafe(swiftUnsafePointer);
return std::make_shared<margelo::nitro::video::HybridVideoViewViewManagerFactorySpecSwift>(swiftPart); return std::make_shared<margelo::nitro::video::HybridVideoViewViewManagerFactorySpecSwift>(swiftPart);
} }
void* _Nonnull get_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ cppType) { void* NON_NULL get_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ cppType) {
std::shared_ptr<margelo::nitro::video::HybridVideoViewViewManagerFactorySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoViewViewManagerFactorySpecSwift>(cppType); std::shared_ptr<margelo::nitro::video::HybridVideoViewViewManagerFactorySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::video::HybridVideoViewViewManagerFactorySpecSwift>(cppType);
#ifdef NITRO_DEBUG #ifdef NITRO_DEBUG
if (swiftWrapper == nullptr) [[unlikely]] { if (swiftWrapper == nullptr) [[unlikely]] {

View File

@@ -12,6 +12,8 @@
namespace margelo::nitro::video { struct BandwidthData; } namespace margelo::nitro::video { struct BandwidthData; }
// Forward declaration of `BufferConfig` to properly resolve imports. // Forward declaration of `BufferConfig` to properly resolve imports.
namespace margelo::nitro::video { struct BufferConfig; } namespace margelo::nitro::video { struct BufferConfig; }
// Forward declaration of `CustomVideoMetadata` to properly resolve imports.
namespace margelo::nitro::video { struct CustomVideoMetadata; }
// Forward declaration of `HybridVideoPlayerEventEmitterSpec` to properly resolve imports. // Forward declaration of `HybridVideoPlayerEventEmitterSpec` to properly resolve imports.
namespace margelo::nitro::video { class HybridVideoPlayerEventEmitterSpec; } namespace margelo::nitro::video { class HybridVideoPlayerEventEmitterSpec; }
// Forward declaration of `HybridVideoPlayerFactorySpec` to properly resolve imports. // Forward declaration of `HybridVideoPlayerFactorySpec` to properly resolve imports.
@@ -82,6 +84,7 @@ namespace ReactNativeVideo { class HybridVideoViewViewManagerSpec_cxx; }
// Include C++ defined types // Include C++ defined types
#include "BandwidthData.hpp" #include "BandwidthData.hpp"
#include "BufferConfig.hpp" #include "BufferConfig.hpp"
#include "CustomVideoMetadata.hpp"
#include "HybridVideoPlayerEventEmitterSpec.hpp" #include "HybridVideoPlayerEventEmitterSpec.hpp"
#include "HybridVideoPlayerFactorySpec.hpp" #include "HybridVideoPlayerFactorySpec.hpp"
#include "HybridVideoPlayerSourceFactorySpec.hpp" #include "HybridVideoPlayerSourceFactorySpec.hpp"
@@ -107,6 +110,7 @@ namespace ReactNativeVideo { class HybridVideoViewViewManagerSpec_cxx; }
#include "onPlaybackStateChangeData.hpp" #include "onPlaybackStateChangeData.hpp"
#include "onProgressData.hpp" #include "onProgressData.hpp"
#include "onVolumeChangeData.hpp" #include "onVolumeChangeData.hpp"
#include <NitroModules/FastVectorCopy.hpp>
#include <NitroModules/Promise.hpp> #include <NitroModules/Promise.hpp>
#include <NitroModules/PromiseHolder.hpp> #include <NitroModules/PromiseHolder.hpp>
#include <NitroModules/Result.hpp> #include <NitroModules/Result.hpp>
@@ -129,34 +133,34 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::shared_ptr<HybridVideoPlayerSourceSpec>`. * Specialized version of `std::shared_ptr<HybridVideoPlayerSourceSpec>`.
*/ */
using std__shared_ptr_HybridVideoPlayerSourceSpec_ = std::shared_ptr<HybridVideoPlayerSourceSpec>; using std__shared_ptr_HybridVideoPlayerSourceSpec_ = std::shared_ptr<HybridVideoPlayerSourceSpec>;
std::shared_ptr<HybridVideoPlayerSourceSpec> create_std__shared_ptr_HybridVideoPlayerSourceSpec_(void* _Nonnull swiftUnsafePointer); std::shared_ptr<HybridVideoPlayerSourceSpec> create_std__shared_ptr_HybridVideoPlayerSourceSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSourceSpec_(std__shared_ptr_HybridVideoPlayerSourceSpec_ cppType); void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSourceSpec_(std__shared_ptr_HybridVideoPlayerSourceSpec_ cppType);
// pragma MARK: std::weak_ptr<HybridVideoPlayerSourceSpec> // pragma MARK: std::weak_ptr<HybridVideoPlayerSourceSpec>
using std__weak_ptr_HybridVideoPlayerSourceSpec_ = std::weak_ptr<HybridVideoPlayerSourceSpec>; using std__weak_ptr_HybridVideoPlayerSourceSpec_ = std::weak_ptr<HybridVideoPlayerSourceSpec>;
inline std__weak_ptr_HybridVideoPlayerSourceSpec_ weakify_std__shared_ptr_HybridVideoPlayerSourceSpec_(const std::shared_ptr<HybridVideoPlayerSourceSpec>& strong) { return strong; } inline std__weak_ptr_HybridVideoPlayerSourceSpec_ weakify_std__shared_ptr_HybridVideoPlayerSourceSpec_(const std::shared_ptr<HybridVideoPlayerSourceSpec>& strong) noexcept { return strong; }
// pragma MARK: std::shared_ptr<HybridVideoPlayerEventEmitterSpec> // pragma MARK: std::shared_ptr<HybridVideoPlayerEventEmitterSpec>
/** /**
* Specialized version of `std::shared_ptr<HybridVideoPlayerEventEmitterSpec>`. * Specialized version of `std::shared_ptr<HybridVideoPlayerEventEmitterSpec>`.
*/ */
using std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ = std::shared_ptr<HybridVideoPlayerEventEmitterSpec>; using std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ = std::shared_ptr<HybridVideoPlayerEventEmitterSpec>;
std::shared_ptr<HybridVideoPlayerEventEmitterSpec> create_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(void* _Nonnull swiftUnsafePointer); std::shared_ptr<HybridVideoPlayerEventEmitterSpec> create_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ cppType); void* NON_NULL get_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ cppType);
// pragma MARK: std::weak_ptr<HybridVideoPlayerEventEmitterSpec> // pragma MARK: std::weak_ptr<HybridVideoPlayerEventEmitterSpec>
using std__weak_ptr_HybridVideoPlayerEventEmitterSpec_ = std::weak_ptr<HybridVideoPlayerEventEmitterSpec>; using std__weak_ptr_HybridVideoPlayerEventEmitterSpec_ = std::weak_ptr<HybridVideoPlayerEventEmitterSpec>;
inline std__weak_ptr_HybridVideoPlayerEventEmitterSpec_ weakify_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(const std::shared_ptr<HybridVideoPlayerEventEmitterSpec>& strong) { return strong; } inline std__weak_ptr_HybridVideoPlayerEventEmitterSpec_ weakify_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(const std::shared_ptr<HybridVideoPlayerEventEmitterSpec>& strong) noexcept { return strong; }
// pragma MARK: std::shared_ptr<Promise<void>> // pragma MARK: std::shared_ptr<Promise<void>>
/** /**
* Specialized version of `std::shared_ptr<Promise<void>>`. * Specialized version of `std::shared_ptr<Promise<void>>`.
*/ */
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>; using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() { inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
return Promise<void>::create(); return Promise<void>::create();
} }
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) { inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
return PromiseHolder<void>(std::move(promise)); return PromiseHolder<void>(std::move(promise));
} }
@@ -171,14 +175,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_Wrapper final { class Func_void_Wrapper final {
public: public:
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {} explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
inline void call() const { inline void call() const noexcept {
_function->operator()(); _function->operator()();
} }
private: private:
std::unique_ptr<std::function<void()>> _function; std::unique_ptr<std::function<void()>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void create_Func_void(void* _Nonnull swiftClosureWrapper); Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_Wrapper wrap_Func_void(Func_void value) { inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
return Func_void_Wrapper(std::move(value)); return Func_void_Wrapper(std::move(value));
} }
@@ -193,14 +197,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_std__exception_ptr_Wrapper final { class Func_void_std__exception_ptr_Wrapper final {
public: public:
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {} explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
inline void call(std::exception_ptr error) const { inline void call(std::exception_ptr error) const noexcept {
_function->operator()(error); _function->operator()(error);
} }
private: private:
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function; std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* _Nonnull swiftClosureWrapper); Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) { inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
return Func_void_std__exception_ptr_Wrapper(std::move(value)); return Func_void_std__exception_ptr_Wrapper(std::move(value));
} }
@@ -209,25 +213,37 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>`. * Specialized version of `std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>`.
*/ */
using std__optional_std__shared_ptr_HybridVideoPlayerSourceSpec__ = std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>; using std__optional_std__shared_ptr_HybridVideoPlayerSourceSpec__ = std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>;
inline std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>> create_std__optional_std__shared_ptr_HybridVideoPlayerSourceSpec__(const std::shared_ptr<HybridVideoPlayerSourceSpec>& value) { inline std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>> create_std__optional_std__shared_ptr_HybridVideoPlayerSourceSpec__(const std::shared_ptr<HybridVideoPlayerSourceSpec>& value) noexcept {
return std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>(value); return std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>(value);
} }
inline bool has_value_std__optional_std__shared_ptr_HybridVideoPlayerSourceSpec__(const std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>& optional) noexcept {
return optional.has_value();
}
inline std::shared_ptr<HybridVideoPlayerSourceSpec> get_std__optional_std__shared_ptr_HybridVideoPlayerSourceSpec__(const std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<std::string> // pragma MARK: std::optional<std::string>
/** /**
* Specialized version of `std::optional<std::string>`. * Specialized version of `std::optional<std::string>`.
*/ */
using std__optional_std__string_ = std::optional<std::string>; using std__optional_std__string_ = std::optional<std::string>;
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) { inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
return std::optional<std::string>(value); return std::optional<std::string>(value);
} }
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
return optional.has_value();
}
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
return *optional;
}
// pragma MARK: std::vector<TextTrack> // pragma MARK: std::vector<TextTrack>
/** /**
* Specialized version of `std::vector<TextTrack>`. * Specialized version of `std::vector<TextTrack>`.
*/ */
using std__vector_TextTrack_ = std::vector<TextTrack>; using std__vector_TextTrack_ = std::vector<TextTrack>;
inline std::vector<TextTrack> create_std__vector_TextTrack_(size_t size) { inline std::vector<TextTrack> create_std__vector_TextTrack_(size_t size) noexcept {
std::vector<TextTrack> vector; std::vector<TextTrack> vector;
vector.reserve(size); vector.reserve(size);
return vector; return vector;
@@ -238,46 +254,52 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::optional<TextTrack>`. * Specialized version of `std::optional<TextTrack>`.
*/ */
using std__optional_TextTrack_ = std::optional<TextTrack>; using std__optional_TextTrack_ = std::optional<TextTrack>;
inline std::optional<TextTrack> create_std__optional_TextTrack_(const TextTrack& value) { inline std::optional<TextTrack> create_std__optional_TextTrack_(const TextTrack& value) noexcept {
return std::optional<TextTrack>(value); return std::optional<TextTrack>(value);
} }
inline bool has_value_std__optional_TextTrack_(const std::optional<TextTrack>& optional) noexcept {
return optional.has_value();
}
inline TextTrack get_std__optional_TextTrack_(const std::optional<TextTrack>& optional) noexcept {
return *optional;
}
// pragma MARK: std::shared_ptr<HybridVideoPlayerSpec> // pragma MARK: std::shared_ptr<HybridVideoPlayerSpec>
/** /**
* Specialized version of `std::shared_ptr<HybridVideoPlayerSpec>`. * Specialized version of `std::shared_ptr<HybridVideoPlayerSpec>`.
*/ */
using std__shared_ptr_HybridVideoPlayerSpec_ = std::shared_ptr<HybridVideoPlayerSpec>; using std__shared_ptr_HybridVideoPlayerSpec_ = std::shared_ptr<HybridVideoPlayerSpec>;
std::shared_ptr<HybridVideoPlayerSpec> create_std__shared_ptr_HybridVideoPlayerSpec_(void* _Nonnull swiftUnsafePointer); std::shared_ptr<HybridVideoPlayerSpec> create_std__shared_ptr_HybridVideoPlayerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSpec_(std__shared_ptr_HybridVideoPlayerSpec_ cppType); void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSpec_(std__shared_ptr_HybridVideoPlayerSpec_ cppType);
// pragma MARK: std::weak_ptr<HybridVideoPlayerSpec> // pragma MARK: std::weak_ptr<HybridVideoPlayerSpec>
using std__weak_ptr_HybridVideoPlayerSpec_ = std::weak_ptr<HybridVideoPlayerSpec>; using std__weak_ptr_HybridVideoPlayerSpec_ = std::weak_ptr<HybridVideoPlayerSpec>;
inline std__weak_ptr_HybridVideoPlayerSpec_ weakify_std__shared_ptr_HybridVideoPlayerSpec_(const std::shared_ptr<HybridVideoPlayerSpec>& strong) { return strong; } inline std__weak_ptr_HybridVideoPlayerSpec_ weakify_std__shared_ptr_HybridVideoPlayerSpec_(const std::shared_ptr<HybridVideoPlayerSpec>& strong) noexcept { return strong; }
// pragma MARK: Result<std::shared_ptr<Promise<void>>> // pragma MARK: Result<std::shared_ptr<Promise<void>>>
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>; using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) { inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
return Result<std::shared_ptr<Promise<void>>>::withValue(value); return Result<std::shared_ptr<Promise<void>>>::withValue(value);
} }
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) { inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
return Result<std::shared_ptr<Promise<void>>>::withError(error); return Result<std::shared_ptr<Promise<void>>>::withError(error);
} }
// pragma MARK: Result<std::vector<TextTrack>> // pragma MARK: Result<std::vector<TextTrack>>
using Result_std__vector_TextTrack__ = Result<std::vector<TextTrack>>; using Result_std__vector_TextTrack__ = Result<std::vector<TextTrack>>;
inline Result_std__vector_TextTrack__ create_Result_std__vector_TextTrack__(const std::vector<TextTrack>& value) { inline Result_std__vector_TextTrack__ create_Result_std__vector_TextTrack__(const std::vector<TextTrack>& value) noexcept {
return Result<std::vector<TextTrack>>::withValue(value); return Result<std::vector<TextTrack>>::withValue(value);
} }
inline Result_std__vector_TextTrack__ create_Result_std__vector_TextTrack__(const std::exception_ptr& error) { inline Result_std__vector_TextTrack__ create_Result_std__vector_TextTrack__(const std::exception_ptr& error) noexcept {
return Result<std::vector<TextTrack>>::withError(error); return Result<std::vector<TextTrack>>::withError(error);
} }
// pragma MARK: Result<void> // pragma MARK: Result<void>
using Result_void_ = Result<void>; using Result_void_ = Result<void>;
inline Result_void_ create_Result_void_() { inline Result_void_ create_Result_void_() noexcept {
return Result<void>::withValue(); return Result<void>::withValue();
} }
inline Result_void_ create_Result_void_(const std::exception_ptr& error) { inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
return Result<void>::withError(error); return Result<void>::withError(error);
} }
@@ -286,19 +308,19 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::shared_ptr<HybridVideoPlayerFactorySpec>`. * Specialized version of `std::shared_ptr<HybridVideoPlayerFactorySpec>`.
*/ */
using std__shared_ptr_HybridVideoPlayerFactorySpec_ = std::shared_ptr<HybridVideoPlayerFactorySpec>; using std__shared_ptr_HybridVideoPlayerFactorySpec_ = std::shared_ptr<HybridVideoPlayerFactorySpec>;
std::shared_ptr<HybridVideoPlayerFactorySpec> create_std__shared_ptr_HybridVideoPlayerFactorySpec_(void* _Nonnull swiftUnsafePointer); std::shared_ptr<HybridVideoPlayerFactorySpec> create_std__shared_ptr_HybridVideoPlayerFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept;
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerFactorySpec_(std__shared_ptr_HybridVideoPlayerFactorySpec_ cppType); void* NON_NULL get_std__shared_ptr_HybridVideoPlayerFactorySpec_(std__shared_ptr_HybridVideoPlayerFactorySpec_ cppType);
// pragma MARK: std::weak_ptr<HybridVideoPlayerFactorySpec> // pragma MARK: std::weak_ptr<HybridVideoPlayerFactorySpec>
using std__weak_ptr_HybridVideoPlayerFactorySpec_ = std::weak_ptr<HybridVideoPlayerFactorySpec>; using std__weak_ptr_HybridVideoPlayerFactorySpec_ = std::weak_ptr<HybridVideoPlayerFactorySpec>;
inline std__weak_ptr_HybridVideoPlayerFactorySpec_ weakify_std__shared_ptr_HybridVideoPlayerFactorySpec_(const std::shared_ptr<HybridVideoPlayerFactorySpec>& strong) { return strong; } inline std__weak_ptr_HybridVideoPlayerFactorySpec_ weakify_std__shared_ptr_HybridVideoPlayerFactorySpec_(const std::shared_ptr<HybridVideoPlayerFactorySpec>& strong) noexcept { return strong; }
// pragma MARK: Result<std::shared_ptr<HybridVideoPlayerSpec>> // pragma MARK: Result<std::shared_ptr<HybridVideoPlayerSpec>>
using Result_std__shared_ptr_HybridVideoPlayerSpec__ = Result<std::shared_ptr<HybridVideoPlayerSpec>>; using Result_std__shared_ptr_HybridVideoPlayerSpec__ = Result<std::shared_ptr<HybridVideoPlayerSpec>>;
inline Result_std__shared_ptr_HybridVideoPlayerSpec__ create_Result_std__shared_ptr_HybridVideoPlayerSpec__(const std::shared_ptr<HybridVideoPlayerSpec>& value) { inline Result_std__shared_ptr_HybridVideoPlayerSpec__ create_Result_std__shared_ptr_HybridVideoPlayerSpec__(const std::shared_ptr<HybridVideoPlayerSpec>& value) noexcept {
return Result<std::shared_ptr<HybridVideoPlayerSpec>>::withValue(value); return Result<std::shared_ptr<HybridVideoPlayerSpec>>::withValue(value);
} }
inline Result_std__shared_ptr_HybridVideoPlayerSpec__ create_Result_std__shared_ptr_HybridVideoPlayerSpec__(const std::exception_ptr& error) { inline Result_std__shared_ptr_HybridVideoPlayerSpec__ create_Result_std__shared_ptr_HybridVideoPlayerSpec__(const std::exception_ptr& error) noexcept {
return Result<std::shared_ptr<HybridVideoPlayerSpec>>::withError(error); return Result<std::shared_ptr<HybridVideoPlayerSpec>>::withError(error);
} }
@@ -313,14 +335,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_bool_Wrapper final { class Func_void_bool_Wrapper final {
public: public:
explicit Func_void_bool_Wrapper(std::function<void(bool /* hasAudioFocus */)>&& func): _function(std::make_unique<std::function<void(bool /* hasAudioFocus */)>>(std::move(func))) {} explicit Func_void_bool_Wrapper(std::function<void(bool /* hasAudioFocus */)>&& func): _function(std::make_unique<std::function<void(bool /* hasAudioFocus */)>>(std::move(func))) {}
inline void call(bool hasAudioFocus) const { inline void call(bool hasAudioFocus) const noexcept {
_function->operator()(hasAudioFocus); _function->operator()(hasAudioFocus);
} }
private: private:
std::unique_ptr<std::function<void(bool /* hasAudioFocus */)>> _function; std::unique_ptr<std::function<void(bool /* hasAudioFocus */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_bool create_Func_void_bool(void* _Nonnull swiftClosureWrapper); Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) { inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
return Func_void_bool_Wrapper(std::move(value)); return Func_void_bool_Wrapper(std::move(value));
} }
@@ -329,9 +351,15 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::optional<double>`. * Specialized version of `std::optional<double>`.
*/ */
using std__optional_double_ = std::optional<double>; using std__optional_double_ = std::optional<double>;
inline std::optional<double> create_std__optional_double_(const double& value) { inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
return std::optional<double>(value); return std::optional<double>(value);
} }
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
return optional.has_value();
}
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
return *optional;
}
// pragma MARK: std::function<void(const BandwidthData& /* data */)> // pragma MARK: std::function<void(const BandwidthData& /* data */)>
/** /**
@@ -344,14 +372,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_BandwidthData_Wrapper final { class Func_void_BandwidthData_Wrapper final {
public: public:
explicit Func_void_BandwidthData_Wrapper(std::function<void(const BandwidthData& /* data */)>&& func): _function(std::make_unique<std::function<void(const BandwidthData& /* data */)>>(std::move(func))) {} explicit Func_void_BandwidthData_Wrapper(std::function<void(const BandwidthData& /* data */)>&& func): _function(std::make_unique<std::function<void(const BandwidthData& /* data */)>>(std::move(func))) {}
inline void call(BandwidthData data) const { inline void call(BandwidthData data) const noexcept {
_function->operator()(data); _function->operator()(data);
} }
private: private:
std::unique_ptr<std::function<void(const BandwidthData& /* data */)>> _function; std::unique_ptr<std::function<void(const BandwidthData& /* data */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_BandwidthData create_Func_void_BandwidthData(void* _Nonnull swiftClosureWrapper); Func_void_BandwidthData create_Func_void_BandwidthData(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_BandwidthData_Wrapper wrap_Func_void_BandwidthData(Func_void_BandwidthData value) { inline Func_void_BandwidthData_Wrapper wrap_Func_void_BandwidthData(Func_void_BandwidthData value) noexcept {
return Func_void_BandwidthData_Wrapper(std::move(value)); return Func_void_BandwidthData_Wrapper(std::move(value));
} }
@@ -366,14 +394,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_onLoadData_Wrapper final { class Func_void_onLoadData_Wrapper final {
public: public:
explicit Func_void_onLoadData_Wrapper(std::function<void(const onLoadData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onLoadData& /* data */)>>(std::move(func))) {} explicit Func_void_onLoadData_Wrapper(std::function<void(const onLoadData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onLoadData& /* data */)>>(std::move(func))) {}
inline void call(onLoadData data) const { inline void call(onLoadData data) const noexcept {
_function->operator()(data); _function->operator()(data);
} }
private: private:
std::unique_ptr<std::function<void(const onLoadData& /* data */)>> _function; std::unique_ptr<std::function<void(const onLoadData& /* data */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_onLoadData create_Func_void_onLoadData(void* _Nonnull swiftClosureWrapper); Func_void_onLoadData create_Func_void_onLoadData(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_onLoadData_Wrapper wrap_Func_void_onLoadData(Func_void_onLoadData value) { inline Func_void_onLoadData_Wrapper wrap_Func_void_onLoadData(Func_void_onLoadData value) noexcept {
return Func_void_onLoadData_Wrapper(std::move(value)); return Func_void_onLoadData_Wrapper(std::move(value));
} }
@@ -388,14 +416,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_onLoadStartData_Wrapper final { class Func_void_onLoadStartData_Wrapper final {
public: public:
explicit Func_void_onLoadStartData_Wrapper(std::function<void(const onLoadStartData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onLoadStartData& /* data */)>>(std::move(func))) {} explicit Func_void_onLoadStartData_Wrapper(std::function<void(const onLoadStartData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onLoadStartData& /* data */)>>(std::move(func))) {}
inline void call(onLoadStartData data) const { inline void call(onLoadStartData data) const noexcept {
_function->operator()(data); _function->operator()(data);
} }
private: private:
std::unique_ptr<std::function<void(const onLoadStartData& /* data */)>> _function; std::unique_ptr<std::function<void(const onLoadStartData& /* data */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_onLoadStartData create_Func_void_onLoadStartData(void* _Nonnull swiftClosureWrapper); Func_void_onLoadStartData create_Func_void_onLoadStartData(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_onLoadStartData_Wrapper wrap_Func_void_onLoadStartData(Func_void_onLoadStartData value) { inline Func_void_onLoadStartData_Wrapper wrap_Func_void_onLoadStartData(Func_void_onLoadStartData value) noexcept {
return Func_void_onLoadStartData_Wrapper(std::move(value)); return Func_void_onLoadStartData_Wrapper(std::move(value));
} }
@@ -410,14 +438,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_onPlaybackStateChangeData_Wrapper final { class Func_void_onPlaybackStateChangeData_Wrapper final {
public: public:
explicit Func_void_onPlaybackStateChangeData_Wrapper(std::function<void(const onPlaybackStateChangeData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onPlaybackStateChangeData& /* data */)>>(std::move(func))) {} explicit Func_void_onPlaybackStateChangeData_Wrapper(std::function<void(const onPlaybackStateChangeData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onPlaybackStateChangeData& /* data */)>>(std::move(func))) {}
inline void call(onPlaybackStateChangeData data) const { inline void call(onPlaybackStateChangeData data) const noexcept {
_function->operator()(data); _function->operator()(data);
} }
private: private:
std::unique_ptr<std::function<void(const onPlaybackStateChangeData& /* data */)>> _function; std::unique_ptr<std::function<void(const onPlaybackStateChangeData& /* data */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_onPlaybackStateChangeData create_Func_void_onPlaybackStateChangeData(void* _Nonnull swiftClosureWrapper); Func_void_onPlaybackStateChangeData create_Func_void_onPlaybackStateChangeData(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_onPlaybackStateChangeData_Wrapper wrap_Func_void_onPlaybackStateChangeData(Func_void_onPlaybackStateChangeData value) { inline Func_void_onPlaybackStateChangeData_Wrapper wrap_Func_void_onPlaybackStateChangeData(Func_void_onPlaybackStateChangeData value) noexcept {
return Func_void_onPlaybackStateChangeData_Wrapper(std::move(value)); return Func_void_onPlaybackStateChangeData_Wrapper(std::move(value));
} }
@@ -432,14 +460,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_double_Wrapper final { class Func_void_double_Wrapper final {
public: public:
explicit Func_void_double_Wrapper(std::function<void(double /* rate */)>&& func): _function(std::make_unique<std::function<void(double /* rate */)>>(std::move(func))) {} explicit Func_void_double_Wrapper(std::function<void(double /* rate */)>&& func): _function(std::make_unique<std::function<void(double /* rate */)>>(std::move(func))) {}
inline void call(double rate) const { inline void call(double rate) const noexcept {
_function->operator()(rate); _function->operator()(rate);
} }
private: private:
std::unique_ptr<std::function<void(double /* rate */)>> _function; std::unique_ptr<std::function<void(double /* rate */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_double create_Func_void_double(void* _Nonnull swiftClosureWrapper); Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) { inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) noexcept {
return Func_void_double_Wrapper(std::move(value)); return Func_void_double_Wrapper(std::move(value));
} }
@@ -454,14 +482,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_onProgressData_Wrapper final { class Func_void_onProgressData_Wrapper final {
public: public:
explicit Func_void_onProgressData_Wrapper(std::function<void(const onProgressData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onProgressData& /* data */)>>(std::move(func))) {} explicit Func_void_onProgressData_Wrapper(std::function<void(const onProgressData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onProgressData& /* data */)>>(std::move(func))) {}
inline void call(onProgressData data) const { inline void call(onProgressData data) const noexcept {
_function->operator()(data); _function->operator()(data);
} }
private: private:
std::unique_ptr<std::function<void(const onProgressData& /* data */)>> _function; std::unique_ptr<std::function<void(const onProgressData& /* data */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_onProgressData create_Func_void_onProgressData(void* _Nonnull swiftClosureWrapper); Func_void_onProgressData create_Func_void_onProgressData(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_onProgressData_Wrapper wrap_Func_void_onProgressData(Func_void_onProgressData value) { inline Func_void_onProgressData_Wrapper wrap_Func_void_onProgressData(Func_void_onProgressData value) noexcept {
return Func_void_onProgressData_Wrapper(std::move(value)); return Func_void_onProgressData_Wrapper(std::move(value));
} }
@@ -470,7 +498,7 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::vector<TimedMetadataObject>`. * Specialized version of `std::vector<TimedMetadataObject>`.
*/ */
using std__vector_TimedMetadataObject_ = std::vector<TimedMetadataObject>; using std__vector_TimedMetadataObject_ = std::vector<TimedMetadataObject>;
inline std::vector<TimedMetadataObject> create_std__vector_TimedMetadataObject_(size_t size) { inline std::vector<TimedMetadataObject> create_std__vector_TimedMetadataObject_(size_t size) noexcept {
std::vector<TimedMetadataObject> vector; std::vector<TimedMetadataObject> vector;
vector.reserve(size); vector.reserve(size);
return vector; return vector;
@@ -487,14 +515,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_TimedMetadata_Wrapper final { class Func_void_TimedMetadata_Wrapper final {
public: public:
explicit Func_void_TimedMetadata_Wrapper(std::function<void(const TimedMetadata& /* metadata */)>&& func): _function(std::make_unique<std::function<void(const TimedMetadata& /* metadata */)>>(std::move(func))) {} explicit Func_void_TimedMetadata_Wrapper(std::function<void(const TimedMetadata& /* metadata */)>&& func): _function(std::make_unique<std::function<void(const TimedMetadata& /* metadata */)>>(std::move(func))) {}
inline void call(TimedMetadata metadata) const { inline void call(TimedMetadata metadata) const noexcept {
_function->operator()(metadata); _function->operator()(metadata);
} }
private: private:
std::unique_ptr<std::function<void(const TimedMetadata& /* metadata */)>> _function; std::unique_ptr<std::function<void(const TimedMetadata& /* metadata */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_TimedMetadata create_Func_void_TimedMetadata(void* _Nonnull swiftClosureWrapper); Func_void_TimedMetadata create_Func_void_TimedMetadata(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_TimedMetadata_Wrapper wrap_Func_void_TimedMetadata(Func_void_TimedMetadata value) { inline Func_void_TimedMetadata_Wrapper wrap_Func_void_TimedMetadata(Func_void_TimedMetadata value) noexcept {
return Func_void_TimedMetadata_Wrapper(std::move(value)); return Func_void_TimedMetadata_Wrapper(std::move(value));
} }
@@ -503,7 +531,7 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::vector<std::string>`. * Specialized version of `std::vector<std::string>`.
*/ */
using std__vector_std__string_ = std::vector<std::string>; using std__vector_std__string_ = std::vector<std::string>;
inline std::vector<std::string> create_std__vector_std__string_(size_t size) { inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
std::vector<std::string> vector; std::vector<std::string> vector;
vector.reserve(size); vector.reserve(size);
return vector; return vector;
@@ -520,14 +548,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_std__vector_std__string__Wrapper final { class Func_void_std__vector_std__string__Wrapper final {
public: public:
explicit Func_void_std__vector_std__string__Wrapper(std::function<void(const std::vector<std::string>& /* texts */)>&& func): _function(std::make_unique<std::function<void(const std::vector<std::string>& /* texts */)>>(std::move(func))) {} explicit Func_void_std__vector_std__string__Wrapper(std::function<void(const std::vector<std::string>& /* texts */)>&& func): _function(std::make_unique<std::function<void(const std::vector<std::string>& /* texts */)>>(std::move(func))) {}
inline void call(std::vector<std::string> texts) const { inline void call(std::vector<std::string> texts) const noexcept {
_function->operator()(texts); _function->operator()(texts);
} }
private: private:
std::unique_ptr<std::function<void(const std::vector<std::string>& /* texts */)>> _function; std::unique_ptr<std::function<void(const std::vector<std::string>& /* texts */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* _Nonnull swiftClosureWrapper); Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_std__vector_std__string__Wrapper wrap_Func_void_std__vector_std__string_(Func_void_std__vector_std__string_ value) { inline Func_void_std__vector_std__string__Wrapper wrap_Func_void_std__vector_std__string_(Func_void_std__vector_std__string_ value) noexcept {
return Func_void_std__vector_std__string__Wrapper(std::move(value)); return Func_void_std__vector_std__string__Wrapper(std::move(value));
} }
@@ -542,14 +570,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_std__optional_TextTrack__Wrapper final { class Func_void_std__optional_TextTrack__Wrapper final {
public: public:
explicit Func_void_std__optional_TextTrack__Wrapper(std::function<void(const std::optional<TextTrack>& /* track */)>&& func): _function(std::make_unique<std::function<void(const std::optional<TextTrack>& /* track */)>>(std::move(func))) {} explicit Func_void_std__optional_TextTrack__Wrapper(std::function<void(const std::optional<TextTrack>& /* track */)>&& func): _function(std::make_unique<std::function<void(const std::optional<TextTrack>& /* track */)>>(std::move(func))) {}
inline void call(std::optional<TextTrack> track) const { inline void call(std::optional<TextTrack> track) const noexcept {
_function->operator()(track); _function->operator()(track);
} }
private: private:
std::unique_ptr<std::function<void(const std::optional<TextTrack>& /* track */)>> _function; std::unique_ptr<std::function<void(const std::optional<TextTrack>& /* track */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_std__optional_TextTrack_ create_Func_void_std__optional_TextTrack_(void* _Nonnull swiftClosureWrapper); Func_void_std__optional_TextTrack_ create_Func_void_std__optional_TextTrack_(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_std__optional_TextTrack__Wrapper wrap_Func_void_std__optional_TextTrack_(Func_void_std__optional_TextTrack_ value) { inline Func_void_std__optional_TextTrack__Wrapper wrap_Func_void_std__optional_TextTrack_(Func_void_std__optional_TextTrack_ value) noexcept {
return Func_void_std__optional_TextTrack__Wrapper(std::move(value)); return Func_void_std__optional_TextTrack__Wrapper(std::move(value));
} }
@@ -564,14 +592,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_onVolumeChangeData_Wrapper final { class Func_void_onVolumeChangeData_Wrapper final {
public: public:
explicit Func_void_onVolumeChangeData_Wrapper(std::function<void(const onVolumeChangeData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onVolumeChangeData& /* data */)>>(std::move(func))) {} explicit Func_void_onVolumeChangeData_Wrapper(std::function<void(const onVolumeChangeData& /* data */)>&& func): _function(std::make_unique<std::function<void(const onVolumeChangeData& /* data */)>>(std::move(func))) {}
inline void call(onVolumeChangeData data) const { inline void call(onVolumeChangeData data) const noexcept {
_function->operator()(data); _function->operator()(data);
} }
private: private:
std::unique_ptr<std::function<void(const onVolumeChangeData& /* data */)>> _function; std::unique_ptr<std::function<void(const onVolumeChangeData& /* data */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_onVolumeChangeData create_Func_void_onVolumeChangeData(void* _Nonnull swiftClosureWrapper); Func_void_onVolumeChangeData create_Func_void_onVolumeChangeData(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_onVolumeChangeData_Wrapper wrap_Func_void_onVolumeChangeData(Func_void_onVolumeChangeData value) { inline Func_void_onVolumeChangeData_Wrapper wrap_Func_void_onVolumeChangeData(Func_void_onVolumeChangeData value) noexcept {
return Func_void_onVolumeChangeData_Wrapper(std::move(value)); return Func_void_onVolumeChangeData_Wrapper(std::move(value));
} }
@@ -586,14 +614,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_VideoPlayerStatus_Wrapper final { class Func_void_VideoPlayerStatus_Wrapper final {
public: public:
explicit Func_void_VideoPlayerStatus_Wrapper(std::function<void(VideoPlayerStatus /* status */)>&& func): _function(std::make_unique<std::function<void(VideoPlayerStatus /* status */)>>(std::move(func))) {} explicit Func_void_VideoPlayerStatus_Wrapper(std::function<void(VideoPlayerStatus /* status */)>&& func): _function(std::make_unique<std::function<void(VideoPlayerStatus /* status */)>>(std::move(func))) {}
inline void call(int status) const { inline void call(int status) const noexcept {
_function->operator()(static_cast<VideoPlayerStatus>(status)); _function->operator()(static_cast<VideoPlayerStatus>(status));
} }
private: private:
std::unique_ptr<std::function<void(VideoPlayerStatus /* status */)>> _function; std::unique_ptr<std::function<void(VideoPlayerStatus /* status */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_VideoPlayerStatus create_Func_void_VideoPlayerStatus(void* _Nonnull swiftClosureWrapper); Func_void_VideoPlayerStatus create_Func_void_VideoPlayerStatus(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_VideoPlayerStatus_Wrapper wrap_Func_void_VideoPlayerStatus(Func_void_VideoPlayerStatus value) { inline Func_void_VideoPlayerStatus_Wrapper wrap_Func_void_VideoPlayerStatus(Func_void_VideoPlayerStatus value) noexcept {
return Func_void_VideoPlayerStatus_Wrapper(std::move(value)); return Func_void_VideoPlayerStatus_Wrapper(std::move(value));
} }
@@ -602,7 +630,7 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::vector<NativeExternalSubtitle>`. * Specialized version of `std::vector<NativeExternalSubtitle>`.
*/ */
using std__vector_NativeExternalSubtitle_ = std::vector<NativeExternalSubtitle>; using std__vector_NativeExternalSubtitle_ = std::vector<NativeExternalSubtitle>;
inline std::vector<NativeExternalSubtitle> create_std__vector_NativeExternalSubtitle_(size_t size) { inline std::vector<NativeExternalSubtitle> create_std__vector_NativeExternalSubtitle_(size_t size) noexcept {
std::vector<NativeExternalSubtitle> vector; std::vector<NativeExternalSubtitle> vector;
vector.reserve(size); vector.reserve(size);
return vector; return vector;
@@ -613,21 +641,27 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::optional<std::vector<NativeExternalSubtitle>>`. * Specialized version of `std::optional<std::vector<NativeExternalSubtitle>>`.
*/ */
using std__optional_std__vector_NativeExternalSubtitle__ = std::optional<std::vector<NativeExternalSubtitle>>; using std__optional_std__vector_NativeExternalSubtitle__ = std::optional<std::vector<NativeExternalSubtitle>>;
inline std::optional<std::vector<NativeExternalSubtitle>> create_std__optional_std__vector_NativeExternalSubtitle__(const std::vector<NativeExternalSubtitle>& value) { inline std::optional<std::vector<NativeExternalSubtitle>> create_std__optional_std__vector_NativeExternalSubtitle__(const std::vector<NativeExternalSubtitle>& value) noexcept {
return std::optional<std::vector<NativeExternalSubtitle>>(value); return std::optional<std::vector<NativeExternalSubtitle>>(value);
} }
inline bool has_value_std__optional_std__vector_NativeExternalSubtitle__(const std::optional<std::vector<NativeExternalSubtitle>>& optional) noexcept {
return optional.has_value();
}
inline std::vector<NativeExternalSubtitle> get_std__optional_std__vector_NativeExternalSubtitle__(const std::optional<std::vector<NativeExternalSubtitle>>& optional) noexcept {
return *optional;
}
// pragma MARK: std::unordered_map<std::string, std::string> // pragma MARK: std::unordered_map<std::string, std::string>
/** /**
* Specialized version of `std::unordered_map<std::string, std::string>`. * Specialized version of `std::unordered_map<std::string, std::string>`.
*/ */
using std__unordered_map_std__string__std__string_ = std::unordered_map<std::string, std::string>; using std__unordered_map_std__string__std__string_ = std::unordered_map<std::string, std::string>;
inline std::unordered_map<std::string, std::string> create_std__unordered_map_std__string__std__string_(size_t size) { inline std::unordered_map<std::string, std::string> create_std__unordered_map_std__string__std__string_(size_t size) noexcept {
std::unordered_map<std::string, std::string> map; std::unordered_map<std::string, std::string> map;
map.reserve(size); map.reserve(size);
return map; return map;
} }
inline std::vector<std::string> get_std__unordered_map_std__string__std__string__keys(const std__unordered_map_std__string__std__string_& map) { inline std::vector<std::string> get_std__unordered_map_std__string__std__string__keys(const std__unordered_map_std__string__std__string_& map) noexcept {
std::vector<std::string> keys; std::vector<std::string> keys;
keys.reserve(map.size()); keys.reserve(map.size());
for (const auto& entry : map) { for (const auto& entry : map) {
@@ -635,10 +669,10 @@ namespace margelo::nitro::video::bridge::swift {
} }
return keys; return keys;
} }
inline std::string get_std__unordered_map_std__string__std__string__value(const std__unordered_map_std__string__std__string_& map, const std::string& key) { inline std::string get_std__unordered_map_std__string__std__string__value(const std__unordered_map_std__string__std__string_& map, const std::string& key) noexcept {
return map.at(key); return map.find(key)->second;
} }
inline void emplace_std__unordered_map_std__string__std__string_(std__unordered_map_std__string__std__string_& map, const std::string& key, const std::string& value) { inline void emplace_std__unordered_map_std__string__std__string_(std__unordered_map_std__string__std__string_& map, const std::string& key, const std::string& value) noexcept {
map.emplace(key, value); map.emplace(key, value);
} }
@@ -647,28 +681,40 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::optional<std::unordered_map<std::string, std::string>>`. * Specialized version of `std::optional<std::unordered_map<std::string, std::string>>`.
*/ */
using std__optional_std__unordered_map_std__string__std__string__ = std::optional<std::unordered_map<std::string, std::string>>; using std__optional_std__unordered_map_std__string__std__string__ = std::optional<std::unordered_map<std::string, std::string>>;
inline std::optional<std::unordered_map<std::string, std::string>> create_std__optional_std__unordered_map_std__string__std__string__(const std::unordered_map<std::string, std::string>& value) { inline std::optional<std::unordered_map<std::string, std::string>> create_std__optional_std__unordered_map_std__string__std__string__(const std::unordered_map<std::string, std::string>& value) noexcept {
return std::optional<std::unordered_map<std::string, std::string>>(value); return std::optional<std::unordered_map<std::string, std::string>>(value);
} }
inline bool has_value_std__optional_std__unordered_map_std__string__std__string__(const std::optional<std::unordered_map<std::string, std::string>>& optional) noexcept {
return optional.has_value();
}
inline std::unordered_map<std::string, std::string> get_std__optional_std__unordered_map_std__string__std__string__(const std::optional<std::unordered_map<std::string, std::string>>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<bool> // pragma MARK: std::optional<bool>
/** /**
* Specialized version of `std::optional<bool>`. * Specialized version of `std::optional<bool>`.
*/ */
using std__optional_bool_ = std::optional<bool>; using std__optional_bool_ = std::optional<bool>;
inline std::optional<bool> create_std__optional_bool_(const bool& value) { inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
return std::optional<bool>(value); return std::optional<bool>(value);
} }
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
return optional.has_value();
}
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
return *optional;
}
// pragma MARK: std::shared_ptr<Promise<std::string>> // pragma MARK: std::shared_ptr<Promise<std::string>>
/** /**
* Specialized version of `std::shared_ptr<Promise<std::string>>`. * Specialized version of `std::shared_ptr<Promise<std::string>>`.
*/ */
using std__shared_ptr_Promise_std__string__ = std::shared_ptr<Promise<std::string>>; using std__shared_ptr_Promise_std__string__ = std::shared_ptr<Promise<std::string>>;
inline std::shared_ptr<Promise<std::string>> create_std__shared_ptr_Promise_std__string__() { inline std::shared_ptr<Promise<std::string>> create_std__shared_ptr_Promise_std__string__() noexcept {
return Promise<std::string>::create(); return Promise<std::string>::create();
} }
inline PromiseHolder<std::string> wrap_std__shared_ptr_Promise_std__string__(std::shared_ptr<Promise<std::string>> promise) { inline PromiseHolder<std::string> wrap_std__shared_ptr_Promise_std__string__(std::shared_ptr<Promise<std::string>> promise) noexcept {
return PromiseHolder<std::string>(std::move(promise)); return PromiseHolder<std::string>(std::move(promise));
} }
@@ -683,14 +729,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_std__string_Wrapper final { class Func_void_std__string_Wrapper final {
public: public:
explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* result */)>>(std::move(func))) {} explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* result */)>>(std::move(func))) {}
inline void call(std::string result) const { inline void call(std::string result) const noexcept {
_function->operator()(result); _function->operator()(result);
} }
private: private:
std::unique_ptr<std::function<void(const std::string& /* result */)>> _function; std::unique_ptr<std::function<void(const std::string& /* result */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_std__string create_Func_void_std__string(void* _Nonnull swiftClosureWrapper); Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) { inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
return Func_void_std__string_Wrapper(std::move(value)); return Func_void_std__string_Wrapper(std::move(value));
} }
@@ -705,15 +751,15 @@ namespace margelo::nitro::video::bridge::swift {
class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_Wrapper final { class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_Wrapper final {
public: public:
explicit Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_Wrapper(std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>&& func): _function(std::make_unique<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>>(std::move(func))) {} explicit Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_Wrapper(std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>&& func): _function(std::make_unique<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>>(std::move(func))) {}
inline std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> call(OnGetLicensePayload payload) const { inline std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> call(OnGetLicensePayload payload) const noexcept {
auto __result = _function->operator()(payload); auto __result = _function->operator()(payload);
return __result; return __result;
} }
private: private:
std::unique_ptr<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>> _function; std::unique_ptr<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload(void* _Nonnull swiftClosureWrapper); Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_Wrapper wrap_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload(Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload value) { inline Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_Wrapper wrap_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload(Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload value) noexcept {
return Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_Wrapper(std::move(value)); return Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload_Wrapper(std::move(value));
} }
@@ -722,10 +768,10 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>`. * Specialized version of `std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>`.
*/ */
using std__shared_ptr_Promise_std__shared_ptr_Promise_std__string____ = std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>; using std__shared_ptr_Promise_std__shared_ptr_Promise_std__string____ = std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>;
inline std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> create_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string____() { inline std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> create_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string____() noexcept {
return Promise<std::shared_ptr<Promise<std::string>>>::create(); return Promise<std::shared_ptr<Promise<std::string>>>::create();
} }
inline PromiseHolder<std::shared_ptr<Promise<std::string>>> wrap_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string____(std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> promise) { inline PromiseHolder<std::shared_ptr<Promise<std::string>>> wrap_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string____(std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> promise) noexcept {
return PromiseHolder<std::shared_ptr<Promise<std::string>>>(std::move(promise)); return PromiseHolder<std::shared_ptr<Promise<std::string>>>(std::move(promise));
} }
@@ -740,14 +786,14 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_std__shared_ptr_Promise_std__string___Wrapper final { class Func_void_std__shared_ptr_Promise_std__string___Wrapper final {
public: public:
explicit Func_void_std__shared_ptr_Promise_std__string___Wrapper(std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)>>(std::move(func))) {} explicit Func_void_std__shared_ptr_Promise_std__string___Wrapper(std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)>>(std::move(func))) {}
inline void call(std::shared_ptr<Promise<std::string>> result) const { inline void call(std::shared_ptr<Promise<std::string>> result) const noexcept {
_function->operator()(result); _function->operator()(result);
} }
private: private:
std::unique_ptr<std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)>> _function; std::unique_ptr<std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_std__shared_ptr_Promise_std__string__ create_Func_void_std__shared_ptr_Promise_std__string__(void* _Nonnull swiftClosureWrapper); Func_void_std__shared_ptr_Promise_std__string__ create_Func_void_std__shared_ptr_Promise_std__string__(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_std__shared_ptr_Promise_std__string___Wrapper wrap_Func_void_std__shared_ptr_Promise_std__string__(Func_void_std__shared_ptr_Promise_std__string__ value) { inline Func_void_std__shared_ptr_Promise_std__string___Wrapper wrap_Func_void_std__shared_ptr_Promise_std__string__(Func_void_std__shared_ptr_Promise_std__string__ value) noexcept {
return Func_void_std__shared_ptr_Promise_std__string___Wrapper(std::move(value)); return Func_void_std__shared_ptr_Promise_std__string___Wrapper(std::move(value));
} }
@@ -756,55 +802,100 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& / * payload * /)>>`. * Specialized version of `std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& / * payload * /)>>`.
*/ */
using std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____const_OnGetLicensePayload_____payload______ = std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>>; using std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____const_OnGetLicensePayload_____payload______ = std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>>;
inline std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>> create_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____const_OnGetLicensePayload_____payload______(const std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>& value) { inline std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>> create_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____const_OnGetLicensePayload_____payload______(const std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>& value) noexcept {
return std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>>(value); return std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>>(value);
} }
inline bool has_value_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____const_OnGetLicensePayload_____payload______(const std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>>& optional) noexcept {
return optional.has_value();
}
inline std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)> get_std__optional_std__function_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____const_OnGetLicensePayload_____payload______(const std::optional<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<NativeDrmParams> // pragma MARK: std::optional<NativeDrmParams>
/** /**
* Specialized version of `std::optional<NativeDrmParams>`. * Specialized version of `std::optional<NativeDrmParams>`.
*/ */
using std__optional_NativeDrmParams_ = std::optional<NativeDrmParams>; using std__optional_NativeDrmParams_ = std::optional<NativeDrmParams>;
inline std::optional<NativeDrmParams> create_std__optional_NativeDrmParams_(const NativeDrmParams& value) { inline std::optional<NativeDrmParams> create_std__optional_NativeDrmParams_(const NativeDrmParams& value) noexcept {
return std::optional<NativeDrmParams>(value); return std::optional<NativeDrmParams>(value);
} }
inline bool has_value_std__optional_NativeDrmParams_(const std::optional<NativeDrmParams>& optional) noexcept {
return optional.has_value();
}
inline NativeDrmParams get_std__optional_NativeDrmParams_(const std::optional<NativeDrmParams>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<LivePlaybackParams> // pragma MARK: std::optional<LivePlaybackParams>
/** /**
* Specialized version of `std::optional<LivePlaybackParams>`. * Specialized version of `std::optional<LivePlaybackParams>`.
*/ */
using std__optional_LivePlaybackParams_ = std::optional<LivePlaybackParams>; using std__optional_LivePlaybackParams_ = std::optional<LivePlaybackParams>;
inline std::optional<LivePlaybackParams> create_std__optional_LivePlaybackParams_(const LivePlaybackParams& value) { inline std::optional<LivePlaybackParams> create_std__optional_LivePlaybackParams_(const LivePlaybackParams& value) noexcept {
return std::optional<LivePlaybackParams>(value); return std::optional<LivePlaybackParams>(value);
} }
inline bool has_value_std__optional_LivePlaybackParams_(const std::optional<LivePlaybackParams>& optional) noexcept {
return optional.has_value();
}
inline LivePlaybackParams get_std__optional_LivePlaybackParams_(const std::optional<LivePlaybackParams>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<Resolution> // pragma MARK: std::optional<Resolution>
/** /**
* Specialized version of `std::optional<Resolution>`. * Specialized version of `std::optional<Resolution>`.
*/ */
using std__optional_Resolution_ = std::optional<Resolution>; using std__optional_Resolution_ = std::optional<Resolution>;
inline std::optional<Resolution> create_std__optional_Resolution_(const Resolution& value) { inline std::optional<Resolution> create_std__optional_Resolution_(const Resolution& value) noexcept {
return std::optional<Resolution>(value); return std::optional<Resolution>(value);
} }
inline bool has_value_std__optional_Resolution_(const std::optional<Resolution>& optional) noexcept {
return optional.has_value();
}
inline Resolution get_std__optional_Resolution_(const std::optional<Resolution>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<BufferConfig> // pragma MARK: std::optional<BufferConfig>
/** /**
* Specialized version of `std::optional<BufferConfig>`. * Specialized version of `std::optional<BufferConfig>`.
*/ */
using std__optional_BufferConfig_ = std::optional<BufferConfig>; using std__optional_BufferConfig_ = std::optional<BufferConfig>;
inline std::optional<BufferConfig> create_std__optional_BufferConfig_(const BufferConfig& value) { inline std::optional<BufferConfig> create_std__optional_BufferConfig_(const BufferConfig& value) noexcept {
return std::optional<BufferConfig>(value); return std::optional<BufferConfig>(value);
} }
inline bool has_value_std__optional_BufferConfig_(const std::optional<BufferConfig>& optional) noexcept {
return optional.has_value();
}
inline BufferConfig get_std__optional_BufferConfig_(const std::optional<BufferConfig>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<CustomVideoMetadata>
/**
* Specialized version of `std::optional<CustomVideoMetadata>`.
*/
using std__optional_CustomVideoMetadata_ = std::optional<CustomVideoMetadata>;
inline std::optional<CustomVideoMetadata> create_std__optional_CustomVideoMetadata_(const CustomVideoMetadata& value) noexcept {
return std::optional<CustomVideoMetadata>(value);
}
inline bool has_value_std__optional_CustomVideoMetadata_(const std::optional<CustomVideoMetadata>& optional) noexcept {
return optional.has_value();
}
inline CustomVideoMetadata get_std__optional_CustomVideoMetadata_(const std::optional<CustomVideoMetadata>& optional) noexcept {
return *optional;
}
// pragma MARK: std::shared_ptr<Promise<VideoInformation>> // pragma MARK: std::shared_ptr<Promise<VideoInformation>>
/** /**
* Specialized version of `std::shared_ptr<Promise<VideoInformation>>`. * Specialized version of `std::shared_ptr<Promise<VideoInformation>>`.
*/ */
using std__shared_ptr_Promise_VideoInformation__ = std::shared_ptr<Promise<VideoInformation>>; using std__shared_ptr_Promise_VideoInformation__ = std::shared_ptr<Promise<VideoInformation>>;
inline std::shared_ptr<Promise<VideoInformation>> create_std__shared_ptr_Promise_VideoInformation__() { inline std::shared_ptr<Promise<VideoInformation>> create_std__shared_ptr_Promise_VideoInformation__() noexcept {
return Promise<VideoInformation>::create(); return Promise<VideoInformation>::create();
} }
inline PromiseHolder<VideoInformation> wrap_std__shared_ptr_Promise_VideoInformation__(std::shared_ptr<Promise<VideoInformation>> promise) { inline PromiseHolder<VideoInformation> wrap_std__shared_ptr_Promise_VideoInformation__(std::shared_ptr<Promise<VideoInformation>> promise) noexcept {
return PromiseHolder<VideoInformation>(std::move(promise)); return PromiseHolder<VideoInformation>(std::move(promise));
} }
@@ -819,23 +910,23 @@ namespace margelo::nitro::video::bridge::swift {
class Func_void_VideoInformation_Wrapper final { class Func_void_VideoInformation_Wrapper final {
public: public:
explicit Func_void_VideoInformation_Wrapper(std::function<void(const VideoInformation& /* result */)>&& func): _function(std::make_unique<std::function<void(const VideoInformation& /* result */)>>(std::move(func))) {} explicit Func_void_VideoInformation_Wrapper(std::function<void(const VideoInformation& /* result */)>&& func): _function(std::make_unique<std::function<void(const VideoInformation& /* result */)>>(std::move(func))) {}
inline void call(VideoInformation result) const { inline void call(VideoInformation result) const noexcept {
_function->operator()(result); _function->operator()(result);
} }
private: private:
std::unique_ptr<std::function<void(const VideoInformation& /* result */)>> _function; std::unique_ptr<std::function<void(const VideoInformation& /* result */)>> _function;
} SWIFT_NONCOPYABLE; } SWIFT_NONCOPYABLE;
Func_void_VideoInformation create_Func_void_VideoInformation(void* _Nonnull swiftClosureWrapper); Func_void_VideoInformation create_Func_void_VideoInformation(void* NON_NULL swiftClosureWrapper) noexcept;
inline Func_void_VideoInformation_Wrapper wrap_Func_void_VideoInformation(Func_void_VideoInformation value) { inline Func_void_VideoInformation_Wrapper wrap_Func_void_VideoInformation(Func_void_VideoInformation value) noexcept {
return Func_void_VideoInformation_Wrapper(std::move(value)); return Func_void_VideoInformation_Wrapper(std::move(value));
} }
// pragma MARK: Result<std::shared_ptr<Promise<VideoInformation>>> // pragma MARK: Result<std::shared_ptr<Promise<VideoInformation>>>
using Result_std__shared_ptr_Promise_VideoInformation___ = Result<std::shared_ptr<Promise<VideoInformation>>>; using Result_std__shared_ptr_Promise_VideoInformation___ = Result<std::shared_ptr<Promise<VideoInformation>>>;
inline Result_std__shared_ptr_Promise_VideoInformation___ create_Result_std__shared_ptr_Promise_VideoInformation___(const std::shared_ptr<Promise<VideoInformation>>& value) { inline Result_std__shared_ptr_Promise_VideoInformation___ create_Result_std__shared_ptr_Promise_VideoInformation___(const std::shared_ptr<Promise<VideoInformation>>& value) noexcept {
return Result<std::shared_ptr<Promise<VideoInformation>>>::withValue(value); return Result<std::shared_ptr<Promise<VideoInformation>>>::withValue(value);
} }
inline Result_std__shared_ptr_Promise_VideoInformation___ create_Result_std__shared_ptr_Promise_VideoInformation___(const std::exception_ptr& error) { inline Result_std__shared_ptr_Promise_VideoInformation___ create_Result_std__shared_ptr_Promise_VideoInformation___(const std::exception_ptr& error) noexcept {
return Result<std::shared_ptr<Promise<VideoInformation>>>::withError(error); return Result<std::shared_ptr<Promise<VideoInformation>>>::withError(error);
} }
@@ -844,19 +935,19 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::shared_ptr<HybridVideoPlayerSourceFactorySpec>`. * Specialized version of `std::shared_ptr<HybridVideoPlayerSourceFactorySpec>`.
*/ */
using std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ = std::shared_ptr<HybridVideoPlayerSourceFactorySpec>; using std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ = std::shared_ptr<HybridVideoPlayerSourceFactorySpec>;
std::shared_ptr<HybridVideoPlayerSourceFactorySpec> create_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(void* _Nonnull swiftUnsafePointer); std::shared_ptr<HybridVideoPlayerSourceFactorySpec> create_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept;
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ cppType); void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ cppType);
// pragma MARK: std::weak_ptr<HybridVideoPlayerSourceFactorySpec> // pragma MARK: std::weak_ptr<HybridVideoPlayerSourceFactorySpec>
using std__weak_ptr_HybridVideoPlayerSourceFactorySpec_ = std::weak_ptr<HybridVideoPlayerSourceFactorySpec>; using std__weak_ptr_HybridVideoPlayerSourceFactorySpec_ = std::weak_ptr<HybridVideoPlayerSourceFactorySpec>;
inline std__weak_ptr_HybridVideoPlayerSourceFactorySpec_ weakify_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(const std::shared_ptr<HybridVideoPlayerSourceFactorySpec>& strong) { return strong; } inline std__weak_ptr_HybridVideoPlayerSourceFactorySpec_ weakify_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(const std::shared_ptr<HybridVideoPlayerSourceFactorySpec>& strong) noexcept { return strong; }
// pragma MARK: Result<std::shared_ptr<HybridVideoPlayerSourceSpec>> // pragma MARK: Result<std::shared_ptr<HybridVideoPlayerSourceSpec>>
using Result_std__shared_ptr_HybridVideoPlayerSourceSpec__ = Result<std::shared_ptr<HybridVideoPlayerSourceSpec>>; using Result_std__shared_ptr_HybridVideoPlayerSourceSpec__ = Result<std::shared_ptr<HybridVideoPlayerSourceSpec>>;
inline Result_std__shared_ptr_HybridVideoPlayerSourceSpec__ create_Result_std__shared_ptr_HybridVideoPlayerSourceSpec__(const std::shared_ptr<HybridVideoPlayerSourceSpec>& value) { inline Result_std__shared_ptr_HybridVideoPlayerSourceSpec__ create_Result_std__shared_ptr_HybridVideoPlayerSourceSpec__(const std::shared_ptr<HybridVideoPlayerSourceSpec>& value) noexcept {
return Result<std::shared_ptr<HybridVideoPlayerSourceSpec>>::withValue(value); return Result<std::shared_ptr<HybridVideoPlayerSourceSpec>>::withValue(value);
} }
inline Result_std__shared_ptr_HybridVideoPlayerSourceSpec__ create_Result_std__shared_ptr_HybridVideoPlayerSourceSpec__(const std::exception_ptr& error) { inline Result_std__shared_ptr_HybridVideoPlayerSourceSpec__ create_Result_std__shared_ptr_HybridVideoPlayerSourceSpec__(const std::exception_ptr& error) noexcept {
return Result<std::shared_ptr<HybridVideoPlayerSourceSpec>>::withError(error); return Result<std::shared_ptr<HybridVideoPlayerSourceSpec>>::withError(error);
} }
@@ -865,55 +956,79 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::optional<std::shared_ptr<HybridVideoPlayerSpec>>`. * Specialized version of `std::optional<std::shared_ptr<HybridVideoPlayerSpec>>`.
*/ */
using std__optional_std__shared_ptr_HybridVideoPlayerSpec__ = std::optional<std::shared_ptr<HybridVideoPlayerSpec>>; using std__optional_std__shared_ptr_HybridVideoPlayerSpec__ = std::optional<std::shared_ptr<HybridVideoPlayerSpec>>;
inline std::optional<std::shared_ptr<HybridVideoPlayerSpec>> create_std__optional_std__shared_ptr_HybridVideoPlayerSpec__(const std::shared_ptr<HybridVideoPlayerSpec>& value) { inline std::optional<std::shared_ptr<HybridVideoPlayerSpec>> create_std__optional_std__shared_ptr_HybridVideoPlayerSpec__(const std::shared_ptr<HybridVideoPlayerSpec>& value) noexcept {
return std::optional<std::shared_ptr<HybridVideoPlayerSpec>>(value); return std::optional<std::shared_ptr<HybridVideoPlayerSpec>>(value);
} }
inline bool has_value_std__optional_std__shared_ptr_HybridVideoPlayerSpec__(const std::optional<std::shared_ptr<HybridVideoPlayerSpec>>& optional) noexcept {
return optional.has_value();
}
inline std::shared_ptr<HybridVideoPlayerSpec> get_std__optional_std__shared_ptr_HybridVideoPlayerSpec__(const std::optional<std::shared_ptr<HybridVideoPlayerSpec>>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<std::function<void(bool /* isInPictureInPicture */)>> // pragma MARK: std::optional<std::function<void(bool /* isInPictureInPicture */)>>
/** /**
* Specialized version of `std::optional<std::function<void(bool / * isInPictureInPicture * /)>>`. * Specialized version of `std::optional<std::function<void(bool / * isInPictureInPicture * /)>>`.
*/ */
using std__optional_std__function_void_bool____isInPictureInPicture______ = std::optional<std::function<void(bool /* isInPictureInPicture */)>>; using std__optional_std__function_void_bool____isInPictureInPicture______ = std::optional<std::function<void(bool /* isInPictureInPicture */)>>;
inline std::optional<std::function<void(bool /* isInPictureInPicture */)>> create_std__optional_std__function_void_bool____isInPictureInPicture______(const std::function<void(bool /* isInPictureInPicture */)>& value) { inline std::optional<std::function<void(bool /* isInPictureInPicture */)>> create_std__optional_std__function_void_bool____isInPictureInPicture______(const std::function<void(bool /* isInPictureInPicture */)>& value) noexcept {
return std::optional<std::function<void(bool /* isInPictureInPicture */)>>(value); return std::optional<std::function<void(bool /* isInPictureInPicture */)>>(value);
} }
inline bool has_value_std__optional_std__function_void_bool____isInPictureInPicture______(const std::optional<std::function<void(bool /* isInPictureInPicture */)>>& optional) noexcept {
return optional.has_value();
}
inline std::function<void(bool /* isInPictureInPicture */)> get_std__optional_std__function_void_bool____isInPictureInPicture______(const std::optional<std::function<void(bool /* isInPictureInPicture */)>>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<std::function<void(bool /* fullscreen */)>> // pragma MARK: std::optional<std::function<void(bool /* fullscreen */)>>
/** /**
* Specialized version of `std::optional<std::function<void(bool / * fullscreen * /)>>`. * Specialized version of `std::optional<std::function<void(bool / * fullscreen * /)>>`.
*/ */
using std__optional_std__function_void_bool____fullscreen______ = std::optional<std::function<void(bool /* fullscreen */)>>; using std__optional_std__function_void_bool____fullscreen______ = std::optional<std::function<void(bool /* fullscreen */)>>;
inline std::optional<std::function<void(bool /* fullscreen */)>> create_std__optional_std__function_void_bool____fullscreen______(const std::function<void(bool /* fullscreen */)>& value) { inline std::optional<std::function<void(bool /* fullscreen */)>> create_std__optional_std__function_void_bool____fullscreen______(const std::function<void(bool /* fullscreen */)>& value) noexcept {
return std::optional<std::function<void(bool /* fullscreen */)>>(value); return std::optional<std::function<void(bool /* fullscreen */)>>(value);
} }
inline bool has_value_std__optional_std__function_void_bool____fullscreen______(const std::optional<std::function<void(bool /* fullscreen */)>>& optional) noexcept {
return optional.has_value();
}
inline std::function<void(bool /* fullscreen */)> get_std__optional_std__function_void_bool____fullscreen______(const std::optional<std::function<void(bool /* fullscreen */)>>& optional) noexcept {
return *optional;
}
// pragma MARK: std::optional<std::function<void()>> // pragma MARK: std::optional<std::function<void()>>
/** /**
* Specialized version of `std::optional<std::function<void()>>`. * Specialized version of `std::optional<std::function<void()>>`.
*/ */
using std__optional_std__function_void____ = std::optional<std::function<void()>>; using std__optional_std__function_void____ = std::optional<std::function<void()>>;
inline std::optional<std::function<void()>> create_std__optional_std__function_void____(const std::function<void()>& value) { inline std::optional<std::function<void()>> create_std__optional_std__function_void____(const std::function<void()>& value) noexcept {
return std::optional<std::function<void()>>(value); return std::optional<std::function<void()>>(value);
} }
inline bool has_value_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
return optional.has_value();
}
inline std::function<void()> get_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
return *optional;
}
// pragma MARK: std::shared_ptr<HybridVideoViewViewManagerSpec> // pragma MARK: std::shared_ptr<HybridVideoViewViewManagerSpec>
/** /**
* Specialized version of `std::shared_ptr<HybridVideoViewViewManagerSpec>`. * Specialized version of `std::shared_ptr<HybridVideoViewViewManagerSpec>`.
*/ */
using std__shared_ptr_HybridVideoViewViewManagerSpec_ = std::shared_ptr<HybridVideoViewViewManagerSpec>; using std__shared_ptr_HybridVideoViewViewManagerSpec_ = std::shared_ptr<HybridVideoViewViewManagerSpec>;
std::shared_ptr<HybridVideoViewViewManagerSpec> create_std__shared_ptr_HybridVideoViewViewManagerSpec_(void* _Nonnull swiftUnsafePointer); std::shared_ptr<HybridVideoViewViewManagerSpec> create_std__shared_ptr_HybridVideoViewViewManagerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
void* _Nonnull get_std__shared_ptr_HybridVideoViewViewManagerSpec_(std__shared_ptr_HybridVideoViewViewManagerSpec_ cppType); void* NON_NULL get_std__shared_ptr_HybridVideoViewViewManagerSpec_(std__shared_ptr_HybridVideoViewViewManagerSpec_ cppType);
// pragma MARK: std::weak_ptr<HybridVideoViewViewManagerSpec> // pragma MARK: std::weak_ptr<HybridVideoViewViewManagerSpec>
using std__weak_ptr_HybridVideoViewViewManagerSpec_ = std::weak_ptr<HybridVideoViewViewManagerSpec>; using std__weak_ptr_HybridVideoViewViewManagerSpec_ = std::weak_ptr<HybridVideoViewViewManagerSpec>;
inline std__weak_ptr_HybridVideoViewViewManagerSpec_ weakify_std__shared_ptr_HybridVideoViewViewManagerSpec_(const std::shared_ptr<HybridVideoViewViewManagerSpec>& strong) { return strong; } inline std__weak_ptr_HybridVideoViewViewManagerSpec_ weakify_std__shared_ptr_HybridVideoViewViewManagerSpec_(const std::shared_ptr<HybridVideoViewViewManagerSpec>& strong) noexcept { return strong; }
// pragma MARK: Result<bool> // pragma MARK: Result<bool>
using Result_bool_ = Result<bool>; using Result_bool_ = Result<bool>;
inline Result_bool_ create_Result_bool_(bool value) { inline Result_bool_ create_Result_bool_(bool value) noexcept {
return Result<bool>::withValue(std::move(value)); return Result<bool>::withValue(std::move(value));
} }
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) { inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
return Result<bool>::withError(error); return Result<bool>::withError(error);
} }
@@ -922,19 +1037,19 @@ namespace margelo::nitro::video::bridge::swift {
* Specialized version of `std::shared_ptr<HybridVideoViewViewManagerFactorySpec>`. * Specialized version of `std::shared_ptr<HybridVideoViewViewManagerFactorySpec>`.
*/ */
using std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ = std::shared_ptr<HybridVideoViewViewManagerFactorySpec>; using std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ = std::shared_ptr<HybridVideoViewViewManagerFactorySpec>;
std::shared_ptr<HybridVideoViewViewManagerFactorySpec> create_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(void* _Nonnull swiftUnsafePointer); std::shared_ptr<HybridVideoViewViewManagerFactorySpec> create_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept;
void* _Nonnull get_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ cppType); void* NON_NULL get_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ cppType);
// pragma MARK: std::weak_ptr<HybridVideoViewViewManagerFactorySpec> // pragma MARK: std::weak_ptr<HybridVideoViewViewManagerFactorySpec>
using std__weak_ptr_HybridVideoViewViewManagerFactorySpec_ = std::weak_ptr<HybridVideoViewViewManagerFactorySpec>; using std__weak_ptr_HybridVideoViewViewManagerFactorySpec_ = std::weak_ptr<HybridVideoViewViewManagerFactorySpec>;
inline std__weak_ptr_HybridVideoViewViewManagerFactorySpec_ weakify_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(const std::shared_ptr<HybridVideoViewViewManagerFactorySpec>& strong) { return strong; } inline std__weak_ptr_HybridVideoViewViewManagerFactorySpec_ weakify_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(const std::shared_ptr<HybridVideoViewViewManagerFactorySpec>& strong) noexcept { return strong; }
// pragma MARK: Result<std::shared_ptr<HybridVideoViewViewManagerSpec>> // pragma MARK: Result<std::shared_ptr<HybridVideoViewViewManagerSpec>>
using Result_std__shared_ptr_HybridVideoViewViewManagerSpec__ = Result<std::shared_ptr<HybridVideoViewViewManagerSpec>>; using Result_std__shared_ptr_HybridVideoViewViewManagerSpec__ = Result<std::shared_ptr<HybridVideoViewViewManagerSpec>>;
inline Result_std__shared_ptr_HybridVideoViewViewManagerSpec__ create_Result_std__shared_ptr_HybridVideoViewViewManagerSpec__(const std::shared_ptr<HybridVideoViewViewManagerSpec>& value) { inline Result_std__shared_ptr_HybridVideoViewViewManagerSpec__ create_Result_std__shared_ptr_HybridVideoViewViewManagerSpec__(const std::shared_ptr<HybridVideoViewViewManagerSpec>& value) noexcept {
return Result<std::shared_ptr<HybridVideoViewViewManagerSpec>>::withValue(value); return Result<std::shared_ptr<HybridVideoViewViewManagerSpec>>::withValue(value);
} }
inline Result_std__shared_ptr_HybridVideoViewViewManagerSpec__ create_Result_std__shared_ptr_HybridVideoViewViewManagerSpec__(const std::exception_ptr& error) { inline Result_std__shared_ptr_HybridVideoViewViewManagerSpec__ create_Result_std__shared_ptr_HybridVideoViewViewManagerSpec__(const std::exception_ptr& error) noexcept {
return Result<std::shared_ptr<HybridVideoViewViewManagerSpec>>::withError(error); return Result<std::shared_ptr<HybridVideoViewViewManagerSpec>>::withError(error);
} }

Some files were not shown because too many files have changed in this diff Show More