mirror of
https://github.com/zoriya/react-native-video.git
synced 2025-12-05 23:06:14 +00:00
Compare commits
35 Commits
v7
...
79f243c7d3
| Author | SHA1 | Date | |
|---|---|---|---|
| 79f243c7d3 | |||
| ceaf050caf | |||
| 4f9204f27c | |||
| aa2921c8b4 | |||
| 2e856249b3 | |||
| fb99df1d58 | |||
| 6ab3eb397c | |||
| 2984630e55 | |||
| 70405e7052 | |||
| a964c83ecc | |||
| 92104b61f5 | |||
| e34df18ae7 | |||
| 21cd8b9508 | |||
| 1bd239c530 | |||
| 684e9637e0 | |||
| b9211e00a0 | |||
| 1c2f1430f8 | |||
| db6faf7d5a | |||
| 917e22f0b3 | |||
| 963d3d4003 | |||
| 680453567c | |||
| 5d18e41254 | |||
|
|
01395f247b | ||
|
|
9f2d1894ae | ||
|
|
8ce38cab1b | ||
|
|
52499e5af7 | ||
|
|
6f8282616c | ||
|
|
9b74665fb4 | ||
|
|
1671c63dab | ||
|
|
02044de0e9 | ||
|
|
375fbeb0eb | ||
|
|
4ebc9b7f05 | ||
|
|
a97581ab8a | ||
|
|
58a268c022 | ||
| 07b55755d1 |
9
.editorconfig
Normal file
9
.editorconfig
Normal 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
|
||||
4
.github/actions/setup-bun/action.yml
vendored
4
.github/actions/setup-bun/action.yml
vendored
@@ -13,7 +13,7 @@ runs:
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: 1.2.19
|
||||
bun-version: 1.3.0
|
||||
|
||||
- name: Cache dependencies
|
||||
id: bun-cache
|
||||
@@ -30,4 +30,4 @@ runs:
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
run: bun install
|
||||
shell: bash
|
||||
|
||||
|
||||
|
||||
2
bunfig.toml
Normal file
2
bunfig.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[install]
|
||||
linker = "hoisted"
|
||||
@@ -16,7 +16,7 @@
|
||||
"allowUnusedLabels": false,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"lib": ["ESNext"],
|
||||
"lib": ["ESNext", "dom"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"noEmit": true,
|
||||
@@ -33,4 +33,4 @@
|
||||
"target": "ESNext",
|
||||
"verbatimModuleSyntax": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,17 +87,17 @@ import { VideoPlayer } from 'react-native-video';
|
||||
|
||||
const player = new VideoPlayer('https://example.com/video.mp4');
|
||||
|
||||
player.onLoad = (data) => {
|
||||
player.addEventListener('onLoad', (data) => {
|
||||
console.log('Video loaded! Duration:', data.duration);
|
||||
};
|
||||
});
|
||||
|
||||
player.onProgress = (data) => {
|
||||
player.addEventListener('onProgress', (data) => {
|
||||
console.log('Current time:', data.currentTime);
|
||||
};
|
||||
});
|
||||
|
||||
player.onError = (error) => {
|
||||
player.addEventListener('onError', (error) => {
|
||||
console.error('Player Error:', error.code, error.message);
|
||||
};
|
||||
});
|
||||
|
||||
player.play();
|
||||
```
|
||||
@@ -105,4 +105,4 @@ player.play();
|
||||
## Clearing Events
|
||||
|
||||
- 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
|
||||
|
||||
@@ -17,20 +17,20 @@ This page explains how to play DRM‑protected content with React Native Video u
|
||||
## Install and enable the DRM plugin
|
||||
|
||||
:::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:
|
||||
|
||||
```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):
|
||||
|
||||
```ts
|
||||
// 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();
|
||||
```
|
||||
@@ -185,7 +185,7 @@ If you are looking for implementing offline playback with DRM, make sure to chec
|
||||
|
||||
## 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.
|
||||
- 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.
|
||||
|
||||
@@ -145,6 +145,6 @@ Properties below are Apple platforms‑only
|
||||
Protected content is supported via a plugin. See the full DRM guide: [DRM](./drm.md).
|
||||
|
||||
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).
|
||||
- If you defer initialization (`initializeOnCreation: false`), be sure to call `await player.initialize()` (or `preload()`) before expecting DRM license acquisition events.
|
||||
@@ -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). |
|
||||
| `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. |
|
||||
| `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
|
||||
|
||||
@@ -104,4 +105,26 @@ Available methods on the `VideoViewRef`:
|
||||
| `exitFullscreen()` | `() => void` | Programmatically requests the video view to exit fullscreen 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. |
|
||||
| `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.
|
||||
@@ -8,7 +8,7 @@ PODS:
|
||||
- hermes-engine (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
|
||||
- glog
|
||||
- hermes-engine
|
||||
@@ -1565,7 +1565,7 @@ PODS:
|
||||
- React-logger (= 0.77.2)
|
||||
- React-perflogger (= 0.77.2)
|
||||
- React-utils (= 0.77.2)
|
||||
- ReactNativeVideo (7.0.0-alpha.4):
|
||||
- ReactNativeVideo (7.0.0-alpha.6):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
@@ -1587,7 +1587,7 @@ PODS:
|
||||
- ReactCommon/turbomodule/bridging
|
||||
- ReactCommon/turbomodule/core
|
||||
- Yoga
|
||||
- ReactNativeVideoDrm (0.1.0):
|
||||
- ReactNativeVideoDrm (7.0.0-alpha.6):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
@@ -1686,7 +1686,7 @@ DEPENDENCIES:
|
||||
- ReactCodegen (from `build/generated/ios`)
|
||||
- ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`)
|
||||
- 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`)
|
||||
|
||||
SPEC REPOS:
|
||||
@@ -1832,7 +1832,7 @@ EXTERNAL SOURCES:
|
||||
ReactNativeVideo:
|
||||
:path: "../../node_modules/react-native-video"
|
||||
ReactNativeVideoDrm:
|
||||
:path: "../../node_modules/@twg/react-native-video-drm"
|
||||
:path: "../../node_modules/@react-native-video/drm"
|
||||
Yoga:
|
||||
:path: "../../node_modules/react-native/ReactCommon/yoga"
|
||||
|
||||
@@ -1844,7 +1844,7 @@ SPEC CHECKSUMS:
|
||||
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
|
||||
glog: eb93e2f488219332457c3c4eafd2738ddc7e80b8
|
||||
hermes-engine: 8eb265241fa1d7095d3a40d51fd90f7dce68217c
|
||||
NitroModules: 1e4150c3e3676e05209234a8a5e0e8886fc0311a
|
||||
NitroModules: b4cd8f92604355343f12fc93772ff5a19571d41f
|
||||
RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82
|
||||
RCTDeprecation: 85b72250b63cfb54f29ca96ceb108cb9ef3c2079
|
||||
RCTRequired: 567cb8f5d42b990331bfd93faad1d8999b1c1736
|
||||
@@ -1904,8 +1904,8 @@ SPEC CHECKSUMS:
|
||||
ReactAppDependencyProvider: f334cebc0beed0a72490492e978007082c03d533
|
||||
ReactCodegen: 474fbb3e4bb0f1ee6c255d1955db76e13d509269
|
||||
ReactCommon: 7763e59534d58e15f8f22121cdfe319040e08888
|
||||
ReactNativeVideo: f365bc4f1a57ab50ddb655cda2f47bc06698a53b
|
||||
ReactNativeVideoDrm: 62840ae0e184f711a2e6495c18e342a74cb598f8
|
||||
ReactNativeVideo: 6290dbf881cdeb58c09b5aef1af1245aebf5a207
|
||||
ReactNativeVideoDrm: 0664dcc3ccac781f6fd00329cb890b6d1f15c392
|
||||
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
|
||||
Yoga: 31a098f74c16780569aebd614a0f37a907de0189
|
||||
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
{
|
||||
"name": "react-native-video-example",
|
||||
"version": "7.0.0-alpha.4",
|
||||
"version": "7.0.0-alpha.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android": "react-native run-android",
|
||||
"ios": "react-native run-ios",
|
||||
"lint": "eslint .",
|
||||
"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": {
|
||||
"@react-native-community/slider": "^4.5.6",
|
||||
"react": "18.3.1",
|
||||
"react-native": "^0.77.0",
|
||||
"react-native-nitro-modules": "^0.28.0",
|
||||
"react-native-nitro-modules": "^0.30.0",
|
||||
"react-native-video": "*",
|
||||
"@twg/react-native-video-drm": "*"
|
||||
"@react-native-video/drm": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
|
||||
@@ -146,6 +146,7 @@ const VideoDemo = () => {
|
||||
player.playWhenInactive = settings.playWhenInactive;
|
||||
player.mixAudioMode = settings.mixAudioMode;
|
||||
player.ignoreSilentSwitchMode = settings.ignoreSilentSwitchMode;
|
||||
player.showNotificationControls = settings.showNotificationControls;
|
||||
}, [settings, player]);
|
||||
|
||||
const handleSeek = (val: number) => {
|
||||
@@ -315,6 +316,13 @@ const VideoDemo = () => {
|
||||
value={settings.playWhenInactive}
|
||||
onValueChange={(value) => updateSetting('playWhenInactive', value)}
|
||||
/>
|
||||
<SwitchControl
|
||||
label="Notification Controls"
|
||||
value={settings.showNotificationControls}
|
||||
onValueChange={(value) =>
|
||||
updateSetting('showNotificationControls', value)
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ export interface VideoSettings {
|
||||
ignoreSilentSwitchMode: IgnoreSilentSwitchMode;
|
||||
playInBackground: boolean;
|
||||
playWhenInactive: boolean;
|
||||
showNotificationControls: boolean;
|
||||
}
|
||||
|
||||
export const defaultSettings: VideoSettings = {
|
||||
@@ -32,4 +33,5 @@ export const defaultSettings: VideoSettings = {
|
||||
ignoreSilentSwitchMode: 'auto',
|
||||
playInBackground: true,
|
||||
playWhenInactive: false,
|
||||
showNotificationControls: true,
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
enable as enableDRMPlugin,
|
||||
disable as disableDRMPlugin,
|
||||
isEnabled as isDRMPluginEnabled,
|
||||
} from '@twg/react-native-video-drm';
|
||||
} from '@react-native-video/drm';
|
||||
|
||||
const getDRMSource = (): VideoConfig => {
|
||||
const HLS =
|
||||
@@ -103,5 +103,14 @@ export const getVideoSource = (type: VideoType): VideoConfig => {
|
||||
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;
|
||||
};
|
||||
|
||||
14
package.json
14
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "react-native-video-monorepo",
|
||||
"packageManager": "bun@1.1.42",
|
||||
"version": "7.0.0-alpha.4",
|
||||
"version": "7.0.0-alpha.7",
|
||||
"private": true,
|
||||
"repository": "https://github.com/TheWidlarzGroup/react-native-video",
|
||||
"author": "TheWidlarzGroup <hi@thewidlarzgroup.com> (https://github.com/TheWidlarzGroup)",
|
||||
@@ -34,6 +34,7 @@
|
||||
"@release-it/conventional-changelog": "^8.0.2",
|
||||
"@tsconfig/react-native": "^2.0.2",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
"@types/node": "^24.9.1",
|
||||
"@types/react": "^18.2.44",
|
||||
"commitlint": "^17.0.2",
|
||||
"eslint": "^8.51.0",
|
||||
@@ -64,7 +65,8 @@
|
||||
"release": true
|
||||
},
|
||||
"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": {
|
||||
"@release-it/bumper": {
|
||||
@@ -73,6 +75,10 @@
|
||||
"file": "packages/react-native-video/package.json",
|
||||
"path": "version"
|
||||
},
|
||||
{
|
||||
"file": "packages/drm-plugin/package.json",
|
||||
"path": "version"
|
||||
},
|
||||
{
|
||||
"file": "example/package.json",
|
||||
"path": "version"
|
||||
@@ -91,6 +97,10 @@
|
||||
"type": "fix",
|
||||
"section": "Bug Fixes 🐛"
|
||||
},
|
||||
{
|
||||
"type": "refactor",
|
||||
"section": "Code Refactoring 🛠"
|
||||
},
|
||||
{
|
||||
"type": "chore(deps)",
|
||||
"section": "Dependency Upgrades 📦"
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -10,7 +10,7 @@ DRM plugin for react-native-video. It adds Widevine (Android) and FairPlay (iOS,
|
||||
## Installation
|
||||
|
||||
```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
|
||||
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 { Platform } from 'react-native';
|
||||
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();
|
||||
@@ -59,7 +59,7 @@ export default function Player() {
|
||||
|
||||
## 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).
|
||||
- `disable(): void` — unregisters the plugin.
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
# 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
|
||||
include_directories(
|
||||
"../nitrogen/generated/shared/c++"
|
||||
@@ -32,12 +38,9 @@ target_sources(
|
||||
../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
|
||||
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
||||
target_compile_definitions(
|
||||
target_compile_definitions(
|
||||
ReactNativeVideoDrm PRIVATE
|
||||
-DFOLLY_NO_CONFIG=1
|
||||
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
||||
|
||||
@@ -35,8 +35,7 @@ int initialize(JavaVM* vm) {
|
||||
[]() -> std::shared_ptr<HybridObject> {
|
||||
static DefaultConstructableObject<JHybridPluginManagerSpec::javaobject> object("com/margelo/nitro/videodrm/PluginManager");
|
||||
auto instance = object.create();
|
||||
auto globalRef = jni::make_global(instance);
|
||||
return globalRef->cthis()->shared();
|
||||
return instance->cthis()->shared();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -53,6 +53,6 @@ abstract class HybridPluginManagerSpec: HybridObject() {
|
||||
private external fun initHybrid(): HybridData
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HybridPluginManagerSpec"
|
||||
protected const val TAG = "HybridPluginManagerSpec"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
namespace margelo::nitro::videodrm::bridge::swift {
|
||||
|
||||
// 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);
|
||||
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);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
|
||||
@@ -32,19 +32,19 @@ namespace margelo::nitro::videodrm::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
void* _Nonnull get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType);
|
||||
std::shared_ptr<HybridPluginManagerSpec> create_std__shared_ptr_HybridPluginManagerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType);
|
||||
|
||||
// pragma MARK: 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>
|
||||
using Result_void_ = Result<void>;
|
||||
inline Result_void_ create_Result_void_() {
|
||||
inline Result_void_ create_Result_void_() noexcept {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@twg/react-native-video-drm",
|
||||
"version": "0.1.0",
|
||||
"name": "@react-native-video/drm",
|
||||
"version": "7.0.0-alpha.7",
|
||||
"description": "DRM plugin for react-native-video",
|
||||
"main": "./lib/module/index.js",
|
||||
"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",
|
||||
"prepare": "bun run build",
|
||||
"build": "bob build",
|
||||
"specs": "nitro-codegen",
|
||||
"release": "release-it --only-version"
|
||||
"specs": "nitrogen",
|
||||
"release": "release-it --preRelease alpha --npm.tag=next"
|
||||
},
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -61,7 +61,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/TheWidlarzGroup/react-native-video#readme",
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
"registry": "https://registry.npmjs.org/",
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native/babel-preset": "0.79.2",
|
||||
@@ -71,12 +72,12 @@
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-config-prettier": "9.0.0",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"nitro-codegen": "^0.28.0",
|
||||
"nitrogen": "^0.30.0",
|
||||
"prettier": "^3.0.3",
|
||||
"react": "18.3.1",
|
||||
"react-native": "^0.77.0",
|
||||
"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",
|
||||
"typescript": "^5.8.3",
|
||||
"react-native-video": "*"
|
||||
@@ -97,7 +98,8 @@
|
||||
"release-it": {
|
||||
"git": false,
|
||||
"npm": {
|
||||
"publish": true
|
||||
"publish": true,
|
||||
"publishArgs": "--access public"
|
||||
},
|
||||
"github": {
|
||||
"release": false
|
||||
|
||||
@@ -120,7 +120,7 @@ android {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
RNVideo_kotlinVersion=1.9.24
|
||||
RNVideo_minKotlinVersion=1.8.0
|
||||
RNVideo_minSdkVersion=23
|
||||
RNVideo_targetSdkVersion=34
|
||||
RNVideo_compileSdkVersion=34
|
||||
RNVideo_ndkversion=26.1.10909125
|
||||
RNVideo_minSdkVersion=24
|
||||
RNVideo_targetSdkVersion=35
|
||||
RNVideo_compileSdkVersion=35
|
||||
RNVideo_ndkversion=27.1.12297006
|
||||
|
||||
RNVideo_useExoplayerDash=true
|
||||
RNVideo_useExoplayerHls=true
|
||||
|
||||
@@ -21,10 +21,17 @@ fun VideoPlaybackService.Companion.startService(
|
||||
val intent = Intent(context, VideoPlaybackService::class.java)
|
||||
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) {
|
||||
reactContext.startForegroundService(intent);
|
||||
try {
|
||||
reactContext.startForegroundService(intent)
|
||||
} catch (_: Exception) {
|
||||
// Fall back to startService if anything goes wrong
|
||||
try { reactContext.startService(intent) } catch (_: Exception) {}
|
||||
}
|
||||
} else {
|
||||
reactContext.startService(intent);
|
||||
reactContext.startService(intent)
|
||||
}
|
||||
|
||||
val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
@@ -42,7 +49,11 @@ fun VideoPlaybackService.Companion.stopService(
|
||||
serviceConnection: VideoPlaybackServiceConnection
|
||||
) {
|
||||
try {
|
||||
NitroModules.applicationContext?.currentActivity?.unbindService(serviceConnection)
|
||||
// Unregister the player first; this might stop the service if no players remain
|
||||
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) {}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import androidx.annotation.OptIn
|
||||
import androidx.core.net.toUri
|
||||
import androidx.media3.common.MediaItem
|
||||
import androidx.media3.common.C
|
||||
import androidx.media3.common.MediaMetadata
|
||||
import androidx.media3.common.MimeTypes
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import com.margelo.nitro.video.BufferConfig
|
||||
import com.margelo.nitro.video.CustomVideoMetadata
|
||||
import com.margelo.nitro.video.HybridVideoPlayerSource
|
||||
import com.margelo.nitro.video.LivePlaybackParams
|
||||
import com.margelo.nitro.video.NativeDrmParams
|
||||
@@ -39,6 +41,10 @@ fun createMediaItemFromVideoConfig(
|
||||
mediaItemBuilder.setLiveConfiguration(getLiveConfiguration(livePlaybackParams))
|
||||
}
|
||||
|
||||
source.config.metadata?.let { metadata ->
|
||||
mediaItemBuilder.setMediaMetadata(getCustomMetadata(metadata))
|
||||
}
|
||||
|
||||
return PluginsRegistry.shared.overrideMediaItemBuilder(
|
||||
source,
|
||||
mediaItemBuilder
|
||||
@@ -122,3 +128,14 @@ fun getLiveConfiguration(
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
@@ -77,6 +77,10 @@ fun buildExternalSubtitlesMediaSource(context: Context, source: HybridVideoPlaye
|
||||
.setUri(source.uri.toUri())
|
||||
.setSubtitleConfigurations(getSubtitlesConfiguration(source.config))
|
||||
|
||||
source.config.metadata?.let { metadata ->
|
||||
mediaItemBuilderWithSubtitles.setMediaMetadata(getCustomMetadata(metadata))
|
||||
}
|
||||
|
||||
val mediaItemBuilder = PluginsRegistry.shared.overrideMediaItemBuilder(
|
||||
source,
|
||||
mediaItemBuilderWithSubtitles
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,41 @@ import android.os.Bundle
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.media3.common.Player
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.session.CommandButton
|
||||
import androidx.media3.session.MediaSession
|
||||
import androidx.media3.session.SessionCommand
|
||||
import androidx.media3.session.SessionResult
|
||||
import com.google.common.util.concurrent.ListenableFuture
|
||||
import com.google.common.collect.ImmutableList
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
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 {
|
||||
try {
|
||||
@@ -23,36 +51,46 @@ class VideoPlaybackCallback : MediaSession.Callback {
|
||||
).setAvailableSessionCommands(
|
||||
MediaSession.ConnectionResult.DEFAULT_SESSION_COMMANDS.buildUpon()
|
||||
.add(
|
||||
SessionCommand(
|
||||
VideoPlaybackService.Companion.COMMAND.SEEK_FORWARD.stringValue,
|
||||
Bundle.EMPTY
|
||||
)
|
||||
SessionCommand(
|
||||
CustomMediaNotificationProvider.Companion.COMMAND.SEEK_FORWARD.stringValue,
|
||||
Bundle.EMPTY
|
||||
)
|
||||
)
|
||||
.add(
|
||||
SessionCommand(
|
||||
VideoPlaybackService.Companion.COMMAND.SEEK_BACKWARD.stringValue,
|
||||
Bundle.EMPTY
|
||||
CustomMediaNotificationProvider.Companion.COMMAND.SEEK_BACKWARD.stringValue,
|
||||
Bundle.EMPTY
|
||||
)
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
.add(
|
||||
SessionCommand(
|
||||
CustomMediaNotificationProvider.Companion.COMMAND.TOGGLE_PLAY.stringValue,
|
||||
Bundle.EMPTY
|
||||
)
|
||||
).build()
|
||||
).build()
|
||||
} catch (e: Exception) {
|
||||
return MediaSession.ConnectionResult.reject()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPostConnect(session: MediaSession, controller: MediaSession.ControllerInfo) {
|
||||
session.setCustomLayout(buildCustomButtons())
|
||||
super.onPostConnect(session, controller)
|
||||
}
|
||||
|
||||
override fun onCustomCommand(
|
||||
session: MediaSession,
|
||||
controller: MediaSession.ControllerInfo,
|
||||
customCommand: SessionCommand,
|
||||
args: Bundle
|
||||
): ListenableFuture<SessionResult> {
|
||||
VideoPlaybackService.Companion.handleCommand(
|
||||
VideoPlaybackService.Companion.commandFromString(
|
||||
customCommand.customAction
|
||||
), session
|
||||
CustomMediaNotificationProvider.Companion.handleCommand(
|
||||
CustomMediaNotificationProvider.Companion.commandFromString(
|
||||
customCommand.customAction
|
||||
), session
|
||||
)
|
||||
|
||||
return super.onCustomCommand(session, controller, customCommand, args)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
package com.twg.video.core.services.playback
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.Intent
|
||||
import android.os.Binder
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.lifecycle.OnLifecycleEvent
|
||||
import androidx.media3.common.util.BitmapLoader
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.session.CommandButton
|
||||
import androidx.media3.session.DefaultMediaNotificationProvider
|
||||
import androidx.media3.session.SimpleBitmapLoader
|
||||
import androidx.media3.session.MediaSession
|
||||
import androidx.media3.session.MediaSessionService
|
||||
import androidx.media3.session.MediaStyleNotificationHelper
|
||||
import androidx.media3.session.SessionCommand
|
||||
import androidx.media3.ui.R
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
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 okhttp3.internal.immutableListOf
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class VideoPlaybackServiceBinder(val service: VideoPlaybackService): Binder()
|
||||
|
||||
@@ -32,26 +29,28 @@ class VideoPlaybackServiceBinder(val service: VideoPlaybackService): Binder()
|
||||
class VideoPlaybackService : MediaSessionService() {
|
||||
private var mediaSessionsList = mutableMapOf<HybridVideoPlayer, MediaSession>()
|
||||
private var binder = VideoPlaybackServiceBinder(this)
|
||||
private var sourceActivity: Class<Activity>? = null
|
||||
private var placeholderCanceled = false
|
||||
private var sourceActivity: Class<Activity>? = null // retained for future deep-links; currently unused
|
||||
private var isForeground = false
|
||||
|
||||
// Controls for Android 13+ - see buildNotification function
|
||||
private val commandSeekForward = SessionCommand(COMMAND.SEEK_FORWARD.stringValue, Bundle.EMPTY)
|
||||
private val commandSeekBackward = SessionCommand(COMMAND.SEEK_BACKWARD.stringValue, Bundle.EMPTY)
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
setMediaNotificationProvider(CustomMediaNotificationProvider(this))
|
||||
}
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
private val seekForwardBtn = CommandButton.Builder()
|
||||
.setDisplayName("forward")
|
||||
.setSessionCommand(commandSeekForward)
|
||||
.setIconResId(R.drawable.exo_notification_fastforward)
|
||||
.build()
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
// Ensure we call startForeground quickly on newer Android versions to avoid
|
||||
// ForegroundServiceDidNotStartInTimeException when startForegroundService(...) was used.
|
||||
try {
|
||||
if (!isForeground && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForeground(PLACEHOLDER_NOTIFICATION_ID, createPlaceholderNotification())
|
||||
isForeground = true
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
Log.e(TAG, "Failed to start foreground service!")
|
||||
}
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
private val seekBackwardBtn = CommandButton.Builder()
|
||||
.setDisplayName("backward")
|
||||
.setSessionCommand(commandSeekBackward)
|
||||
.setIconResId(R.drawable.exo_notification_rewind)
|
||||
.build()
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
// Player Registry
|
||||
fun registerPlayer(player: HybridVideoPlayer, from: Class<Activity>) {
|
||||
@@ -60,27 +59,54 @@ class VideoPlaybackService : MediaSessionService() {
|
||||
}
|
||||
sourceActivity = from
|
||||
|
||||
val mediaSession = MediaSession.Builder(this, player.player)
|
||||
val builder = MediaSession.Builder(this, player.player)
|
||||
.setId("RNVideoPlaybackService_" + player.hashCode())
|
||||
.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
|
||||
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) {
|
||||
hidePlayerNotification(player.player)
|
||||
val session = mediaSessionsList.remove(player)
|
||||
session?.release()
|
||||
if (mediaSessionsList.isEmpty()) {
|
||||
cleanup()
|
||||
stopSelf()
|
||||
stopIfNoPlayers()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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?) {
|
||||
stopForegroundSafely()
|
||||
cleanup()
|
||||
stopSelf()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
stopForegroundSafely()
|
||||
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()
|
||||
}
|
||||
|
||||
private fun buildNotification(session: MediaSession): Notification {
|
||||
val returnToPlayer = Intent(this, sourceActivity ?: this.javaClass).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
private fun stopForegroundSafely() {
|
||||
try {
|
||||
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() {
|
||||
hideAllNotifications()
|
||||
stopForegroundSafely()
|
||||
stopSelf()
|
||||
mediaSessionsList.forEach { (_, session) ->
|
||||
session.release()
|
||||
}
|
||||
mediaSessionsList.clear()
|
||||
placeholderCanceled = false
|
||||
}
|
||||
|
||||
private fun createPlaceholderNotification(): Notification {
|
||||
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
notificationManager.createNotificationChannel(
|
||||
NotificationChannel(
|
||||
NOTIFICATION_CHANEL_ID,
|
||||
NOTIFICATION_CHANEL_ID,
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
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)
|
||||
// Stop the service if there are no active media sessions (no players need it)
|
||||
fun stopIfNoPlayers() {
|
||||
if (mediaSessionsList.isEmpty()) {
|
||||
// Remove placeholder notification and stop the service when no active players exist
|
||||
try {
|
||||
if (isForeground) {
|
||||
stopForegroundSafely()
|
||||
isForeground = false
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
Log.e(TAG, "Failed to stop foreground service!")
|
||||
}
|
||||
|
||||
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)
|
||||
cleanup()
|
||||
}
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val SEEK_INTERVAL_MS = 10000L
|
||||
private const val TAG = "VideoPlaybackService"
|
||||
private const val PLACEHOLDER_NOTIFICATION_ID = 9999
|
||||
|
||||
const val NOTIFICATION_CHANEL_ID = "RNVIDEO_SESSION_NOTIFICATION"
|
||||
const val TAG = "VideoPlaybackService"
|
||||
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) {
|
||||
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 createPlaceholderNotification(): Notification {
|
||||
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
try {
|
||||
val channel = NotificationChannel(
|
||||
NOTIFICATION_CHANNEL_ID,
|
||||
"Media playback",
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
)
|
||||
channel.setShowBadge(false)
|
||||
nm.createNotificationChannel(channel)
|
||||
} catch (_: Exception) {
|
||||
Log.e(TAG, "Failed to create notification channel!")
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,10 @@ class VideoPlaybackServiceConnection (private val player: WeakReference<HybridVi
|
||||
}
|
||||
|
||||
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) {
|
||||
Log.e("VideoPlaybackServiceConnection", "Could not bind to playback service", err)
|
||||
}
|
||||
|
||||
@@ -102,6 +102,23 @@ class HybridVideoPlayer() : HybridVideoPlayerSpec() {
|
||||
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
|
||||
override var currentTime: Double by mainThreadProperty(
|
||||
get = { player.currentPosition.toDouble() / 1000.0 },
|
||||
@@ -172,16 +189,18 @@ class HybridVideoPlayer() : HybridVideoPlayerSpec() {
|
||||
|
||||
override var playInBackground: Boolean = false
|
||||
set(value) {
|
||||
// playback in background was disabled and is now enabled
|
||||
if (value == true && field == false) {
|
||||
val shouldRun = (value || showNotificationControls)
|
||||
val wasRunning = (field || showNotificationControls)
|
||||
|
||||
if (shouldRun && !wasRunning) {
|
||||
VideoPlaybackService.startService(context, videoPlaybackServiceConnection)
|
||||
field = true
|
||||
}
|
||||
// playback in background was enabled and is now disabled
|
||||
else if (field == true) {
|
||||
if (!shouldRun && wasRunning) {
|
||||
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
|
||||
@@ -323,7 +342,7 @@ class HybridVideoPlayer() : HybridVideoPlayerSpec() {
|
||||
}
|
||||
|
||||
private fun release() {
|
||||
if (playInBackground) {
|
||||
if (playInBackground || showNotificationControls) {
|
||||
VideoPlaybackService.stopService(this, videoPlaybackServiceConnection)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,16 @@ import com.facebook.proguard.annotations.DoNotStrip
|
||||
@DoNotStrip
|
||||
class HybridVideoPlayerSourceFactory: HybridVideoPlayerSourceFactorySpec() {
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,12 @@ class HybridVideoViewViewManager(nitroId: Int): HybridVideoViewViewManagerSpec()
|
||||
videoView.get()?.keepScreenAwake = value
|
||||
}
|
||||
|
||||
override var surfaceType: SurfaceType
|
||||
get() = videoView.get()?.surfaceType ?: SurfaceType.SURFACE
|
||||
set(value) {
|
||||
videoView.get()?.surfaceType = value
|
||||
}
|
||||
|
||||
// View callbacks
|
||||
override var onPictureInPictureChange: ((Boolean) -> Unit)? = null
|
||||
set(value) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
@@ -22,6 +23,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.margelo.nitro.NitroModules
|
||||
import com.margelo.nitro.video.HybridVideoPlayer
|
||||
import com.margelo.nitro.video.ResizeMode
|
||||
import com.margelo.nitro.video.SurfaceType
|
||||
import com.margelo.nitro.video.VideoViewEvents
|
||||
import com.twg.video.core.LibraryError
|
||||
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.createDisabledPictureInPictureParams
|
||||
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
|
||||
class VideoView @JvmOverloads constructor(
|
||||
@@ -90,6 +94,20 @@ class VideoView @JvmOverloads constructor(
|
||||
|
||||
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
|
||||
set(value) {
|
||||
field = value
|
||||
@@ -101,7 +119,9 @@ class VideoView @JvmOverloads constructor(
|
||||
var keepScreenAwake: Boolean
|
||||
get() = playerView.keepScreenOn
|
||||
set(value) {
|
||||
playerView.keepScreenOn = value
|
||||
runOnMainThread {
|
||||
playerView.keepScreenOn = value
|
||||
}
|
||||
}
|
||||
|
||||
var events = object : VideoViewEvents {
|
||||
@@ -114,15 +134,7 @@ class VideoView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
var onNitroIdChange: ((Int?) -> Unit)? = null
|
||||
var playerView = PlayerView(context).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()
|
||||
}
|
||||
var playerView = createPlayerView()
|
||||
var isInFullscreen: Boolean = false
|
||||
set(value) {
|
||||
field = value
|
||||
@@ -153,6 +165,22 @@ class VideoView @JvmOverloads constructor(
|
||||
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 {
|
||||
measure(
|
||||
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
||||
|
||||
@@ -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" />
|
||||
@@ -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"
|
||||
/>
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,16 @@ class VideoManager {
|
||||
updateAudioSessionConfiguration()
|
||||
}
|
||||
|
||||
// MARK: - Remote Control Events
|
||||
func setRemoteControlEventsActive(_ active: Bool) {
|
||||
if isAudioSessionManagementDisabled || remoteControlEventsActive == active {
|
||||
return
|
||||
}
|
||||
|
||||
remoteControlEventsActive = active
|
||||
requestAudioSessionUpdate()
|
||||
}
|
||||
|
||||
// MARK: - Audio Session Management
|
||||
private func activateAudioSession() {
|
||||
if isAudioSessionActive {
|
||||
@@ -133,7 +143,11 @@ class VideoManager {
|
||||
player.mixAudioMode == .donotmix
|
||||
}
|
||||
|
||||
if isAnyPlayerPlaying || anyPlayerNeedsNotMixWithOthers {
|
||||
let anyPlayerNeedsNotificationControls = players.allObjects.contains { player in
|
||||
player.showNotificationControls
|
||||
}
|
||||
|
||||
if isAnyPlayerPlaying || anyPlayerNeedsNotMixWithOthers || anyPlayerNeedsNotificationControls || remoteControlEventsActive {
|
||||
activateAudioSession()
|
||||
} else {
|
||||
deactivateAudioSession()
|
||||
@@ -162,6 +176,10 @@ class VideoManager {
|
||||
player.playInBackground
|
||||
}
|
||||
|
||||
let anyPlayerNeedsNotificationControls = players.allObjects.contains { player in
|
||||
player.showNotificationControls
|
||||
}
|
||||
|
||||
if isAudioSessionManagementDisabled {
|
||||
return
|
||||
}
|
||||
@@ -172,7 +190,7 @@ class VideoManager {
|
||||
earpiece: false, // TODO: Pass actual value after we add prop
|
||||
pip: anyViewNeedsPictureInPicture,
|
||||
backgroundPlayback: anyPlayerNeedsBackgroundPlayback,
|
||||
notificationControls: false // TODO: Pass actual value after we add prop
|
||||
notificationControls: anyPlayerNeedsNotificationControls
|
||||
)
|
||||
|
||||
let audioMixingMode = determineAudioMixingMode()
|
||||
|
||||
@@ -22,6 +22,7 @@ extension HybridVideoPlayer: VideoPlayerObserverDelegate {
|
||||
|
||||
func onRateChanged(rate: Float) {
|
||||
eventEmitter.onPlaybackRateChange(Double(rate))
|
||||
NowPlayingInfoCenterManager.shared.updateNowPlayingInfo()
|
||||
updateAndEmitPlaybackState()
|
||||
}
|
||||
|
||||
|
||||
@@ -158,6 +158,16 @@ class HybridVideoPlayer: HybridVideoPlayerSpec, NativeVideoPlayerSpec {
|
||||
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> {
|
||||
return Promise.async { [weak self] in
|
||||
guard let self else {
|
||||
@@ -174,6 +184,7 @@ class HybridVideoPlayer: HybridVideoPlayerSpec, NativeVideoPlayerSpec {
|
||||
}
|
||||
|
||||
func release() {
|
||||
NowPlayingInfoCenterManager.shared.removePlayer(player: player)
|
||||
self.player.replaceCurrentItem(with: nil)
|
||||
self.playerItem = nil
|
||||
|
||||
@@ -270,6 +281,7 @@ class HybridVideoPlayer: HybridVideoPlayerSpec, NativeVideoPlayerSpec {
|
||||
self.source = source
|
||||
self.playerItem = try await self.initializePlayerItem()
|
||||
self.player.replaceCurrentItem(with: self.playerItem)
|
||||
NowPlayingInfoCenterManager.shared.updateNowPlayingInfo()
|
||||
promise.resolve(withResult: ())
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,22 @@
|
||||
import Foundation
|
||||
|
||||
class HybridVideoPlayerSourceFactory: HybridVideoPlayerSourceFactorySpec {
|
||||
func fromVideoConfig(config: NativeVideoConfig) throws -> any HybridVideoPlayerSourceSpec {
|
||||
func fromVideoConfig(config: NativeVideoConfig) throws
|
||||
-> any HybridVideoPlayerSourceSpec
|
||||
{
|
||||
return try HybridVideoPlayerSource(config: config)
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,9 @@ class HybridVideoViewViewManager: HybridVideoViewViewManagerSpec {
|
||||
}
|
||||
}
|
||||
|
||||
// Android only - no-op on iOS
|
||||
var surfaceType: SurfaceType = .surface
|
||||
|
||||
func enterFullscreen() throws {
|
||||
guard let view else {
|
||||
throw VideoViewError.viewIsDeallocated.error()
|
||||
|
||||
@@ -148,6 +148,9 @@ import AVKit
|
||||
controller.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
controller.view.backgroundColor = .clear
|
||||
|
||||
// We manage this manually in NowPlayingInfoCenterManager
|
||||
controller.updatesNowPlayingInfoCenter = false
|
||||
|
||||
if #available(iOS 16.0, *) {
|
||||
if let initialSpeed = controller.speeds.first(where: { $0.rate == player.rate }) {
|
||||
controller.selectSpeed(initialSpeed)
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
# 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
|
||||
include_directories(
|
||||
"../nitrogen/generated/shared/c++"
|
||||
@@ -44,12 +50,9 @@ target_sources(
|
||||
../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
|
||||
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
||||
target_compile_definitions(
|
||||
target_compile_definitions(
|
||||
ReactNativeVideo PRIVATE
|
||||
-DFOLLY_NO_CONFIG=1
|
||||
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
||||
|
||||
@@ -75,8 +75,7 @@ int initialize(JavaVM* vm) {
|
||||
[]() -> std::shared_ptr<HybridObject> {
|
||||
static DefaultConstructableObject<JHybridVideoPlayerFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoPlayerFactory");
|
||||
auto instance = object.create();
|
||||
auto globalRef = jni::make_global(instance);
|
||||
return globalRef->cthis()->shared();
|
||||
return instance->cthis()->shared();
|
||||
}
|
||||
);
|
||||
HybridObjectRegistry::registerHybridObjectConstructor(
|
||||
@@ -84,8 +83,7 @@ int initialize(JavaVM* vm) {
|
||||
[]() -> std::shared_ptr<HybridObject> {
|
||||
static DefaultConstructableObject<JHybridVideoPlayerSourceFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoPlayerSourceFactory");
|
||||
auto instance = object.create();
|
||||
auto globalRef = jni::make_global(instance);
|
||||
return globalRef->cthis()->shared();
|
||||
return instance->cthis()->shared();
|
||||
}
|
||||
);
|
||||
HybridObjectRegistry::registerHybridObjectConstructor(
|
||||
@@ -93,8 +91,7 @@ int initialize(JavaVM* vm) {
|
||||
[]() -> std::shared_ptr<HybridObject> {
|
||||
static DefaultConstructableObject<JHybridVideoViewViewManagerFactorySpec::javaobject> object("com/margelo/nitro/video/HybridVideoViewViewManagerFactory");
|
||||
auto instance = object.create();
|
||||
auto globalRef = jni::make_global(instance);
|
||||
return globalRef->cthis()->shared();
|
||||
return instance->cthis()->shared();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -50,7 +50,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.width.has_value() ? jni::JDouble::valueOf(value.width.value()) : nullptr,
|
||||
value.height.has_value() ? jni::JDouble::valueOf(value.height.value()) : nullptr
|
||||
|
||||
@@ -78,7 +78,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.minBufferMs.has_value() ? jni::JDouble::valueOf(value.minBufferMs.value()) : nullptr,
|
||||
value.maxBufferMs.has_value() ? jni::JDouble::valueOf(value.maxBufferMs.value()) : nullptr,
|
||||
|
||||
74
packages/react-native-video/nitrogen/generated/android/c++/JCustomVideoMetadata.hpp
generated
Normal file
74
packages/react-native-video/nitrogen/generated/android/c++/JCustomVideoMetadata.hpp
generated
Normal 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
|
||||
@@ -25,6 +25,8 @@ namespace margelo::nitro::video { struct BufferConfig; }
|
||||
namespace margelo::nitro::video { struct LivePlaybackParams; }
|
||||
// Forward declaration of `Resolution` to properly resolve imports.
|
||||
namespace margelo::nitro::video { struct Resolution; }
|
||||
// Forward declaration of `CustomVideoMetadata` to properly resolve imports.
|
||||
namespace margelo::nitro::video { struct CustomVideoMetadata; }
|
||||
|
||||
#include <memory>
|
||||
#include "HybridVideoPlayerSourceSpec.hpp"
|
||||
@@ -53,6 +55,8 @@ namespace margelo::nitro::video { struct Resolution; }
|
||||
#include "JLivePlaybackParams.hpp"
|
||||
#include "Resolution.hpp"
|
||||
#include "JResolution.hpp"
|
||||
#include "CustomVideoMetadata.hpp"
|
||||
#include "JCustomVideoMetadata.hpp"
|
||||
|
||||
namespace margelo::nitro::video {
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace margelo::nitro::video { struct BufferConfig; }
|
||||
namespace margelo::nitro::video { struct LivePlaybackParams; }
|
||||
// Forward declaration of `Resolution` to properly resolve imports.
|
||||
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.
|
||||
namespace margelo::nitro::video { struct VideoInformation; }
|
||||
// Forward declaration of `VideoOrientation` to properly resolve imports.
|
||||
@@ -52,6 +54,8 @@ namespace margelo::nitro::video { enum class VideoOrientation; }
|
||||
#include "JLivePlaybackParams.hpp"
|
||||
#include "Resolution.hpp"
|
||||
#include "JResolution.hpp"
|
||||
#include "CustomVideoMetadata.hpp"
|
||||
#include "JCustomVideoMetadata.hpp"
|
||||
#include "VideoInformation.hpp"
|
||||
#include "JVideoInformation.hpp"
|
||||
#include "VideoOrientation.hpp"
|
||||
|
||||
@@ -72,6 +72,15 @@ namespace margelo::nitro::video {
|
||||
auto __result = method(_javaPart);
|
||||
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() {
|
||||
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JVideoPlayerStatus>()>("getStatus");
|
||||
auto __result = method(_javaPart);
|
||||
|
||||
@@ -51,6 +51,8 @@ namespace margelo::nitro::video {
|
||||
// Properties
|
||||
std::shared_ptr<HybridVideoPlayerSourceSpec> getSource() override;
|
||||
std::shared_ptr<HybridVideoPlayerEventEmitterSpec> getEventEmitter() override;
|
||||
bool getShowNotificationControls() override;
|
||||
void setShowNotificationControls(bool showNotificationControls) override;
|
||||
VideoPlayerStatus getStatus() override;
|
||||
double getDuration() override;
|
||||
double getVolume() override;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
namespace margelo::nitro::video { class HybridVideoPlayerSpec; }
|
||||
// Forward declaration of `ResizeMode` to properly resolve imports.
|
||||
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 "HybridVideoPlayerSpec.hpp"
|
||||
@@ -18,6 +20,8 @@ namespace margelo::nitro::video { enum class ResizeMode; }
|
||||
#include "JHybridVideoPlayerSpec.hpp"
|
||||
#include "ResizeMode.hpp"
|
||||
#include "JResizeMode.hpp"
|
||||
#include "SurfaceType.hpp"
|
||||
#include "JSurfaceType.hpp"
|
||||
#include <functional>
|
||||
#include "JFunc_void_bool.hpp"
|
||||
#include "JFunc_void.hpp"
|
||||
@@ -99,6 +103,15 @@ namespace margelo::nitro::video {
|
||||
static const auto method = javaClassStatic()->getMethod<void(jboolean /* keepScreenAwake */)>("setKeepScreenAwake");
|
||||
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() {
|
||||
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_bool::javaobject>()>("getOnPictureInPictureChange_cxx");
|
||||
auto __result = method(_javaPart);
|
||||
|
||||
@@ -61,6 +61,8 @@ namespace margelo::nitro::video {
|
||||
void setResizeMode(ResizeMode resizeMode) override;
|
||||
bool getKeepScreenAwake() override;
|
||||
void setKeepScreenAwake(bool keepScreenAwake) override;
|
||||
SurfaceType getSurfaceType() override;
|
||||
void setSurfaceType(SurfaceType surfaceType) override;
|
||||
std::optional<std::function<void(bool /* isInPictureInPicture */)>> getOnPictureInPictureChange() override;
|
||||
void setOnPictureInPictureChange(const std::optional<std::function<void(bool /* isInPictureInPicture */)>>& onPictureInPictureChange) override;
|
||||
std::optional<std::function<void(bool /* fullscreen */)>> getOnFullscreenChange() override;
|
||||
|
||||
@@ -56,7 +56,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.maxPlaybackSpeed.has_value() ? jni::JDouble::valueOf(value.maxPlaybackSpeed.value()) : nullptr,
|
||||
value.maxOffsetMs.has_value() ? jni::JDouble::valueOf(value.maxOffsetMs.value()) : nullptr,
|
||||
|
||||
@@ -87,7 +87,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.licenseUrl.has_value() ? jni::make_jstring(value.licenseUrl.value()) : nullptr,
|
||||
value.certificateUrl.has_value() ? jni::make_jstring(value.certificateUrl.value()) : nullptr,
|
||||
|
||||
@@ -55,7 +55,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.label),
|
||||
JSubtitleType::fromCpp(value.type),
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
#include "NativeVideoConfig.hpp"
|
||||
|
||||
#include "BufferConfig.hpp"
|
||||
#include "CustomVideoMetadata.hpp"
|
||||
#include "JBufferConfig.hpp"
|
||||
#include "JCustomVideoMetadata.hpp"
|
||||
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp"
|
||||
#include "JLivePlaybackParams.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);
|
||||
static const auto fieldBufferConfig = clazz->getField<JBufferConfig>("bufferConfig");
|
||||
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");
|
||||
jni::local_ref<jni::JBoolean> initializeOnCreation = this->getFieldValue(fieldInitializeOnCreation);
|
||||
return NativeVideoConfig(
|
||||
@@ -86,6 +90,7 @@ namespace margelo::nitro::video {
|
||||
return __map;
|
||||
}()) : 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
|
||||
);
|
||||
}
|
||||
@@ -96,7 +101,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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),
|
||||
value.externalSubtitles.has_value() ? [&]() {
|
||||
size_t __size = value.externalSubtitles.value().size();
|
||||
@@ -116,6 +125,7 @@ namespace margelo::nitro::video {
|
||||
return __map;
|
||||
}() : 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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.licenseUrl),
|
||||
jni::make_jstring(value.keyUrl),
|
||||
|
||||
@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.height
|
||||
);
|
||||
|
||||
59
packages/react-native-video/nitrogen/generated/android/c++/JSurfaceType.hpp
generated
Normal file
59
packages/react-native-video/nitrogen/generated/android/c++/JSurfaceType.hpp
generated
Normal 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
|
||||
@@ -54,7 +54,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.label),
|
||||
value.language.has_value() ? jni::make_jstring(value.language.value()) : nullptr,
|
||||
|
||||
@@ -56,7 +56,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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();
|
||||
jni::local_ref<jni::JArrayClass<JTimedMetadataObject>> __array = jni::JArrayClass<JTimedMetadataObject>::newArray(__size);
|
||||
|
||||
@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.identifier)
|
||||
);
|
||||
|
||||
@@ -66,7 +66,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.width,
|
||||
value.height,
|
||||
|
||||
@@ -57,7 +57,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.duration,
|
||||
value.height,
|
||||
|
||||
@@ -51,7 +51,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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),
|
||||
std::dynamic_pointer_cast<JHybridVideoPlayerSourceSpec>(value.source)->getJavaPart()
|
||||
);
|
||||
|
||||
@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.isBuffering
|
||||
);
|
||||
|
||||
@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.bufferDuration
|
||||
);
|
||||
|
||||
@@ -47,7 +47,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
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.muted
|
||||
);
|
||||
|
||||
@@ -17,19 +17,27 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class BandwidthData
|
||||
data class BandwidthData(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
val bitrate: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val width: Double?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val height: Double?
|
||||
) {
|
||||
private companion object {
|
||||
/**
|
||||
* Constructor called from C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val bitrate: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val width: Double?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val height: Double?
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(bitrate: Double, width: Double?, height: Double?): BandwidthData {
|
||||
return BandwidthData(bitrate, width, height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,43 +17,51 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class BufferConfig
|
||||
data class BufferConfig(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
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?
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
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 {
|
||||
return BufferConfig(livePlayback, minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs, backBufferDurationMs, preferredForwardBufferDurationMs, preferredPeakBitRate, preferredMaximumResolution, preferredPeakBitRateForExpensiveNetworks, preferredMaximumResolutionForExpensiveNetworks)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,6 +309,6 @@ abstract class HybridVideoPlayerEventEmitterSpec: HybridObject() {
|
||||
private external fun initHybrid(): HybridData
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HybridVideoPlayerEventEmitterSpec"
|
||||
protected const val TAG = "HybridVideoPlayerEventEmitterSpec"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,6 @@ abstract class HybridVideoPlayerFactorySpec: HybridObject() {
|
||||
private external fun initHybrid(): HybridData
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HybridVideoPlayerFactorySpec"
|
||||
protected const val TAG = "HybridVideoPlayerFactorySpec"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,6 @@ abstract class HybridVideoPlayerSourceFactorySpec: HybridObject() {
|
||||
private external fun initHybrid(): HybridData
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HybridVideoPlayerSourceFactorySpec"
|
||||
protected const val TAG = "HybridVideoPlayerSourceFactorySpec"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,6 @@ abstract class HybridVideoPlayerSourceSpec: HybridObject() {
|
||||
private external fun initHybrid(): HybridData
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HybridVideoPlayerSourceSpec"
|
||||
protected const val TAG = "HybridVideoPlayerSourceSpec"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,12 @@ abstract class HybridVideoPlayerSpec: HybridObject() {
|
||||
@get:Keep
|
||||
abstract val eventEmitter: HybridVideoPlayerEventEmitterSpec
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
@set:DoNotStrip
|
||||
@set:Keep
|
||||
abstract var showNotificationControls: Boolean
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
abstract val status: VideoPlayerStatus
|
||||
@@ -155,6 +161,6 @@ abstract class HybridVideoPlayerSpec: HybridObject() {
|
||||
private external fun initHybrid(): HybridData
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HybridVideoPlayerSpec"
|
||||
protected const val TAG = "HybridVideoPlayerSpec"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,6 @@ abstract class HybridVideoViewViewManagerFactorySpec: HybridObject() {
|
||||
private external fun initHybrid(): HybridData
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HybridVideoViewViewManagerFactorySpec"
|
||||
protected const val TAG = "HybridVideoViewViewManagerFactorySpec"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,12 @@ abstract class HybridVideoViewViewManagerSpec: HybridObject() {
|
||||
@set:Keep
|
||||
abstract var keepScreenAwake: Boolean
|
||||
|
||||
@get:DoNotStrip
|
||||
@get:Keep
|
||||
@set:DoNotStrip
|
||||
@set:Keep
|
||||
abstract var surfaceType: SurfaceType
|
||||
|
||||
abstract var onPictureInPictureChange: ((isInPictureInPicture: Boolean) -> Unit)?
|
||||
|
||||
private var onPictureInPictureChange_cxx: Func_void_bool?
|
||||
@@ -181,6 +187,6 @@ abstract class HybridVideoViewViewManagerSpec: HybridObject() {
|
||||
private external fun initHybrid(): HybridData
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HybridVideoViewViewManagerSpec"
|
||||
protected const val TAG = "HybridVideoViewViewManagerSpec"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,25 +17,33 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class LivePlaybackParams
|
||||
data class LivePlaybackParams(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
val minPlaybackSpeed: Double?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val maxPlaybackSpeed: Double?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val maxOffsetMs: Double?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val minOffsetMs: Double?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val targetOffsetMs: Double?
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(minPlaybackSpeed: Double?, maxPlaybackSpeed: Double?, maxOffsetMs: Double?, minOffsetMs: Double?, targetOffsetMs: Double?): LivePlaybackParams {
|
||||
return LivePlaybackParams(minPlaybackSpeed, maxPlaybackSpeed, maxOffsetMs, minOffsetMs, targetOffsetMs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,35 +17,39 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class NativeDrmParams
|
||||
data class NativeDrmParams(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
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: 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) })
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
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 {
|
||||
return NativeDrmParams(type, licenseUrl, certificateUrl, contentId, licenseHeaders, multiSession, getLicense?.let { it })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,22 +17,30 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class NativeExternalSubtitle
|
||||
data class NativeExternalSubtitle(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
val uri: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val label: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val type: SubtitleType,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val language: String
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(uri: String, label: String, type: SubtitleType, language: String): NativeExternalSubtitle {
|
||||
return NativeExternalSubtitle(uri, label, type, language)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,28 +17,39 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class NativeVideoConfig
|
||||
data class NativeVideoConfig(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
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 initializeOnCreation: Boolean?
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(uri: String, externalSubtitles: Array<NativeExternalSubtitle>?, drm: NativeDrmParams?, headers: Map<String, String>?, bufferConfig: BufferConfig?, metadata: CustomVideoMetadata?, initializeOnCreation: Boolean?): NativeVideoConfig {
|
||||
return NativeVideoConfig(uri, externalSubtitles, drm, headers, bufferConfig, metadata, initializeOnCreation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,22 +17,30 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class OnGetLicensePayload
|
||||
data class OnGetLicensePayload(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
val contentId: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val licenseUrl: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val keyUrl: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val spc: String
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(contentId: String, licenseUrl: String, keyUrl: String, spc: String): OnGetLicensePayload {
|
||||
return OnGetLicensePayload(contentId, licenseUrl, keyUrl, spc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class Resolution
|
||||
data class Resolution(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
val width: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val height: Double
|
||||
) {
|
||||
private companion object {
|
||||
/**
|
||||
* Constructor called from C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val width: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val height: Double
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(width: Double, height: Double): Resolution {
|
||||
return Resolution(width, height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
21
packages/react-native-video/nitrogen/generated/android/kotlin/com/margelo/nitro/video/SurfaceType.kt
generated
Normal file
21
packages/react-native-video/nitrogen/generated/android/kotlin/com/margelo/nitro/video/SurfaceType.kt
generated
Normal 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);
|
||||
}
|
||||
@@ -17,22 +17,30 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class TextTrack
|
||||
data class TextTrack(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
val id: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val label: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val language: String?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val selected: Boolean
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(id: String, label: String, language: String?, selected: Boolean): TextTrack {
|
||||
return TextTrack(id, label, language, selected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,21 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class TimedMetadata
|
||||
data class TimedMetadata(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
val metadata: Array<TimedMetadataObject>
|
||||
) {
|
||||
private companion object {
|
||||
/**
|
||||
* Constructor called from C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val metadata: Array<TimedMetadataObject>
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(metadata: Array<TimedMetadataObject>): TimedMetadata {
|
||||
return TimedMetadata(metadata)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class TimedMetadataObject
|
||||
data class TimedMetadataObject(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
val value: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val identifier: String
|
||||
) {
|
||||
private companion object {
|
||||
/**
|
||||
* Constructor called from C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val value: String,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val identifier: String
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(value: String, identifier: String): TimedMetadataObject {
|
||||
return TimedMetadataObject(value, identifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,34 +17,42 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class VideoInformation
|
||||
data class VideoInformation(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
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
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(bitrate: Double, width: Double, height: Double, duration: Long, fileSize: Long, isHDR: Boolean, isLive: Boolean, orientation: VideoOrientation): VideoInformation {
|
||||
return VideoInformation(bitrate, width, height, duration, fileSize, isHDR, isLive, orientation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,25 +17,33 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class onLoadData
|
||||
data class onLoadData(
|
||||
@DoNotStrip
|
||||
@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
|
||||
@Keep
|
||||
val currentTime: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val duration: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val height: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val width: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val orientation: VideoOrientation
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(currentTime: Double, duration: Double, height: Double, width: Double, orientation: VideoOrientation): onLoadData {
|
||||
return onLoadData(currentTime, duration, height, width, orientation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class onLoadStartData
|
||||
data class onLoadStartData(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
val sourceType: SourceType,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val source: HybridVideoPlayerSourceSpec
|
||||
) {
|
||||
private companion object {
|
||||
/**
|
||||
* Constructor called from C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val sourceType: SourceType,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val source: HybridVideoPlayerSourceSpec
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(sourceType: SourceType, source: HybridVideoPlayerSourceSpec): onLoadStartData {
|
||||
return onLoadStartData(sourceType, source)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class onPlaybackStateChangeData
|
||||
data class onPlaybackStateChangeData(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
val isPlaying: Boolean,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val isBuffering: Boolean
|
||||
) {
|
||||
private companion object {
|
||||
/**
|
||||
* Constructor called from C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val isPlaying: Boolean,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val isBuffering: Boolean
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(isPlaying: Boolean, isBuffering: Boolean): onPlaybackStateChangeData {
|
||||
return onPlaybackStateChangeData(isPlaying, isBuffering)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class onProgressData
|
||||
data class onProgressData(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
val currentTime: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val bufferDuration: Double
|
||||
) {
|
||||
private companion object {
|
||||
/**
|
||||
* Constructor called from C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val currentTime: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val bufferDuration: Double
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(currentTime: Double, bufferDuration: Double): onProgressData {
|
||||
return onProgressData(currentTime, bufferDuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,24 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class onVolumeChangeData
|
||||
data class onVolumeChangeData(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
val volume: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val muted: Boolean
|
||||
) {
|
||||
private companion object {
|
||||
/**
|
||||
* Constructor called from C++
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val volume: Double,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val muted: Boolean
|
||||
) {
|
||||
/* main constructor */
|
||||
@Suppress("unused")
|
||||
@JvmStatic
|
||||
private fun fromCpp(volume: Double, muted: Boolean): onVolumeChangeData {
|
||||
return onVolumeChangeData(volume, muted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
namespace margelo::nitro::video::bridge::swift {
|
||||
|
||||
// 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);
|
||||
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);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
@@ -36,11 +36,11 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
@@ -52,7 +52,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
||||
swiftClosure.call();
|
||||
@@ -60,7 +60,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
||||
swiftClosure.call(error);
|
||||
@@ -68,11 +68,11 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
@@ -84,11 +84,11 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
@@ -100,7 +100,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](bool hasAudioFocus) mutable -> void {
|
||||
swiftClosure.call(hasAudioFocus);
|
||||
@@ -108,7 +108,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const BandwidthData& data) mutable -> void {
|
||||
swiftClosure.call(data);
|
||||
@@ -116,7 +116,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const onLoadData& data) mutable -> void {
|
||||
swiftClosure.call(data);
|
||||
@@ -124,7 +124,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const onLoadStartData& data) mutable -> void {
|
||||
swiftClosure.call(data);
|
||||
@@ -132,7 +132,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const onPlaybackStateChangeData& data) mutable -> void {
|
||||
swiftClosure.call(data);
|
||||
@@ -140,7 +140,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](double rate) mutable -> void {
|
||||
swiftClosure.call(rate);
|
||||
@@ -148,7 +148,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const onProgressData& data) mutable -> void {
|
||||
swiftClosure.call(data);
|
||||
@@ -156,7 +156,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const TimedMetadata& metadata) mutable -> void {
|
||||
swiftClosure.call(metadata);
|
||||
@@ -164,7 +164,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& texts) mutable -> void {
|
||||
swiftClosure.call(texts);
|
||||
@@ -172,7 +172,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const std::optional<TextTrack>& track) mutable -> void {
|
||||
swiftClosure.call(track);
|
||||
@@ -180,7 +180,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const onVolumeChangeData& data) mutable -> void {
|
||||
swiftClosure.call(data);
|
||||
@@ -188,7 +188,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](VideoPlayerStatus status) mutable -> void {
|
||||
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 */)>
|
||||
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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const std::string& result) mutable -> void {
|
||||
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 */)>
|
||||
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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const OnGetLicensePayload& payload) mutable -> std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>> {
|
||||
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 */)>
|
||||
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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr<Promise<std::string>>& result) mutable -> void {
|
||||
swiftClosure.call(result);
|
||||
@@ -221,7 +221,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
return [swiftClosure = std::move(swiftClosure)](const VideoInformation& result) mutable -> void {
|
||||
swiftClosure.call(result);
|
||||
@@ -229,11 +229,11 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
@@ -245,11 +245,11 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
@@ -261,11 +261,11 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
#ifdef NITRO_DEBUG
|
||||
if (swiftWrapper == nullptr) [[unlikely]] {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
namespace margelo::nitro::video { struct BandwidthData; }
|
||||
// Forward declaration of `BufferConfig` to properly resolve imports.
|
||||
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.
|
||||
namespace margelo::nitro::video { class HybridVideoPlayerEventEmitterSpec; }
|
||||
// Forward declaration of `HybridVideoPlayerFactorySpec` to properly resolve imports.
|
||||
@@ -82,6 +84,7 @@ namespace ReactNativeVideo { class HybridVideoViewViewManagerSpec_cxx; }
|
||||
// Include C++ defined types
|
||||
#include "BandwidthData.hpp"
|
||||
#include "BufferConfig.hpp"
|
||||
#include "CustomVideoMetadata.hpp"
|
||||
#include "HybridVideoPlayerEventEmitterSpec.hpp"
|
||||
#include "HybridVideoPlayerFactorySpec.hpp"
|
||||
#include "HybridVideoPlayerSourceFactorySpec.hpp"
|
||||
@@ -107,6 +110,7 @@ namespace ReactNativeVideo { class HybridVideoViewViewManagerSpec_cxx; }
|
||||
#include "onPlaybackStateChangeData.hpp"
|
||||
#include "onProgressData.hpp"
|
||||
#include "onVolumeChangeData.hpp"
|
||||
#include <NitroModules/FastVectorCopy.hpp>
|
||||
#include <NitroModules/Promise.hpp>
|
||||
#include <NitroModules/PromiseHolder.hpp>
|
||||
#include <NitroModules/Result.hpp>
|
||||
@@ -129,34 +133,34 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSourceSpec_(std__shared_ptr_HybridVideoPlayerSourceSpec_ cppType);
|
||||
std::shared_ptr<HybridVideoPlayerSourceSpec> create_std__shared_ptr_HybridVideoPlayerSourceSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSourceSpec_(std__shared_ptr_HybridVideoPlayerSourceSpec_ cppType);
|
||||
|
||||
// pragma MARK: 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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ cppType);
|
||||
std::shared_ptr<HybridVideoPlayerEventEmitterSpec> create_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ cppType);
|
||||
|
||||
// pragma MARK: 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>>
|
||||
/**
|
||||
* Specialized version of `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();
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -171,14 +175,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_Wrapper final {
|
||||
public:
|
||||
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()();
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void()>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void create_Func_void(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_Wrapper wrap_Func_void(Func_void value) {
|
||||
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
||||
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
||||
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 {
|
||||
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))) {}
|
||||
inline void call(std::exception_ptr error) const {
|
||||
inline void call(std::exception_ptr error) const noexcept {
|
||||
_function->operator()(error);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) {
|
||||
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) noexcept {
|
||||
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>>`.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
@@ -238,46 +254,52 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSpec_(std__shared_ptr_HybridVideoPlayerSpec_ cppType);
|
||||
std::shared_ptr<HybridVideoPlayerSpec> create_std__shared_ptr_HybridVideoPlayerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSpec_(std__shared_ptr_HybridVideoPlayerSpec_ cppType);
|
||||
|
||||
// pragma MARK: 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>>>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
// pragma MARK: 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
// pragma MARK: Result<void>
|
||||
using Result_void_ = Result<void>;
|
||||
inline Result_void_ create_Result_void_() {
|
||||
inline Result_void_ create_Result_void_() noexcept {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -286,19 +308,19 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerFactorySpec_(std__shared_ptr_HybridVideoPlayerFactorySpec_ cppType);
|
||||
std::shared_ptr<HybridVideoPlayerFactorySpec> create_std__shared_ptr_HybridVideoPlayerFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerFactorySpec_(std__shared_ptr_HybridVideoPlayerFactorySpec_ cppType);
|
||||
|
||||
// pragma MARK: 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>>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -313,14 +335,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_bool_Wrapper final {
|
||||
public:
|
||||
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);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(bool /* hasAudioFocus */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_bool create_Func_void_bool(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) {
|
||||
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) noexcept {
|
||||
return Func_void_bool_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -329,9 +351,15 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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 */)>
|
||||
/**
|
||||
@@ -344,14 +372,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_BandwidthData_Wrapper final {
|
||||
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))) {}
|
||||
inline void call(BandwidthData data) const {
|
||||
inline void call(BandwidthData data) const noexcept {
|
||||
_function->operator()(data);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const BandwidthData& /* data */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_BandwidthData create_Func_void_BandwidthData(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_BandwidthData_Wrapper wrap_Func_void_BandwidthData(Func_void_BandwidthData value) {
|
||||
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) noexcept {
|
||||
return Func_void_BandwidthData_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -366,14 +394,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_onLoadData_Wrapper final {
|
||||
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))) {}
|
||||
inline void call(onLoadData data) const {
|
||||
inline void call(onLoadData data) const noexcept {
|
||||
_function->operator()(data);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const onLoadData& /* data */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_onLoadData create_Func_void_onLoadData(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_onLoadData_Wrapper wrap_Func_void_onLoadData(Func_void_onLoadData value) {
|
||||
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) noexcept {
|
||||
return Func_void_onLoadData_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -388,14 +416,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_onLoadStartData_Wrapper final {
|
||||
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))) {}
|
||||
inline void call(onLoadStartData data) const {
|
||||
inline void call(onLoadStartData data) const noexcept {
|
||||
_function->operator()(data);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const onLoadStartData& /* data */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_onLoadStartData create_Func_void_onLoadStartData(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_onLoadStartData_Wrapper wrap_Func_void_onLoadStartData(Func_void_onLoadStartData value) {
|
||||
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) noexcept {
|
||||
return Func_void_onLoadStartData_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -410,14 +438,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_onPlaybackStateChangeData_Wrapper final {
|
||||
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))) {}
|
||||
inline void call(onPlaybackStateChangeData data) const {
|
||||
inline void call(onPlaybackStateChangeData data) const noexcept {
|
||||
_function->operator()(data);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const onPlaybackStateChangeData& /* data */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_onPlaybackStateChangeData create_Func_void_onPlaybackStateChangeData(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_onPlaybackStateChangeData_Wrapper wrap_Func_void_onPlaybackStateChangeData(Func_void_onPlaybackStateChangeData value) {
|
||||
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) noexcept {
|
||||
return Func_void_onPlaybackStateChangeData_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -432,14 +460,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_double_Wrapper final {
|
||||
public:
|
||||
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);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(double /* rate */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_double create_Func_void_double(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) {
|
||||
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) noexcept {
|
||||
return Func_void_double_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -454,14 +482,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_onProgressData_Wrapper final {
|
||||
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))) {}
|
||||
inline void call(onProgressData data) const {
|
||||
inline void call(onProgressData data) const noexcept {
|
||||
_function->operator()(data);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const onProgressData& /* data */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_onProgressData create_Func_void_onProgressData(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_onProgressData_Wrapper wrap_Func_void_onProgressData(Func_void_onProgressData value) {
|
||||
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) noexcept {
|
||||
return Func_void_onProgressData_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -470,7 +498,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
@@ -487,14 +515,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_TimedMetadata_Wrapper final {
|
||||
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))) {}
|
||||
inline void call(TimedMetadata metadata) const {
|
||||
inline void call(TimedMetadata metadata) const noexcept {
|
||||
_function->operator()(metadata);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const TimedMetadata& /* metadata */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_TimedMetadata create_Func_void_TimedMetadata(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_TimedMetadata_Wrapper wrap_Func_void_TimedMetadata(Func_void_TimedMetadata value) {
|
||||
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) noexcept {
|
||||
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>`.
|
||||
*/
|
||||
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;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
@@ -520,14 +548,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_std__vector_std__string__Wrapper final {
|
||||
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))) {}
|
||||
inline void call(std::vector<std::string> texts) const {
|
||||
inline void call(std::vector<std::string> texts) const noexcept {
|
||||
_function->operator()(texts);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const std::vector<std::string>& /* texts */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_std__vector_std__string__Wrapper wrap_Func_void_std__vector_std__string_(Func_void_std__vector_std__string_ value) {
|
||||
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) noexcept {
|
||||
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 {
|
||||
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))) {}
|
||||
inline void call(std::optional<TextTrack> track) const {
|
||||
inline void call(std::optional<TextTrack> track) const noexcept {
|
||||
_function->operator()(track);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const std::optional<TextTrack>& /* track */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_std__optional_TextTrack_ create_Func_void_std__optional_TextTrack_(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_std__optional_TextTrack__Wrapper wrap_Func_void_std__optional_TextTrack_(Func_void_std__optional_TextTrack_ value) {
|
||||
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) noexcept {
|
||||
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 {
|
||||
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))) {}
|
||||
inline void call(onVolumeChangeData data) const {
|
||||
inline void call(onVolumeChangeData data) const noexcept {
|
||||
_function->operator()(data);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const onVolumeChangeData& /* data */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_onVolumeChangeData create_Func_void_onVolumeChangeData(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_onVolumeChangeData_Wrapper wrap_Func_void_onVolumeChangeData(Func_void_onVolumeChangeData value) {
|
||||
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) noexcept {
|
||||
return Func_void_onVolumeChangeData_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -586,14 +614,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_VideoPlayerStatus_Wrapper final {
|
||||
public:
|
||||
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));
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(VideoPlayerStatus /* status */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_VideoPlayerStatus create_Func_void_VideoPlayerStatus(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_VideoPlayerStatus_Wrapper wrap_Func_void_VideoPlayerStatus(Func_void_VideoPlayerStatus value) {
|
||||
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) noexcept {
|
||||
return Func_void_VideoPlayerStatus_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
@@ -602,7 +630,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
@@ -613,21 +641,27 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* 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>;
|
||||
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;
|
||||
map.reserve(size);
|
||||
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;
|
||||
keys.reserve(map.size());
|
||||
for (const auto& entry : map) {
|
||||
@@ -635,10 +669,10 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
}
|
||||
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) {
|
||||
return map.at(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.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);
|
||||
}
|
||||
|
||||
@@ -647,28 +681,40 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* 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>>;
|
||||
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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>>
|
||||
/**
|
||||
* Specialized version of `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();
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -683,14 +729,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_std__string_Wrapper final {
|
||||
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))) {}
|
||||
inline void call(std::string result) const {
|
||||
inline void call(std::string result) const noexcept {
|
||||
_function->operator()(result);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const std::string& /* result */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_std__string create_Func_void_std__string(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) {
|
||||
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) noexcept {
|
||||
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 {
|
||||
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))) {}
|
||||
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);
|
||||
return __result;
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::string>>>>(const OnGetLicensePayload& /* payload */)>> _function;
|
||||
} 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);
|
||||
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) {
|
||||
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) noexcept {
|
||||
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>>>>`.
|
||||
*/
|
||||
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();
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -740,14 +786,14 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_std__shared_ptr_Promise_std__string___Wrapper final {
|
||||
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))) {}
|
||||
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);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const std::shared_ptr<Promise<std::string>>& /* result */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_std__shared_ptr_Promise_std__string__ create_Func_void_std__shared_ptr_Promise_std__string__(void* _Nonnull swiftClosureWrapper);
|
||||
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) {
|
||||
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) noexcept {
|
||||
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 * /)>>`.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>>
|
||||
/**
|
||||
* Specialized version of `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();
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -819,23 +910,23 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
class Func_void_VideoInformation_Wrapper final {
|
||||
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))) {}
|
||||
inline void call(VideoInformation result) const {
|
||||
inline void call(VideoInformation result) const noexcept {
|
||||
_function->operator()(result);
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<std::function<void(const VideoInformation& /* result */)>> _function;
|
||||
} SWIFT_NONCOPYABLE;
|
||||
Func_void_VideoInformation create_Func_void_VideoInformation(void* _Nonnull swiftClosureWrapper);
|
||||
inline Func_void_VideoInformation_Wrapper wrap_Func_void_VideoInformation(Func_void_VideoInformation value) {
|
||||
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) noexcept {
|
||||
return Func_void_VideoInformation_Wrapper(std::move(value));
|
||||
}
|
||||
|
||||
// pragma MARK: 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -844,19 +935,19 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
void* _Nonnull get_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ cppType);
|
||||
std::shared_ptr<HybridVideoPlayerSourceFactorySpec> create_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ cppType);
|
||||
|
||||
// pragma MARK: 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>>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -865,55 +956,79 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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 */)>>
|
||||
/**
|
||||
* 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 */)>>;
|
||||
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);
|
||||
}
|
||||
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 */)>>
|
||||
/**
|
||||
* 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 */)>>;
|
||||
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);
|
||||
}
|
||||
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()>>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
}
|
||||
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>
|
||||
/**
|
||||
* Specialized version of `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);
|
||||
void* _Nonnull get_std__shared_ptr_HybridVideoViewViewManagerSpec_(std__shared_ptr_HybridVideoViewViewManagerSpec_ cppType);
|
||||
std::shared_ptr<HybridVideoViewViewManagerSpec> create_std__shared_ptr_HybridVideoViewViewManagerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoViewViewManagerSpec_(std__shared_ptr_HybridVideoViewViewManagerSpec_ cppType);
|
||||
|
||||
// pragma MARK: 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>
|
||||
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));
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -922,19 +1037,19 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `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);
|
||||
void* _Nonnull get_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ cppType);
|
||||
std::shared_ptr<HybridVideoViewViewManagerFactorySpec> create_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ cppType);
|
||||
|
||||
// pragma MARK: 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>>
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user