Full API reference for the React Native wrapper.
Public Exports
import {
InkryptVideoPlayerView, // The component
type InkPlayerParams, // Playback parameters
type InkryptVideoPlayerMethods, // Ref method interface
} from '@inkrypt/react-native-inkrypt-video-player';
| Export | Kind | Purpose |
|---|---|---|
InkryptVideoPlayerView | Component | Renders the native player |
InkPlayerParams | type | Describes which video to load |
InkryptVideoPlayerMethods | interface | Ref handle methods: play, pause, seek, etc. |
Player Properties
Props accepted by InkryptVideoPlayerView. Props are grouped by role - behavior, playback, and layout.
Component Props
| Prop | Type | Required | Description |
|---|---|---|---|
params | InkPlayerParams | null | ✅ | The video to load. null renders an empty player. |
volume | number | ❌ | Player volume, 0.0 to 1.0. |
playbackSpeed | number | ❌ | Playback rate. Accepts 0.5–2.0 in 0.25 steps. Android only. |
style | ViewStyle | ❌ | Standard React Native layout styles. |
ref | MutableRefObject<InkryptVideoPlayerMethods | null> | ❌ | Attach to call Player Actions. |
volumecaveat Thevolumeprop is declared in the TypeScript surface but the native handlers are currently stubbed on both Android and iOS. Setting it will not change the player's actual volume. It is kept in the API for forward compatibility, do not rely on it today.
InkPlayerParams
InkPlayerParamsparams describes which video to load and how it should behave on startup. Treat it as immutable per session, mutating the object in place will not re-trigger loading; always create a new object and set it on state.
const [params, setParams] = useState<InkPlayerParams | null>(null);
setParams({
videoId: 'YOUR_VIDEO_ID',
otp: 'YOUR_OTP',
autoPlay: true,
aspectRatio: 16 / 9,
tolerateDeveloperMode: false,
});
Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
videoId | string | ✅ | — | The unique video identifier from the Inkrypt Dashboard. |
otp | string | ✅ | — | One-time password used for DRM authentication. |
autoPlay | boolean | ❌ | false | Start playback automatically once the player is ready. |
aspectRatio | number | ❌ | 16 / 9 | Initial aspect ratio used to lay out the player before the video metadata resolves. Prevents layout jumps. |
tolerateDeveloperMode | boolean | ❌ | false | Android only. Suppresses the "Developer Mode enabled" block during development. |
Platform Notes
tolerateDeveloperMode- Android only. On iOS this key is ignored. The native Android SDK blocks playback when Developer Options or USB Debugging are enabled (error codes9201/9202). Set this totrueonly in development builds - remove it before release.- Re-assigning
params- Android: setting a new
paramsobject swaps the active video (setParams()on the native fragment). - iOS: the current wrapper initializes the native view once on the first non-null
params; subsequent changes are ignored until the component unmounts. If you need to load a different video on iOS, force a remount by keying the view onvideoId:
<InkryptVideoPlayerView key={params?.videoId} params={params} ... /> - Android: setting a new
Sizing and Layout
The native player fills whatever frame you give it. There is no intrinsic size, you must apply a style with both a width and either a height or an aspectRatio.
Common patterns:
// Full-width, 16:9 aspect ratio (most common)
<InkryptVideoPlayerView
style={{ width: '100%', aspectRatio: 16 / 9 }}
params={params}
/>
// Fixed dimensions
<InkryptVideoPlayerView
style={{ width: 320, height: 180 }}
params={params}
/>
// Fill available space inside a flex container
<InkryptVideoPlayerView
style={{ flex: 1 }}
params={params}
/>
The aspectRatio field inside params affects the native layout calculation; the aspectRatio inside style is a React Native layout primitive. They serve different purposes, keep them consistent.
Player Actions
Actions are methods you invoke on the player through a ref handle. React components only expose methods via refs, so attach a useRef to the component and call methods through ref.current.
Setup
import { useRef } from 'react';
import {
InkryptVideoPlayerView,
type InkryptVideoPlayerMethods,
} from '@inkrypt/react-native-inkrypt-video-player';
function Demo() {
const playerRef = useRef<InkryptVideoPlayerMethods | null>(null);
return (
<InkryptVideoPlayerView
ref={playerRef as any}
style={{ width: '100%', aspectRatio: 16 / 9 }}
params={params}
/>
);
}
Always null-check ref.current before calling, it is null until the native view mounts:
const methods = playerRef.current; if (methods) { methods.play(); }
Methods
All methods are defined on the InkryptVideoPlayerMethods interface.
| Method | Signature | Description | iOS | Android |
|---|---|---|---|---|
play | () => void | Resume playback. | ✅ | ✅ |
pause | () => void | Pause playback. | ✅ | ✅ |
seek | (position: number) => void | Seek to a position in milliseconds. | ✅ | ✅ |
goFullScreen | () => void | Enter full-screen mode. | ⚠️ toggles | ❌ not wired |
resetPlayer | () => void | Stop playback and clear the loaded video. | ❌ not wired | ❌ not wired |
Status legend: ✅ works as documented · ⚠️ partial/different behavior · ❌ not wired up in the current native bridge (the JS call is a no-op).
play()
play()Resumes playback from the current position. No-op if the player is already playing.
playerRef.current?.play();
Maps to:
- Android -
InkPlayerFragment.play() - iOS -
InkPlayerState.play()
pause()
pause()Pauses playback at the current position.
playerRef.current?.pause();
Maps to:
- Android -
InkPlayerFragment.pause() - iOS -
InkPlayerState.pausePlayer()
seek(position)
seek(position)Moves the playback position to the specified point, in milliseconds.
// Jump to 01:15 (75,000 ms)
playerRef.current?.seek(75_000);
| Platform | Underlying call | Unit |
|---|---|---|
| Android | InkPlayerSession.seek(position: Long) | milliseconds |
| iOS | InkPlayerState.seek(to: Float64) | seconds — the wrapper converts internally |
goFullScreen()
goFullScreen()Requests full-screen mode.
playerRef.current?.goFullScreen();
`
Related native APIs for reference:
- Android - `InkPlayerFragment.toggleFullscreen()` / `enterFullScreen()` / `exitFullScreen()`
- iOS - `InkPlayerState.isFullScreen` (`@Published Bool`)
---
### `resetPlayer()`
Declared on the interface but **not wired up** in the current native bridges. Calling it is a no-op on both platforms.
To reset the player in practice, set `params` back to `null`:
```typescript
setParams(null);
This tears down the native player view. The native SDKs will release the underlying session.
A Note on the Native Split
This wrapper dispatches to two different native implementations:
| Platform | Native entrypoint | Docs |
|---|---|---|
| Android | InkPlayerFragment via InkryptVideoPlayerViewManager | native docs |
| iOS | InkryptVideoPlayerView (SwiftUI) via UIHostingController | native docs |
Behavior is aligned where possible, but some capabilities are platform-specific. Each page calls those out explicitly.
For platform-specific behavior that is not surfaced by this wrapper, consult the native docs linked above.