mirror of
https://github.com/zoriya/react-native-video.git
synced 2025-12-05 23:06:14 +00:00
Compare commits
27 Commits
b1b5fa1717
...
feat/web
| Author | SHA1 | Date | |
|---|---|---|---|
| c80d6ebba4 | |||
| 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 |
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -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.5):
|
||||
- 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"
|
||||
|
||||
@@ -1904,8 +1904,8 @@ SPEC CHECKSUMS:
|
||||
ReactAppDependencyProvider: f334cebc0beed0a72490492e978007082c03d533
|
||||
ReactCodegen: 474fbb3e4bb0f1ee6c255d1955db76e13d509269
|
||||
ReactCommon: 7763e59534d58e15f8f22121cdfe319040e08888
|
||||
ReactNativeVideo: 705a2a90d9f04afff9afd90d4ef194e1bc1135d5
|
||||
ReactNativeVideoDrm: 62840ae0e184f711a2e6495c18e342a74cb598f8
|
||||
ReactNativeVideo: 6290dbf881cdeb58c09b5aef1af1245aebf5a207
|
||||
ReactNativeVideoDrm: 0664dcc3ccac781f6fd00329cb890b6d1f15c392
|
||||
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
|
||||
Yoga: 31a098f74c16780569aebd614a0f37a907de0189
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-video-example",
|
||||
"version": "7.0.0-alpha.5",
|
||||
"version": "7.0.0-alpha.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android": "react-native run-android",
|
||||
@@ -15,9 +15,9 @@
|
||||
"@react-native-community/slider": "^4.5.6",
|
||||
"react": "18.3.1",
|
||||
"react-native": "^0.77.0",
|
||||
"react-native-nitro-modules": "^0.29.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",
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "react-native-video-monorepo",
|
||||
"packageManager": "bun@1.1.42",
|
||||
"version": "7.0.0-alpha.5",
|
||||
"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",
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace margelo::nitro::videodrm::bridge::swift {
|
||||
ReactNativeVideoDrm::HybridPluginManagerSpec_cxx swiftPart = ReactNativeVideoDrm::HybridPluginManagerSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::videodrm::HybridPluginManagerSpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridPluginManagerSpec_(std__shared_ptr_HybridPluginManagerSpec_ cppType) noexcept {
|
||||
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]] {
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace margelo::nitro::videodrm::bridge::swift {
|
||||
*/
|
||||
using std__shared_ptr_HybridPluginManagerSpec_ = std::shared_ptr<HybridPluginManagerSpec>;
|
||||
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) 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>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@twg/react-native-video-drm",
|
||||
"version": "7.0.0-alpha.5",
|
||||
"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",
|
||||
@@ -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",
|
||||
"nitrogen": "^0.29.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.29.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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -13,6 +13,11 @@ import androidx.media3.session.DefaultMediaNotificationProvider
|
||||
import androidx.media3.session.SimpleBitmapLoader
|
||||
import androidx.media3.session.MediaSession
|
||||
import androidx.media3.session.MediaSessionService
|
||||
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 java.util.concurrent.ExecutorService
|
||||
@@ -25,12 +30,28 @@ class VideoPlaybackService : MediaSessionService() {
|
||||
private var mediaSessionsList = mutableMapOf<HybridVideoPlayer, MediaSession>()
|
||||
private var binder = VideoPlaybackServiceBinder(this)
|
||||
private var sourceActivity: Class<Activity>? = null // retained for future deep-links; currently unused
|
||||
private var isForeground = false
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
setMediaNotificationProvider(CustomMediaNotificationProvider(this))
|
||||
}
|
||||
|
||||
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!")
|
||||
}
|
||||
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
}
|
||||
|
||||
// Player Registry
|
||||
fun registerPlayer(player: HybridVideoPlayer, from: Class<Activity>) {
|
||||
if (mediaSessionsList.containsKey(player)) {
|
||||
@@ -113,7 +134,9 @@ class VideoPlaybackService : MediaSessionService() {
|
||||
private fun stopForegroundSafely() {
|
||||
try {
|
||||
stopForeground(STOP_FOREGROUND_REMOVE)
|
||||
} catch (_: Exception) {}
|
||||
} catch (_: Exception) {
|
||||
Log.e(TAG, "Failed to stop foreground service!")
|
||||
}
|
||||
}
|
||||
|
||||
private fun cleanup() {
|
||||
@@ -128,11 +151,50 @@ class VideoPlaybackService : MediaSessionService() {
|
||||
// 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!")
|
||||
}
|
||||
cleanup()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
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"
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
<androidx.media3.ui.PlayerView
|
||||
android:id="@+id/player_view_surface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:surface_type="surface_view" />
|
||||
<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" />
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
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"
|
||||
app:surface_type="texture_view" />
|
||||
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"
|
||||
/>
|
||||
@@ -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,
|
||||
|
||||
@@ -57,7 +57,11 @@ namespace margelo::nitro::video {
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
static jni::local_ref<JCustomVideoMetadata::javaobject> fromCpp(const CustomVideoMetadata& value) {
|
||||
return newInstance(
|
||||
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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -101,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();
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,25 +17,33 @@ import com.margelo.nitro.core.*
|
||||
*/
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
data class CustomVideoMetadata
|
||||
data class CustomVideoMetadata(
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
constructor(
|
||||
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
|
||||
val title: String?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val subtitle: String?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val description: String?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val artist: String?,
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
val imageUri: String?
|
||||
) {
|
||||
/* main constructor */
|
||||
@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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,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,31 +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 metadata: CustomVideoMetadata?,
|
||||
@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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
ReactNativeVideo::HybridVideoPlayerSourceSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSourceSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::video::HybridVideoPlayerSourceSpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSourceSpec_(std__shared_ptr_HybridVideoPlayerSourceSpec_ cppType) noexcept {
|
||||
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]] {
|
||||
@@ -40,7 +40,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
ReactNativeVideo::HybridVideoPlayerEventEmitterSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerEventEmitterSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::video::HybridVideoPlayerEventEmitterSpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerEventEmitterSpec_(std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ cppType) noexcept {
|
||||
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]] {
|
||||
@@ -72,7 +72,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
ReactNativeVideo::HybridVideoPlayerSpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::video::HybridVideoPlayerSpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSpec_(std__shared_ptr_HybridVideoPlayerSpec_ cppType) noexcept {
|
||||
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]] {
|
||||
@@ -88,7 +88,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
ReactNativeVideo::HybridVideoPlayerFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerFactorySpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::video::HybridVideoPlayerFactorySpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerFactorySpec_(std__shared_ptr_HybridVideoPlayerFactorySpec_ cppType) noexcept {
|
||||
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]] {
|
||||
@@ -233,7 +233,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
ReactNativeVideo::HybridVideoPlayerSourceFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoPlayerSourceFactorySpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::video::HybridVideoPlayerSourceFactorySpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoPlayerSourceFactorySpec_(std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ cppType) noexcept {
|
||||
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]] {
|
||||
@@ -249,7 +249,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
ReactNativeVideo::HybridVideoViewViewManagerSpec_cxx swiftPart = ReactNativeVideo::HybridVideoViewViewManagerSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::video::HybridVideoViewViewManagerSpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoViewViewManagerSpec_(std__shared_ptr_HybridVideoViewViewManagerSpec_ cppType) noexcept {
|
||||
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]] {
|
||||
@@ -265,7 +265,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
ReactNativeVideo::HybridVideoViewViewManagerFactorySpec_cxx swiftPart = ReactNativeVideo::HybridVideoViewViewManagerFactorySpec_cxx::fromUnsafe(swiftUnsafePointer);
|
||||
return std::make_shared<margelo::nitro::video::HybridVideoViewViewManagerFactorySpecSwift>(swiftPart);
|
||||
}
|
||||
void* NON_NULL get_std__shared_ptr_HybridVideoViewViewManagerFactorySpec_(std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ cppType) noexcept {
|
||||
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]] {
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
*/
|
||||
using std__shared_ptr_HybridVideoPlayerSourceSpec_ = std::shared_ptr<HybridVideoPlayerSourceSpec>;
|
||||
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) 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>;
|
||||
@@ -146,7 +146,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
*/
|
||||
using std__shared_ptr_HybridVideoPlayerEventEmitterSpec_ = std::shared_ptr<HybridVideoPlayerEventEmitterSpec>;
|
||||
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) 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>;
|
||||
@@ -243,11 +243,10 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `std::vector<TextTrack>`.
|
||||
*/
|
||||
using std__vector_TextTrack_ = std::vector<TextTrack>;
|
||||
inline std::vector<TextTrack> copy_std__vector_TextTrack_(const TextTrack* CONTIGUOUS_MEMORY NON_NULL data, size_t size) noexcept {
|
||||
return margelo::nitro::FastVectorCopy<TextTrack>(data, size);
|
||||
}
|
||||
inline const TextTrack* CONTIGUOUS_MEMORY NON_NULL get_data_std__vector_TextTrack_(const std::vector<TextTrack>& vector) noexcept {
|
||||
return vector.data();
|
||||
inline std::vector<TextTrack> create_std__vector_TextTrack_(size_t size) noexcept {
|
||||
std::vector<TextTrack> vector;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
}
|
||||
|
||||
// pragma MARK: std::optional<TextTrack>
|
||||
@@ -271,7 +270,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
*/
|
||||
using std__shared_ptr_HybridVideoPlayerSpec_ = std::shared_ptr<HybridVideoPlayerSpec>;
|
||||
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) 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>;
|
||||
@@ -310,7 +309,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
*/
|
||||
using std__shared_ptr_HybridVideoPlayerFactorySpec_ = std::shared_ptr<HybridVideoPlayerFactorySpec>;
|
||||
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) 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>;
|
||||
@@ -499,11 +498,10 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `std::vector<TimedMetadataObject>`.
|
||||
*/
|
||||
using std__vector_TimedMetadataObject_ = std::vector<TimedMetadataObject>;
|
||||
inline std::vector<TimedMetadataObject> copy_std__vector_TimedMetadataObject_(const TimedMetadataObject* CONTIGUOUS_MEMORY NON_NULL data, size_t size) noexcept {
|
||||
return margelo::nitro::FastVectorCopy<TimedMetadataObject>(data, size);
|
||||
}
|
||||
inline const TimedMetadataObject* CONTIGUOUS_MEMORY NON_NULL get_data_std__vector_TimedMetadataObject_(const std::vector<TimedMetadataObject>& vector) noexcept {
|
||||
return vector.data();
|
||||
inline std::vector<TimedMetadataObject> create_std__vector_TimedMetadataObject_(size_t size) noexcept {
|
||||
std::vector<TimedMetadataObject> vector;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
}
|
||||
|
||||
// pragma MARK: std::function<void(const TimedMetadata& /* metadata */)>
|
||||
@@ -632,11 +630,10 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `std::vector<NativeExternalSubtitle>`.
|
||||
*/
|
||||
using std__vector_NativeExternalSubtitle_ = std::vector<NativeExternalSubtitle>;
|
||||
inline std::vector<NativeExternalSubtitle> copy_std__vector_NativeExternalSubtitle_(const NativeExternalSubtitle* CONTIGUOUS_MEMORY NON_NULL data, size_t size) noexcept {
|
||||
return margelo::nitro::FastVectorCopy<NativeExternalSubtitle>(data, size);
|
||||
}
|
||||
inline const NativeExternalSubtitle* CONTIGUOUS_MEMORY NON_NULL get_data_std__vector_NativeExternalSubtitle_(const std::vector<NativeExternalSubtitle>& vector) noexcept {
|
||||
return vector.data();
|
||||
inline std::vector<NativeExternalSubtitle> create_std__vector_NativeExternalSubtitle_(size_t size) noexcept {
|
||||
std::vector<NativeExternalSubtitle> vector;
|
||||
vector.reserve(size);
|
||||
return vector;
|
||||
}
|
||||
|
||||
// pragma MARK: std::optional<std::vector<NativeExternalSubtitle>>
|
||||
@@ -880,9 +877,15 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
* Specialized version of `std::optional<CustomVideoMetadata>`.
|
||||
*/
|
||||
using std__optional_CustomVideoMetadata_ = std::optional<CustomVideoMetadata>;
|
||||
inline std::optional<CustomVideoMetadata> create_std__optional_CustomVideoMetadata_(const CustomVideoMetadata& value) {
|
||||
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>>
|
||||
/**
|
||||
@@ -933,7 +936,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
*/
|
||||
using std__shared_ptr_HybridVideoPlayerSourceFactorySpec_ = std::shared_ptr<HybridVideoPlayerSourceFactorySpec>;
|
||||
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) 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>;
|
||||
@@ -1014,7 +1017,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
*/
|
||||
using std__shared_ptr_HybridVideoViewViewManagerSpec_ = std::shared_ptr<HybridVideoViewViewManagerSpec>;
|
||||
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) 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>;
|
||||
@@ -1035,7 +1038,7 @@ namespace margelo::nitro::video::bridge::swift {
|
||||
*/
|
||||
using std__shared_ptr_HybridVideoViewViewManagerFactorySpec_ = std::shared_ptr<HybridVideoViewViewManagerFactorySpec>;
|
||||
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) 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>;
|
||||
|
||||
@@ -56,7 +56,8 @@ public extension CustomVideoMetadata {
|
||||
@inline(__always)
|
||||
get {
|
||||
return { () -> String? in
|
||||
if let __unwrapped = self.__title.value {
|
||||
if bridge.has_value_std__optional_std__string_(self.__title) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__title)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
@@ -79,7 +80,8 @@ public extension CustomVideoMetadata {
|
||||
@inline(__always)
|
||||
get {
|
||||
return { () -> String? in
|
||||
if let __unwrapped = self.__subtitle.value {
|
||||
if bridge.has_value_std__optional_std__string_(self.__subtitle) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__subtitle)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
@@ -102,7 +104,8 @@ public extension CustomVideoMetadata {
|
||||
@inline(__always)
|
||||
get {
|
||||
return { () -> String? in
|
||||
if let __unwrapped = self.__description.value {
|
||||
if bridge.has_value_std__optional_std__string_(self.__description) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__description)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
@@ -125,7 +128,8 @@ public extension CustomVideoMetadata {
|
||||
@inline(__always)
|
||||
get {
|
||||
return { () -> String? in
|
||||
if let __unwrapped = self.__artist.value {
|
||||
if bridge.has_value_std__optional_std__string_(self.__artist) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__artist)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
@@ -148,7 +152,8 @@ public extension CustomVideoMetadata {
|
||||
@inline(__always)
|
||||
get {
|
||||
return { () -> String? in
|
||||
if let __unwrapped = self.__imageUri.value {
|
||||
if bridge.has_value_std__optional_std__string_(self.__imageUri) {
|
||||
let __unwrapped = bridge.get_std__optional_std__string_(self.__imageUri)
|
||||
return String(__unwrapped)
|
||||
} else {
|
||||
return nil
|
||||
|
||||
@@ -305,9 +305,13 @@ open class HybridVideoPlayerSpec_cxx {
|
||||
public final func getAvailableTextTracks() -> bridge.Result_std__vector_TextTrack__ {
|
||||
do {
|
||||
let __result = try self.__implementation.getAvailableTextTracks()
|
||||
let __resultCpp = __result.withUnsafeBufferPointer { __pointer -> bridge.std__vector_TextTrack_ in
|
||||
return bridge.copy_std__vector_TextTrack_(__pointer.baseAddress!, __result.count)
|
||||
}
|
||||
let __resultCpp = { () -> bridge.std__vector_TextTrack_ in
|
||||
var __vector = bridge.create_std__vector_TextTrack_(__result.count)
|
||||
for __item in __result {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}()
|
||||
return bridge.create_Result_std__vector_TextTrack__(__resultCpp)
|
||||
} catch (let __error) {
|
||||
let __exceptionPtr = __error.toCpp()
|
||||
|
||||
@@ -210,7 +210,14 @@ public extension NativeDrmParams {
|
||||
var multiSession: Bool? {
|
||||
@inline(__always)
|
||||
get {
|
||||
return self.__multiSession.value
|
||||
return { () -> Bool? in
|
||||
if bridge.has_value_std__optional_bool_(self.__multiSession) {
|
||||
let __unwrapped = bridge.get_std__optional_bool_(self.__multiSession)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
@inline(__always)
|
||||
set {
|
||||
|
||||
@@ -21,9 +21,13 @@ public extension NativeVideoConfig {
|
||||
init(uri: String, externalSubtitles: [NativeExternalSubtitle]?, drm: NativeDrmParams?, headers: Dictionary<String, String>?, bufferConfig: BufferConfig?, metadata: CustomVideoMetadata?, initializeOnCreation: Bool?) {
|
||||
self.init(std.string(uri), { () -> bridge.std__optional_std__vector_NativeExternalSubtitle__ in
|
||||
if let __unwrappedValue = externalSubtitles {
|
||||
return bridge.create_std__optional_std__vector_NativeExternalSubtitle__(__unwrappedValue.withUnsafeBufferPointer { __pointer -> bridge.std__vector_NativeExternalSubtitle_ in
|
||||
return bridge.copy_std__vector_NativeExternalSubtitle_(__pointer.baseAddress!, __unwrappedValue.count)
|
||||
})
|
||||
return bridge.create_std__optional_std__vector_NativeExternalSubtitle__({ () -> bridge.std__vector_NativeExternalSubtitle_ in
|
||||
var __vector = bridge.create_std__vector_NativeExternalSubtitle_(__unwrappedValue.count)
|
||||
for __item in __unwrappedValue {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}())
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
@@ -83,11 +87,7 @@ public extension NativeVideoConfig {
|
||||
return { () -> [NativeExternalSubtitle]? in
|
||||
if bridge.has_value_std__optional_std__vector_NativeExternalSubtitle__(self.__externalSubtitles) {
|
||||
let __unwrapped = bridge.get_std__optional_std__vector_NativeExternalSubtitle__(self.__externalSubtitles)
|
||||
return { () -> [NativeExternalSubtitle] in
|
||||
let __data = bridge.get_data_std__vector_NativeExternalSubtitle_(__unwrapped)
|
||||
let __size = __unwrapped.size()
|
||||
return Array(UnsafeBufferPointer(start: __data, count: __size))
|
||||
}()
|
||||
return __unwrapped.map({ __item in __item })
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
@@ -97,9 +97,13 @@ public extension NativeVideoConfig {
|
||||
set {
|
||||
self.__externalSubtitles = { () -> bridge.std__optional_std__vector_NativeExternalSubtitle__ in
|
||||
if let __unwrappedValue = newValue {
|
||||
return bridge.create_std__optional_std__vector_NativeExternalSubtitle__(__unwrappedValue.withUnsafeBufferPointer { __pointer -> bridge.std__vector_NativeExternalSubtitle_ in
|
||||
return bridge.copy_std__vector_NativeExternalSubtitle_(__pointer.baseAddress!, __unwrappedValue.count)
|
||||
})
|
||||
return bridge.create_std__optional_std__vector_NativeExternalSubtitle__({ () -> bridge.std__vector_NativeExternalSubtitle_ in
|
||||
var __vector = bridge.create_std__vector_NativeExternalSubtitle_(__unwrappedValue.count)
|
||||
for __item in __unwrappedValue {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}())
|
||||
} else {
|
||||
return .init()
|
||||
}
|
||||
@@ -182,13 +186,7 @@ public extension NativeVideoConfig {
|
||||
var metadata: CustomVideoMetadata? {
|
||||
@inline(__always)
|
||||
get {
|
||||
return { () -> CustomVideoMetadata? in
|
||||
if let __unwrapped = self.__metadata.value {
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
return self.__metadata.value
|
||||
}
|
||||
@inline(__always)
|
||||
set {
|
||||
@@ -205,7 +203,14 @@ public extension NativeVideoConfig {
|
||||
var initializeOnCreation: Bool? {
|
||||
@inline(__always)
|
||||
get {
|
||||
return self.__initializeOnCreation.value
|
||||
return { () -> Bool? in
|
||||
if bridge.has_value_std__optional_bool_(self.__initializeOnCreation) {
|
||||
let __unwrapped = bridge.get_std__optional_bool_(self.__initializeOnCreation)
|
||||
return __unwrapped
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
}
|
||||
@inline(__always)
|
||||
set {
|
||||
|
||||
@@ -19,25 +19,29 @@ public extension TimedMetadata {
|
||||
* Create a new instance of `TimedMetadata`.
|
||||
*/
|
||||
init(metadata: [TimedMetadataObject]) {
|
||||
self.init(metadata.withUnsafeBufferPointer { __pointer -> bridge.std__vector_TimedMetadataObject_ in
|
||||
return bridge.copy_std__vector_TimedMetadataObject_(__pointer.baseAddress!, metadata.count)
|
||||
})
|
||||
self.init({ () -> bridge.std__vector_TimedMetadataObject_ in
|
||||
var __vector = bridge.create_std__vector_TimedMetadataObject_(metadata.count)
|
||||
for __item in metadata {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}())
|
||||
}
|
||||
|
||||
var metadata: [TimedMetadataObject] {
|
||||
@inline(__always)
|
||||
get {
|
||||
return { () -> [TimedMetadataObject] in
|
||||
let __data = bridge.get_data_std__vector_TimedMetadataObject_(self.__metadata)
|
||||
let __size = self.__metadata.size()
|
||||
return Array(UnsafeBufferPointer(start: __data, count: __size))
|
||||
}()
|
||||
return self.__metadata.map({ __item in __item })
|
||||
}
|
||||
@inline(__always)
|
||||
set {
|
||||
self.__metadata = newValue.withUnsafeBufferPointer { __pointer -> bridge.std__vector_TimedMetadataObject_ in
|
||||
return bridge.copy_std__vector_TimedMetadataObject_(__pointer.baseAddress!, newValue.count)
|
||||
}
|
||||
self.__metadata = { () -> bridge.std__vector_TimedMetadataObject_ in
|
||||
var __vector = bridge.create_std__vector_TimedMetadataObject_(newValue.count)
|
||||
for __item in newValue {
|
||||
__vector.push_back(__item)
|
||||
}
|
||||
return __vector
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -65,6 +70,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "bitrate"))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "width"))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "height"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `LivePlaybackParams` to properly resolve imports.
|
||||
namespace margelo::nitro::video { struct LivePlaybackParams; }
|
||||
@@ -94,6 +99,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::optional<margelo::nitro::video::LivePlaybackParams>>::canConvert(runtime, obj.getProperty(runtime, "livePlayback"))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "minBufferMs"))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "maxBufferMs"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +77,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "title"))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "subtitle"))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "description"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +76,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "minPlaybackSpeed"))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "maxPlaybackSpeed"))) return false;
|
||||
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "maxOffsetMs"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `OnGetLicensePayload` to properly resolve imports.
|
||||
namespace margelo::nitro::video { struct OnGetLicensePayload; }
|
||||
@@ -83,6 +88,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "licenseUrl"))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "certificateUrl"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `SubtitleType` to properly resolve imports.
|
||||
namespace margelo::nitro::video { enum class SubtitleType; }
|
||||
@@ -70,6 +75,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uri"))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "label"))) return false;
|
||||
if (!JSIConverter<margelo::nitro::video::SubtitleType>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `NativeExternalSubtitle` to properly resolve imports.
|
||||
namespace margelo::nitro::video { struct NativeExternalSubtitle; }
|
||||
@@ -91,6 +96,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uri"))) return false;
|
||||
if (!JSIConverter<std::optional<std::vector<margelo::nitro::video::NativeExternalSubtitle>>>::canConvert(runtime, obj.getProperty(runtime, "externalSubtitles"))) return false;
|
||||
if (!JSIConverter<std::optional<margelo::nitro::video::NativeDrmParams>>::canConvert(runtime, obj.getProperty(runtime, "drm"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +73,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "contentId"))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "licenseUrl"))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "keyUrl"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +67,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "width"))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "height"))) return false;
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +74,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "id"))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "label"))) return false;
|
||||
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "language"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `TimedMetadataObject` to properly resolve imports.
|
||||
namespace margelo::nitro::video { struct TimedMetadataObject; }
|
||||
@@ -61,6 +66,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::vector<margelo::nitro::video::TimedMetadataObject>>::canConvert(runtime, obj.getProperty(runtime, "metadata"))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +67,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "value"))) return false;
|
||||
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "identifier"))) return false;
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `VideoOrientation` to properly resolve imports.
|
||||
namespace margelo::nitro::video { enum class VideoOrientation; }
|
||||
@@ -81,6 +86,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "bitrate"))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "width"))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "height"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `VideoOrientation` to properly resolve imports.
|
||||
namespace margelo::nitro::video { enum class VideoOrientation; }
|
||||
@@ -72,6 +77,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "currentTime"))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "duration"))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "height"))) return false;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// Forward declaration of `SourceType` to properly resolve imports.
|
||||
namespace margelo::nitro::video { enum class SourceType; }
|
||||
@@ -67,6 +72,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<margelo::nitro::video::SourceType>::canConvert(runtime, obj.getProperty(runtime, "sourceType"))) return false;
|
||||
if (!JSIConverter<std::shared_ptr<margelo::nitro::video::HybridVideoPlayerSourceSpec>>::canConvert(runtime, obj.getProperty(runtime, "source"))) return false;
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +67,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isPlaying"))) return false;
|
||||
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isBuffering"))) return false;
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +67,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "currentTime"))) return false;
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "bufferDuration"))) return false;
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
||||
#include <NitroModules/JSIHelpers.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +67,9 @@ namespace margelo::nitro {
|
||||
return false;
|
||||
}
|
||||
jsi::Object obj = value.getObject(runtime);
|
||||
if (!nitro::isPlainObject(runtime, obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "volume"))) return false;
|
||||
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "muted"))) return false;
|
||||
return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-video",
|
||||
"version": "7.0.0-alpha.5",
|
||||
"version": "7.0.0-alpha.7",
|
||||
"description": "<Video /> Component for React Native",
|
||||
"source": "./src/index.tsx",
|
||||
"main": "./lib/commonjs/index.js",
|
||||
@@ -75,19 +75,21 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@expo/config-plugins": "^10.0.2",
|
||||
"@react-native/eslint-config": "^0.77.0",
|
||||
"@types/react": "^18.2.44",
|
||||
"@types/react-native-web": "^0.19.2",
|
||||
"del-cli": "^5.1.0",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"nitrogen": "^0.29.0",
|
||||
"nitrogen": "^0.30.0",
|
||||
"prettier": "^3.0.3",
|
||||
"react": "18.3.1",
|
||||
"react-native": "^0.77.0",
|
||||
"@react-native/eslint-config": "^0.77.0",
|
||||
"react-native-builder-bob": "^0.40.0",
|
||||
"react-native-nitro-modules": "^0.29.0",
|
||||
"typescript": "^5.2.2"
|
||||
"react-native-nitro-modules": "^0.30.0",
|
||||
"typescript": "^5.2.2",
|
||||
"video.js": "^8.23.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
import { Platform } from 'react-native';
|
||||
import { NitroModules } from 'react-native-nitro-modules';
|
||||
import { type VideoPlayer as VideoPlayerImpl } from '../spec/nitro/VideoPlayer.nitro';
|
||||
import type { VideoPlayerSource } from '../spec/nitro/VideoPlayerSource.nitro';
|
||||
import type { IgnoreSilentSwitchMode } from './types/IgnoreSilentSwitchMode';
|
||||
import type { MixAudioMode } from './types/MixAudioMode';
|
||||
import type { TextTrack } from './types/TextTrack';
|
||||
import type { NoAutocomplete } from './types/Utils';
|
||||
import type { VideoConfig, VideoSource } from './types/VideoConfig';
|
||||
import { Platform } from "react-native";
|
||||
import { NitroModules } from "react-native-nitro-modules";
|
||||
import type { VideoPlayer as VideoPlayerImpl } from "../spec/nitro/VideoPlayer.nitro";
|
||||
import type { VideoPlayerSource } from "../spec/nitro/VideoPlayerSource.nitro";
|
||||
import type { IgnoreSilentSwitchMode } from "./types/IgnoreSilentSwitchMode";
|
||||
import type { MixAudioMode } from "./types/MixAudioMode";
|
||||
import type { TextTrack } from "./types/TextTrack";
|
||||
import type { NoAutocomplete } from "./types/Utils";
|
||||
import type { VideoConfig, VideoSource } from "./types/VideoConfig";
|
||||
import {
|
||||
tryParseNativeVideoError,
|
||||
VideoRuntimeError,
|
||||
} from './types/VideoError';
|
||||
import type { VideoPlayerBase } from './types/VideoPlayerBase';
|
||||
import type { VideoPlayerStatus } from './types/VideoPlayerStatus';
|
||||
import { createPlayer } from './utils/playerFactory';
|
||||
import { createSource } from './utils/sourceFactory';
|
||||
import { VideoPlayerEvents } from './VideoPlayerEvents';
|
||||
} from "./types/VideoError";
|
||||
import type { VideoPlayerBase } from "./types/VideoPlayerBase";
|
||||
import type { VideoPlayerStatus } from "./types/VideoPlayerStatus";
|
||||
import { createPlayer } from "./utils/playerFactory";
|
||||
import { createSource } from "./utils/sourceFactory";
|
||||
import { VideoPlayerEvents } from "./VideoPlayerEvents";
|
||||
import type { AudioTrack } from "./types/AudioTrack";
|
||||
import type { VideoTrack } from "./types/VideoTrack";
|
||||
import type { QualityLevel } from "./types/QualityLevel";
|
||||
|
||||
class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
|
||||
protected player: VideoPlayerImpl;
|
||||
@@ -57,7 +60,7 @@ class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
|
||||
|
||||
if (
|
||||
parsedError instanceof VideoRuntimeError &&
|
||||
this.triggerEvent('onError', parsedError)
|
||||
this.triggerEvent("onError", parsedError)
|
||||
) {
|
||||
// We don't throw errors if onError is provided
|
||||
return;
|
||||
@@ -153,9 +156,9 @@ class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
|
||||
}
|
||||
|
||||
set ignoreSilentSwitchMode(value: IgnoreSilentSwitchMode) {
|
||||
if (__DEV__ && !['ios'].includes(Platform.OS)) {
|
||||
if (__DEV__ && !["ios"].includes(Platform.OS)) {
|
||||
console.warn(
|
||||
'ignoreSilentSwitchMode is not supported on this platform, it wont have any effect'
|
||||
"ignoreSilentSwitchMode is not supported on this platform, it wont have any effect",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -248,12 +251,16 @@ class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
|
||||
}
|
||||
|
||||
async replaceSourceAsync(
|
||||
source: VideoSource | VideoConfig | NoAutocomplete<VideoPlayerSource> | null
|
||||
source:
|
||||
| VideoSource
|
||||
| VideoConfig
|
||||
| NoAutocomplete<VideoPlayerSource>
|
||||
| null,
|
||||
): Promise<void> {
|
||||
await this.wrapPromise(
|
||||
this.player.replaceSourceAsync(
|
||||
source === null ? null : createSource(source)
|
||||
)
|
||||
source === null ? null : createSource(source),
|
||||
),
|
||||
);
|
||||
|
||||
NitroModules.updateMemorySize(this.player);
|
||||
@@ -281,6 +288,43 @@ class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
|
||||
get selectedTrack(): TextTrack | undefined {
|
||||
return this.player.selectedTrack;
|
||||
}
|
||||
|
||||
// TODO: implement this
|
||||
getAvailableAudioTracks(): AudioTrack[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
selectAudioTrack(_: AudioTrack | null): void {}
|
||||
|
||||
get selectedAudioTrack(): AudioTrack | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
getAvailableVideoTracks(): VideoTrack[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
selectVideoTrack(_: VideoTrack | null): void {}
|
||||
|
||||
get selectedVideoTrack(): VideoTrack | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// quality
|
||||
|
||||
getAvailableQualities(): QualityLevel[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
selectQuality(_: QualityLevel | null): void {}
|
||||
|
||||
get currentQuality(): QualityLevel | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get autoQualityEnabled(): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export { VideoPlayer };
|
||||
|
||||
432
packages/react-native-video/src/core/VideoPlayer.web.ts
Normal file
432
packages/react-native-video/src/core/VideoPlayer.web.ts
Normal file
@@ -0,0 +1,432 @@
|
||||
import videojs from "video.js";
|
||||
import type { VideoPlayerSource } from "../spec/nitro/VideoPlayerSource.nitro";
|
||||
import type { AudioTrack } from "./types/AudioTrack";
|
||||
import type { IgnoreSilentSwitchMode } from "./types/IgnoreSilentSwitchMode";
|
||||
import type { MixAudioMode } from "./types/MixAudioMode";
|
||||
import type { TextTrack } from "./types/TextTrack";
|
||||
import type { NoAutocomplete } from "./types/Utils";
|
||||
import type {
|
||||
NativeVideoConfig,
|
||||
VideoConfig,
|
||||
VideoSource,
|
||||
} from "./types/VideoConfig";
|
||||
import type { VideoPlayerBase } from "./types/VideoPlayerBase";
|
||||
import type { VideoPlayerSourceBase } from "./types/VideoPlayerSourceBase";
|
||||
import type { VideoPlayerStatus } from "./types/VideoPlayerStatus";
|
||||
import { VideoPlayerEvents } from "./VideoPlayerEvents";
|
||||
import { MediaSessionHandler } from "./web/MediaSession";
|
||||
import { WebEventEmiter } from "./web/WebEventEmiter";
|
||||
import type { VideoTrack } from "./types/VideoTrack";
|
||||
import type { QualityLevel } from "./types/QualityLevel";
|
||||
|
||||
type VideoJsPlayer = ReturnType<typeof videojs>;
|
||||
|
||||
// declared https://github.com/videojs/video.js/blob/main/src/js/tracks/track-list.js#L58
|
||||
export type VideoJsTextTracks = {
|
||||
length: number;
|
||||
[i: number]: {
|
||||
// declared: https://github.com/videojs/video.js/blob/main/src/js/tracks/track.js
|
||||
id: string;
|
||||
label: string;
|
||||
language: string;
|
||||
// declared https://github.com/videojs/video.js/blob/20f8d76cd24325a97ccedf0b013cd1a90ad0bcd7/src/js/tracks/text-track.js
|
||||
default: boolean;
|
||||
mode: "showing" | "disabled" | "hidden";
|
||||
};
|
||||
};
|
||||
|
||||
export type VideoJsTracks = {
|
||||
length: number;
|
||||
[i: number]: {
|
||||
id: string;
|
||||
label: string;
|
||||
language: string;
|
||||
enabled: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
// declared https://github.com/videojs/videojs-contrib-quality-levels/blob/main/src/quality-level.js#L32
|
||||
export type VideoJsQualityArray = {
|
||||
length: number;
|
||||
selectedIndex: number;
|
||||
[i: number]: {
|
||||
id: string;
|
||||
label: string;
|
||||
width: number;
|
||||
height: number;
|
||||
bitrate: number;
|
||||
frameRate: number;
|
||||
enabled: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
class VideoPlayer extends VideoPlayerEvents implements VideoPlayerBase {
|
||||
protected video: HTMLVideoElement;
|
||||
public player: VideoJsPlayer;
|
||||
private mediaSession: MediaSessionHandler;
|
||||
private _source: NativeVideoConfig | undefined;
|
||||
|
||||
constructor(source: VideoSource | VideoConfig | VideoPlayerSource) {
|
||||
const video = document.createElement("video");
|
||||
const player = videojs(video, {
|
||||
qualityLevels: true,
|
||||
html5: {
|
||||
preloadTextTracks: false,
|
||||
nativeTextTracks: true,
|
||||
},
|
||||
});
|
||||
// @ts-ignore used for debugging or extending purposes
|
||||
window.videojs = videojs;
|
||||
|
||||
super(new WebEventEmiter(player));
|
||||
|
||||
this.video = video;
|
||||
this.player = player;
|
||||
this.mediaSession = new MediaSessionHandler(this.player);
|
||||
|
||||
this.replaceSourceAsync(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up player's native resources and releases native state.
|
||||
* After calling this method, the player is no longer usable.
|
||||
* @internal
|
||||
*/
|
||||
__destroy() {
|
||||
this.player.dispose();
|
||||
}
|
||||
|
||||
__getNativeRef() {
|
||||
return this.video;
|
||||
}
|
||||
|
||||
// Source
|
||||
get source(): VideoPlayerSourceBase {
|
||||
return {
|
||||
uri: this._source?.uri!,
|
||||
config: this._source!,
|
||||
getAssetInformationAsync: async () => {
|
||||
return {
|
||||
bitrate: NaN,
|
||||
width: this.player.videoWidth(),
|
||||
height: this.player.videoHeight(),
|
||||
duration: BigInt(this.duration),
|
||||
fileSize: BigInt(NaN),
|
||||
isHDR: false,
|
||||
isLive: false,
|
||||
orientation: "landscape",
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Status
|
||||
get status(): VideoPlayerStatus {
|
||||
if (this.video.error) return "error";
|
||||
if (this.video.readyState === HTMLMediaElement.HAVE_NOTHING) return "idle";
|
||||
if (
|
||||
this.video.readyState === HTMLMediaElement.HAVE_ENOUGH_DATA ||
|
||||
this.video.readyState === HTMLMediaElement.HAVE_FUTURE_DATA
|
||||
)
|
||||
return "readyToPlay";
|
||||
return "loading";
|
||||
}
|
||||
|
||||
// Duration
|
||||
get duration(): number {
|
||||
return this.player.duration() ?? NaN;
|
||||
}
|
||||
|
||||
// Volume
|
||||
get volume(): number {
|
||||
return this.player.volume() ?? 1;
|
||||
}
|
||||
|
||||
set volume(value: number) {
|
||||
this.player.volume(value);
|
||||
}
|
||||
|
||||
// Current Time
|
||||
get currentTime(): number {
|
||||
return this.player.currentTime() ?? NaN;
|
||||
}
|
||||
|
||||
set currentTime(value: number) {
|
||||
this.player.currentTime(value);
|
||||
}
|
||||
|
||||
// Muted
|
||||
get muted(): boolean {
|
||||
return this.player.muted() ?? false;
|
||||
}
|
||||
|
||||
set muted(value: boolean) {
|
||||
this.player.muted(value);
|
||||
}
|
||||
|
||||
// Loop
|
||||
get loop(): boolean {
|
||||
return this.player.loop() ?? false;
|
||||
}
|
||||
|
||||
set loop(value: boolean) {
|
||||
this.player.loop(value);
|
||||
}
|
||||
|
||||
// Rate
|
||||
get rate(): number {
|
||||
return this.player.playbackRate() ?? 1;
|
||||
}
|
||||
|
||||
set rate(value: number) {
|
||||
this.player.playbackRate(value);
|
||||
}
|
||||
|
||||
// Mix Audio Mode
|
||||
get mixAudioMode(): MixAudioMode {
|
||||
return "auto";
|
||||
}
|
||||
|
||||
set mixAudioMode(_: MixAudioMode) {}
|
||||
|
||||
// Ignore Silent Switch Mode
|
||||
get ignoreSilentSwitchMode(): IgnoreSilentSwitchMode {
|
||||
return "auto";
|
||||
}
|
||||
|
||||
set ignoreSilentSwitchMode(_: IgnoreSilentSwitchMode) {}
|
||||
|
||||
// Play In Background
|
||||
get playInBackground(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
set playInBackground(_: boolean) {}
|
||||
|
||||
// Play When Inactive
|
||||
get playWhenInactive(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
set playWhenInactive(_: boolean) {}
|
||||
|
||||
get isPlaying(): boolean {
|
||||
return !this.player.paused();
|
||||
}
|
||||
|
||||
get showNotificationControls(): boolean {
|
||||
return this.mediaSession.enabled;
|
||||
}
|
||||
|
||||
set showNotificationControls(value: boolean) {
|
||||
if (!value) {
|
||||
this.mediaSession.disable();
|
||||
return;
|
||||
}
|
||||
this.mediaSession.enable();
|
||||
this.mediaSession.updateMediaSession(this._source?.metadata);
|
||||
}
|
||||
|
||||
async initialize(): Promise<void> {
|
||||
// noop on web
|
||||
}
|
||||
|
||||
async preload(): Promise<void> {
|
||||
this.player.load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases the player's native resources and releases native state.
|
||||
* After calling this method, the player is no longer usable.
|
||||
* Accessing any properties or methods of the player after calling this method will throw an error.
|
||||
* If you want to clean player resource use `replaceSourceAsync` with `null` instead.
|
||||
*/
|
||||
release(): void {
|
||||
this.__destroy();
|
||||
}
|
||||
|
||||
play(): void {
|
||||
// error are already handled by the `onError` callback, no need to catch it here.
|
||||
this.player.play()?.catch();
|
||||
}
|
||||
|
||||
pause(): void {
|
||||
this.player.pause();
|
||||
}
|
||||
|
||||
seekBy(time: number): void {
|
||||
const now = this.player.currentTime() ?? 0;
|
||||
this.player.currentTime(now + time);
|
||||
}
|
||||
|
||||
seekTo(time: number): void {
|
||||
this.player.currentTime(time);
|
||||
}
|
||||
|
||||
async replaceSourceAsync(
|
||||
source:
|
||||
| VideoSource
|
||||
| VideoConfig
|
||||
| NoAutocomplete<VideoPlayerSource>
|
||||
| null,
|
||||
): Promise<void> {
|
||||
if (!source) {
|
||||
this.player.src([]);
|
||||
this.player.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof source === "string") {
|
||||
source = { uri: source };
|
||||
}
|
||||
|
||||
if (typeof source === "number" || typeof source.uri === "number") {
|
||||
console.error(
|
||||
"A source uri must be a string. Numbers are only supported on native.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
this._source = source as VideoPlayerSource;
|
||||
// TODO: handle start time
|
||||
this.player.src({
|
||||
src: source.uri,
|
||||
type: source.mimeType,
|
||||
});
|
||||
if (this.mediaSession.enabled)
|
||||
this.mediaSession.updateMediaSession(source.metadata);
|
||||
|
||||
for (const sub of source.externalSubtitles ?? []) {
|
||||
this.player.addRemoteTextTrack({
|
||||
id: sub.uri,
|
||||
kind: "subtitles",
|
||||
label: sub.label,
|
||||
src: sub.uri,
|
||||
srclang: sub.language,
|
||||
});
|
||||
}
|
||||
|
||||
if (source.initializeOnCreation) await this.preload();
|
||||
}
|
||||
|
||||
// Text Track Management
|
||||
|
||||
getAvailableTextTracks(): TextTrack[] {
|
||||
// @ts-expect-error they define length & index properties via prototype
|
||||
const tracks: VideoJsTextTracks = this.player.textTracks();
|
||||
|
||||
return [...Array(tracks.length)].map((_, i) => ({
|
||||
id: tracks[i]!.id,
|
||||
label: tracks[i]!.label,
|
||||
language: tracks[i]!.language,
|
||||
selected: tracks[i]!.mode === "showing",
|
||||
}));
|
||||
}
|
||||
|
||||
selectTextTrack(textTrack: TextTrack | null): void {
|
||||
// @ts-expect-error they define length & index properties via prototype
|
||||
const tracks: VideoJsTextTracks = this.player.textTracks();
|
||||
|
||||
for (let i = 0; i < tracks.length; i++) {
|
||||
tracks[i]!.mode =
|
||||
tracks[i]!.id === textTrack?.id ? "showing" : "disabled";
|
||||
}
|
||||
}
|
||||
|
||||
// Selected Text Track
|
||||
get selectedTrack(): TextTrack | undefined {
|
||||
return this.getAvailableTextTracks().find((x) => x.selected);
|
||||
}
|
||||
|
||||
// audio tracks
|
||||
|
||||
getAvailableAudioTracks(): AudioTrack[] {
|
||||
// @ts-expect-error they define length & index properties via prototype
|
||||
const tracks: VideoJsTracks = this.player.audioTracks();
|
||||
|
||||
return [...Array(tracks.length)].map((_, i) => ({
|
||||
id: tracks[i]!.id,
|
||||
label: tracks[i]!.label,
|
||||
language: tracks[i]!.language,
|
||||
selected: tracks[i]!.enabled,
|
||||
}));
|
||||
}
|
||||
|
||||
selectAudioTrack(track: AudioTrack | null): void {
|
||||
// @ts-expect-error they define length & index properties via prototype
|
||||
const tracks: VideoJsTracks = this.player.audioTracks();
|
||||
|
||||
for (let i = 0; i < tracks.length; i++) {
|
||||
tracks[i]!.enabled = tracks[i]!.id === track?.id;
|
||||
}
|
||||
}
|
||||
|
||||
get selectedAudioTrack(): AudioTrack | undefined {
|
||||
return this.getAvailableAudioTracks().find((x) => x.selected);
|
||||
}
|
||||
|
||||
// video tracks
|
||||
|
||||
getAvailableVideoTracks(): VideoTrack[] {
|
||||
// @ts-expect-error they define length & index properties via prototype
|
||||
const tracks: VideoJsTracks = this.player.videoTracks();
|
||||
|
||||
return [...Array(tracks.length)].map((_, i) => ({
|
||||
id: tracks[i]!.id,
|
||||
label: tracks[i]!.label,
|
||||
language: tracks[i]!.language,
|
||||
selected: tracks[i]!.enabled,
|
||||
}));
|
||||
}
|
||||
|
||||
selectVideoTrack(track: VideoTrack | null): void {
|
||||
// @ts-expect-error they define length & index properties via prototype
|
||||
const tracks: VideoJsTracks = this.player.videoTracks();
|
||||
|
||||
for (let i = 0; i < tracks.length; i++) {
|
||||
tracks[i]!.enabled = tracks[i]!.id === track?.id;
|
||||
}
|
||||
}
|
||||
|
||||
get selectedVideoTrack(): VideoTrack | undefined {
|
||||
return this.getAvailableVideoTracks().find((x) => x.selected);
|
||||
}
|
||||
|
||||
// quality
|
||||
|
||||
getAvailableQualities(): QualityLevel[] {
|
||||
// @ts-expect-error this isn't typed
|
||||
const levels: VideoJsQualityArray = this.player.qualityLevels();
|
||||
return [...Array(levels.length)].map((_, i) => ({
|
||||
id: levels[i]!.id,
|
||||
width: levels[i]!.width,
|
||||
height: levels[i]!.height,
|
||||
bitrate: levels[i]!.bitrate,
|
||||
selected: levels.selectedIndex === i,
|
||||
}));
|
||||
}
|
||||
|
||||
selectQuality(quality: QualityLevel | null): void {
|
||||
// @ts-expect-error this isn't typed
|
||||
const levels: VideoJsQualityArray = this.player.qualityLevels();
|
||||
|
||||
for (let i = 0; i < levels.length; i++) {
|
||||
// if quality is null, enable back auto-quality switch (so enable all lvls)
|
||||
levels[i]!.enabled = !quality || levels[i]!.id === quality.id;
|
||||
}
|
||||
}
|
||||
|
||||
get currentQuality(): QualityLevel | undefined {
|
||||
return this.getAvailableQualities().find((x) => x.selected);
|
||||
}
|
||||
get autoQualityEnabled(): boolean {
|
||||
// @ts-expect-error this isn't typed
|
||||
const levels: VideoJsQualityArray = this.player.qualityLevels();
|
||||
// if we have a quality disabled that means we manually disabled it & disabled auto quality
|
||||
for (let i = 0; i < levels.length; i++) {
|
||||
if (!levels[i]!.enabled) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export { VideoPlayer };
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { VideoPlayerEventEmitter } from '../spec/nitro/VideoPlayerEventEmitter.nitro';
|
||||
import {
|
||||
ALL_PLAYER_EVENTS,
|
||||
type VideoPlayerEvents as NativePlayerEvents,
|
||||
type AllPlayerEvents as PlayerEvents,
|
||||
} from './types/Events';
|
||||
} from "./types/Events";
|
||||
|
||||
export class VideoPlayerEvents {
|
||||
protected eventEmitter: VideoPlayerEventEmitter;
|
||||
protected eventEmitter: NativePlayerEvents;
|
||||
protected eventListeners: Partial<
|
||||
Record<keyof PlayerEvents, Set<(...params: any[]) => void>>
|
||||
> = {};
|
||||
@@ -13,9 +13,9 @@ export class VideoPlayerEvents {
|
||||
protected readonly supportedEvents: (keyof PlayerEvents)[] =
|
||||
ALL_PLAYER_EVENTS;
|
||||
|
||||
constructor(eventEmitter: VideoPlayerEventEmitter) {
|
||||
constructor(eventEmitter: NativePlayerEvents) {
|
||||
this.eventEmitter = eventEmitter;
|
||||
for (let event of this.supportedEvents) {
|
||||
for (const event of this.supportedEvents) {
|
||||
// @ts-expect-error we narrow the type of the event
|
||||
this.eventEmitter[event] = this.triggerEvent.bind(this, event);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export class VideoPlayerEvents {
|
||||
...params: Parameters<PlayerEvents[Event]>
|
||||
): boolean {
|
||||
if (!this.eventListeners[event]?.size) return false;
|
||||
for (let fn of this.eventListeners[event]) {
|
||||
for (const fn of this.eventListeners[event]) {
|
||||
fn(...params);
|
||||
}
|
||||
return true;
|
||||
@@ -34,7 +34,7 @@ export class VideoPlayerEvents {
|
||||
|
||||
addEventListener<Event extends keyof PlayerEvents>(
|
||||
event: Event,
|
||||
callback: PlayerEvents[Event]
|
||||
callback: PlayerEvents[Event],
|
||||
) {
|
||||
this.eventListeners[event] ??= new Set<PlayerEvents[Event]>();
|
||||
this.eventListeners[event].add(callback);
|
||||
@@ -42,7 +42,7 @@ export class VideoPlayerEvents {
|
||||
|
||||
removeEventListener<Event extends keyof PlayerEvents>(
|
||||
event: Event,
|
||||
callback: PlayerEvents[Event]
|
||||
callback: PlayerEvents[Event],
|
||||
) {
|
||||
this.eventListeners[event]?.delete(callback);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from 'react';
|
||||
import { VideoPlayer } from '../VideoPlayer';
|
||||
import { type AllPlayerEvents } from '../types/Events';
|
||||
import type { AllPlayerEvents } from '../types/Events';
|
||||
import type { VideoPlayer } from '../VideoPlayer';
|
||||
|
||||
/**
|
||||
* Attaches an event listener to a `VideoPlayer` instance for a specified event.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { VideoPlayerSource } from '../../spec/nitro/VideoPlayerSource.nitro';
|
||||
import type { NoAutocomplete } from '../types/Utils';
|
||||
import type { VideoConfig, VideoSource } from '../types/VideoConfig';
|
||||
import { isVideoPlayerSource } from '../utils/sourceFactory';
|
||||
import { isVideoPlayerSource } from '../utils/sourceUtils';
|
||||
import { VideoPlayer } from '../VideoPlayer';
|
||||
import { useManagedInstance } from './useManagedInstance';
|
||||
|
||||
|
||||
22
packages/react-native-video/src/core/types/AudioTrack.ts
Normal file
22
packages/react-native-video/src/core/types/AudioTrack.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export interface AudioTrack {
|
||||
/**
|
||||
* Unique identifier for the audio track
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Display label for the audio track
|
||||
*/
|
||||
label: string;
|
||||
|
||||
/**
|
||||
* Language code (ISO 639-1 or ISO 639-2)
|
||||
* @example "en", "es", "fr"
|
||||
*/
|
||||
language?: string;
|
||||
|
||||
/**
|
||||
* Whether this track is currently selected
|
||||
*/
|
||||
selected: boolean;
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
import type { VideoPlayerSource } from '../../spec/nitro/VideoPlayerSource.nitro';
|
||||
import type { AudioTrack } from './AudioTrack';
|
||||
import type { QualityLevel } from './QualityLevel';
|
||||
import type { TextTrack } from './TextTrack';
|
||||
import type { VideoRuntimeError } from './VideoError';
|
||||
import type { VideoOrientation } from './VideoOrientation';
|
||||
import type { VideoPlayerSourceBase } from './VideoPlayerSourceBase';
|
||||
import type { VideoPlayerStatus } from './VideoPlayerStatus';
|
||||
import type { VideoTrack } from './VideoTrack';
|
||||
|
||||
export interface VideoPlayerEvents {
|
||||
/**
|
||||
@@ -16,6 +19,11 @@ export interface VideoPlayerEvents {
|
||||
* @platform Android
|
||||
*/
|
||||
onAudioFocusChange: (hasAudioFocus: boolean) => void;
|
||||
/**
|
||||
* Called when the audio track changes
|
||||
* @param track The new audio track
|
||||
*/
|
||||
onAudioTrackChange: (track: AudioTrack | null) => void;
|
||||
/**
|
||||
* Called when the bandwidth of the video changes.
|
||||
*/
|
||||
@@ -28,6 +36,7 @@ export interface VideoPlayerEvents {
|
||||
/**
|
||||
* Called when the video view's controls visibility changes.
|
||||
* @param visible Whether the video view's controls are visible.
|
||||
* @platform Android, Ios
|
||||
*/
|
||||
onControlsVisibleChange: (visible: boolean) => void;
|
||||
/**
|
||||
@@ -62,6 +71,10 @@ export interface VideoPlayerEvents {
|
||||
* Called when the player progress changes.
|
||||
*/
|
||||
onProgress: (data: onProgressData) => void;
|
||||
/**
|
||||
* Called when the player quality changes.
|
||||
*/
|
||||
onQualityChange: (quality: QualityLevel) => void;
|
||||
/**
|
||||
* Called when the video is ready to display.
|
||||
*/
|
||||
@@ -72,15 +85,18 @@ export interface VideoPlayerEvents {
|
||||
onSeek: (seekTime: number) => void;
|
||||
/**
|
||||
* Called when player receives timed metadata.
|
||||
* @platform Android, Ios
|
||||
*/
|
||||
onTimedMetadata: (metadata: TimedMetadata) => void;
|
||||
/**
|
||||
* Called when the text track (currently displayed subtitle) data changes.
|
||||
* @platform Android, Ios
|
||||
*/
|
||||
onTextTrackDataChanged: (texts: string[]) => void;
|
||||
/**
|
||||
* Called when the selected text track changes.
|
||||
* @param track - The newly selected text track, or null if no track is selected
|
||||
* @platform Android, Ios
|
||||
*/
|
||||
onTrackChange: (track: TextTrack | null) => void;
|
||||
/**
|
||||
@@ -91,6 +107,11 @@ export interface VideoPlayerEvents {
|
||||
* Called when the player status changes.
|
||||
*/
|
||||
onStatusChange: (status: VideoPlayerStatus) => void;
|
||||
/**
|
||||
* Called when the video track changes
|
||||
* @param track The new video track
|
||||
*/
|
||||
onVideoTrackChange: (track: VideoTrack | null) => void;
|
||||
}
|
||||
|
||||
export interface AllPlayerEvents extends VideoPlayerEvents {
|
||||
@@ -178,7 +199,7 @@ export interface onLoadStartData {
|
||||
/**
|
||||
* The source of the video.
|
||||
*/
|
||||
source: VideoPlayerSource;
|
||||
source: VideoPlayerSourceBase;
|
||||
}
|
||||
|
||||
export interface onPlaybackStateChangeData {
|
||||
@@ -245,6 +266,7 @@ export const ALL_PLAYER_EVENTS: (keyof AllPlayerEvents)[] =
|
||||
allKeysOf<AllPlayerEvents>()(
|
||||
'onAudioBecomingNoisy',
|
||||
'onAudioFocusChange',
|
||||
'onAudioTrackChange',
|
||||
'onBandwidthUpdate',
|
||||
'onBuffer',
|
||||
'onControlsVisibleChange',
|
||||
@@ -256,11 +278,13 @@ export const ALL_PLAYER_EVENTS: (keyof AllPlayerEvents)[] =
|
||||
'onPlaybackStateChange',
|
||||
'onPlaybackRateChange',
|
||||
'onProgress',
|
||||
'onQualityChange',
|
||||
'onReadyToDisplay',
|
||||
'onSeek',
|
||||
'onTimedMetadata',
|
||||
'onTextTrackDataChanged',
|
||||
'onTrackChange',
|
||||
'onVolumeChange',
|
||||
'onVideoTrackChange',
|
||||
'onStatusChange'
|
||||
);
|
||||
|
||||
26
packages/react-native-video/src/core/types/QualityLevel.ts
Normal file
26
packages/react-native-video/src/core/types/QualityLevel.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
export interface QualityLevel {
|
||||
/**
|
||||
* Unique identifier for the quality
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Width of the quality
|
||||
*/
|
||||
width: number;
|
||||
|
||||
/**
|
||||
* Height of the quality
|
||||
*/
|
||||
height: number;
|
||||
|
||||
/**
|
||||
* Bitrate of the quality
|
||||
*/
|
||||
bitrate: number;
|
||||
|
||||
/**
|
||||
* Whether this quality is currently selected
|
||||
*/
|
||||
selected: boolean;
|
||||
}
|
||||
@@ -14,6 +14,11 @@ export type VideoConfig = {
|
||||
* ```
|
||||
*/
|
||||
uri: VideoSource;
|
||||
/**
|
||||
* complete mime type, used to select a background for playback.
|
||||
* if not specified, the extension of the url might be used
|
||||
*/
|
||||
mimeType?: string
|
||||
/**
|
||||
* The headers to be sent with the request.
|
||||
*/
|
||||
@@ -141,7 +146,7 @@ interface NativeDrmParams extends DrmParams {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface CustomVideoMetadata {
|
||||
export interface CustomVideoMetadata {
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
description?: string;
|
||||
|
||||
22
packages/react-native-video/src/core/types/VideoTrack.ts
Normal file
22
packages/react-native-video/src/core/types/VideoTrack.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export interface VideoTrack {
|
||||
/**
|
||||
* Unique identifier for the video track
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Display label for the video track
|
||||
*/
|
||||
label: string;
|
||||
|
||||
/**
|
||||
* Language code (ISO 639-1 or ISO 639-2)
|
||||
* @example "en", "es", "fr"
|
||||
*/
|
||||
language?: string;
|
||||
|
||||
/**
|
||||
* Whether this track is currently selected
|
||||
*/
|
||||
selected: boolean;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user