@moviie/player-expo 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +230 -0
- package/app.plugin.cjs +3 -0
- package/dist/cast.cjs +100 -0
- package/dist/cast.cjs.map +1 -0
- package/dist/cast.d.cts +15 -0
- package/dist/cast.d.ts +15 -0
- package/dist/cast.mjs +92 -0
- package/dist/cast.mjs.map +1 -0
- package/dist/chunk-67DJ7NOB.mjs +294 -0
- package/dist/chunk-67DJ7NOB.mjs.map +1 -0
- package/dist/chunk-7U2LKIGU.mjs +12 -0
- package/dist/chunk-7U2LKIGU.mjs.map +1 -0
- package/dist/chunk-BJTO5JO5.mjs +10 -0
- package/dist/chunk-BJTO5JO5.mjs.map +1 -0
- package/dist/index.cjs +3934 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +450 -0
- package/dist/index.d.ts +450 -0
- package/dist/index.mjs +3571 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layout.cjs +217 -0
- package/dist/layout.cjs.map +1 -0
- package/dist/layout.d.cts +20 -0
- package/dist/layout.d.ts +20 -0
- package/dist/layout.mjs +4 -0
- package/dist/layout.mjs.map +1 -0
- package/dist/moviie-cast-adapter-DmSU2u3j.d.cts +53 -0
- package/dist/moviie-cast-adapter-DmSU2u3j.d.ts +53 -0
- package/dist/plugin/with-moviie.cjs +88 -0
- package/dist/plugin/with-moviie.cjs.map +1 -0
- package/dist/plugin/with-moviie.d.cts +52 -0
- package/dist/plugin/with-moviie.d.ts +52 -0
- package/dist/plugin/with-moviie.mjs +76 -0
- package/dist/plugin/with-moviie.mjs.map +1 -0
- package/package.json +134 -0
- package/plugin/validate-options.ts +31 -0
- package/plugin/with-moviie-types.ts +21 -0
- package/plugin/with-moviie.ts +84 -0
- package/src/apply-expo-moviie-endpoints.ts +47 -0
- package/src/cast/google-cast-adapter.ts +111 -0
- package/src/cast/index.ts +12 -0
- package/src/components/controls/moviie-bottom-timeline.tsx +477 -0
- package/src/components/controls/moviie-cast-buttons.tsx +96 -0
- package/src/components/controls/moviie-chrome-edge-gradients.tsx +162 -0
- package/src/components/controls/moviie-controls.tsx +585 -0
- package/src/components/controls/moviie-skin-chrome-context.tsx +374 -0
- package/src/components/controls/moviie-skin-smart-progress.tsx +157 -0
- package/src/components/icons/embed-media-icons.tsx +282 -0
- package/src/components/icons/moviie-embed-brand-mark.tsx +58 -0
- package/src/components/moviie-error-boundary.tsx +80 -0
- package/src/components/moviie-player-error-shell.tsx +143 -0
- package/src/components/moviie-player-loading-shell.tsx +59 -0
- package/src/components/moviie-skin-custom-fullscreen-modal.tsx +232 -0
- package/src/components/moviie-video-props.ts +134 -0
- package/src/components/moviie-video.tsx +568 -0
- package/src/components/moviie-video.web.tsx +167 -0
- package/src/components/overlays/moviie-watermark.tsx +53 -0
- package/src/constants.ts +374 -0
- package/src/hooks/use-moviie-event.ts +103 -0
- package/src/hooks/use-moviie-playback-ended.ts +14 -0
- package/src/hooks/use-moviie-playback-resume-persistence.ts +76 -0
- package/src/hooks/use-moviie-playback.ts +99 -0
- package/src/hooks/use-moviie-player-types.ts +55 -0
- package/src/hooks/use-moviie-player.ts +236 -0
- package/src/hooks/use-moviie-player.web.ts +57 -0
- package/src/hooks/use-moviie-telemetry.ts +133 -0
- package/src/index.ts +90 -0
- package/src/layout.ts +4 -0
- package/src/lib/add-moviie-playback-ended-listener.ts +16 -0
- package/src/lib/build-moviie-branding-marketing-url.ts +14 -0
- package/src/lib/build-moviie-embed-brand-home-url.ts +16 -0
- package/src/lib/build-moviie-skin-layout-metrics.ts +166 -0
- package/src/lib/build-moviie-video-presentation.ts +42 -0
- package/src/lib/build-moviie-watch-embed-url.ts +30 -0
- package/src/lib/cast-adapter-registry.ts +13 -0
- package/src/lib/clamp-unit-interval.ts +3 -0
- package/src/lib/compute-custom-fullscreen-stage-dimensions.ts +39 -0
- package/src/lib/compute-moviie-playback-ended.ts +31 -0
- package/src/lib/compute-playback-buffering.ts +41 -0
- package/src/lib/compute-playback-progress-ratio.ts +33 -0
- package/src/lib/compute-timeline-scrub-commit-time.ts +40 -0
- package/src/lib/custom-fullscreen-native-orientation.ts +88 -0
- package/src/lib/format-playback-clock.ts +27 -0
- package/src/lib/jsx-native-bridge.ts +45 -0
- package/src/lib/map-smart-progress-display-ratio.ts +43 -0
- package/src/lib/moviie-cast-adapter.ts +53 -0
- package/src/lib/moviie-error-display.ts +149 -0
- package/src/lib/moviie-shell-tokens.ts +27 -0
- package/src/lib/moviie-telemetry-callbacks.ts +76 -0
- package/src/lib/optional-status-bar.ts +48 -0
- package/src/lib/partition-moviie-video-host-style.ts +54 -0
- package/src/lib/remember-playback-position-storage.ts +98 -0
- package/src/lib/resolve-moviie-skin-layout-scale.ts +17 -0
- package/src/lib/resolve-orientation-lock-for-rotate-z-deg.ts +21 -0
- package/src/lib/resolve-skin-accent-color.ts +10 -0
- package/src/lib/resolve-web-embed-iframe-src.ts +17 -0
- package/src/lib/warn-once.ts +23 -0
- package/src/platform/native-application-id.ts +10 -0
- package/src/platform/platform-client-info.ts +31 -0
- package/src/playback/fetch-playback-fresh.ts +27 -0
- package/src/playback/playback-memory-cache.ts +52 -0
- package/src/provider/moviie-provider.tsx +99 -0
- package/src/secure-store-viewer-token-store.ts +80 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import * as _moviie_player_sdk from '@moviie/player-sdk';
|
|
2
|
+
import { ViewerTokenStore, MoviiePlaybackData } from '@moviie/player-sdk';
|
|
3
|
+
export * from '@moviie/player-sdk';
|
|
4
|
+
export { MoviieContextValue, MoviieProvider, useMoviieContext } from './layout.cjs';
|
|
5
|
+
import * as expo_video from 'expo-video';
|
|
6
|
+
import { VideoPlayer, VideoViewProps } from 'expo-video';
|
|
7
|
+
import { PLAYER_API_EVENTS } from '@moviie/player-types';
|
|
8
|
+
export { PLAYER_API_EVENTS, PLAYER_API_METHODS, PLAYER_API_PROPERTIES } from '@moviie/player-types';
|
|
9
|
+
import { M as MoviieCastAdapter } from './moviie-cast-adapter-DmSU2u3j.cjs';
|
|
10
|
+
export { a as MoviieCastMediaPayload, b as MoviieCastState } from './moviie-cast-adapter-DmSU2u3j.cjs';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import React__default, { ReactNode } from 'react';
|
|
13
|
+
import 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
declare const MOVIIE_PLAYER_EXPO_PKG_VERSION: "0.4.0";
|
|
16
|
+
declare const MOVIIE_PLAYBACK_MEMORY_CACHE_TTL_MS: number;
|
|
17
|
+
/** Playback profile strings returned by the playback API (aligned with web embed). */
|
|
18
|
+
declare const MOVIIE_PLAYBACK_PROFILE: {
|
|
19
|
+
readonly VSL: "vsl";
|
|
20
|
+
readonly CUSTOM: "custom";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* SecureStore key prefix for resume position (`{prefix}{embedId}`).
|
|
24
|
+
* Embed IDs are UUIDs from the API.
|
|
25
|
+
*/
|
|
26
|
+
declare const MOVIIE_REMEMBER_POSITION_STORAGE_PREFIX: "moviie.resume_position.";
|
|
27
|
+
/** Debounce interval before persisting resume position while playing. */
|
|
28
|
+
declare const MOVIIE_REMEMBER_POSITION_DEBOUNCE_MS: 5000;
|
|
29
|
+
/** Matches embed/web framing defaults when `contentFit` is omitted on `MoviieVideo`. */
|
|
30
|
+
declare const MOVIIE_VIDEO_DEFAULT_CONTENT_FIT: {
|
|
31
|
+
readonly VERTICAL: "contain";
|
|
32
|
+
readonly HORIZONTAL: "cover";
|
|
33
|
+
};
|
|
34
|
+
/** Origin público da página watch/embed (sem barra final). Override: `EXPO_PUBLIC_MOVIIE_WATCH_ORIGIN`. */
|
|
35
|
+
declare const MOVIIE_WATCH_ORIGIN_DEFAULT: "https://watch.moviie.ai";
|
|
36
|
+
/**
|
|
37
|
+
* Variável `EXPO_PUBLIC_*` para override do origin watch/embed em Expo Web (`resolveMoviieWatchOrigin`).
|
|
38
|
+
*/
|
|
39
|
+
declare const EXPO_PUBLIC_MOVIIE_WATCH_ORIGIN_ENV: "EXPO_PUBLIC_MOVIIE_WATCH_ORIGIN";
|
|
40
|
+
/** Path público do script da API JS do embed (relativo ao watch origin). */
|
|
41
|
+
declare const MOVIIE_WATCH_EMBED_JS_PATH: "/embed.js";
|
|
42
|
+
/**
|
|
43
|
+
* Atributo único no `<script>` injectado em Expo Web para evitar duplicar `embed.js`
|
|
44
|
+
* quando há vários `MoviieVideo` montados.
|
|
45
|
+
*/
|
|
46
|
+
declare const MOVIIE_PLAYER_EXPO_EMBED_JS_MARKER_ATTR: "data-moviie-player-expo-embed-js";
|
|
47
|
+
/**
|
|
48
|
+
* Variável `EXPO_PUBLIC_*` que override a base da API Moviie em **dev only**.
|
|
49
|
+
* O Metro inlina qualquer `EXPO_PUBLIC_*` em build time, sem precisar de
|
|
50
|
+
* `expo-constants`. Em produção o SDK usa sempre o default `https://api.moviie.ai/v1`.
|
|
51
|
+
*
|
|
52
|
+
* Exemplo `.env.local`:
|
|
53
|
+
* EXPO_PUBLIC_MOVIIE_API_BASE_URL=http://localhost:3000/api/v1
|
|
54
|
+
*/
|
|
55
|
+
declare const EXPO_PUBLIC_MOVIIE_API_BASE_URL_ENV: "EXPO_PUBLIC_MOVIIE_API_BASE_URL";
|
|
56
|
+
/**
|
|
57
|
+
* Variável `EXPO_PUBLIC_*` que override a base de telemetria em **dev only**.
|
|
58
|
+
* Caso omitida, deriva-se de `{origin}/telemetry/v1` a partir de `apiBaseUrl`.
|
|
59
|
+
*/
|
|
60
|
+
declare const EXPO_PUBLIC_MOVIIE_EVENTS_BASE_URL_ENV: "EXPO_PUBLIC_MOVIIE_EVENTS_BASE_URL";
|
|
61
|
+
declare const MOVIIE_SKIN_DEFAULT_ACCENT_HEX: "#6366f1";
|
|
62
|
+
/**
|
|
63
|
+
* Valor legado para a prop `controlsAutoHideMs` / `autoHideMs`: o chrome da skin Moviie já não
|
|
64
|
+
* usa temporizador para ocultar — só ao toque fora ou ações (play, seek).
|
|
65
|
+
*/
|
|
66
|
+
declare const MOVIIE_SKIN_CONTROLS_AUTO_HIDE_MS: 3000;
|
|
67
|
+
declare const MOVIIE_SKIN_CONTROL_ICON_PX: 22;
|
|
68
|
+
/** Volume normalizado (0–1) abaixo disto usa o ícone `volume-low` como no Vidstack. */
|
|
69
|
+
declare const MOVIIE_SKIN_VOLUME_LOW_ICON_THRESHOLD: 0.45;
|
|
70
|
+
/**
|
|
71
|
+
* Segundos antes do fim onde o progresso mostrado fixa em 100% quando não está a reproduzir —
|
|
72
|
+
* o `currentTime` do motor costuma ficar ligeiramente abaixo de `duration` no fim.
|
|
73
|
+
*/
|
|
74
|
+
declare const MOVIIE_SKIN_TIMELINE_END_SNAP_EPSILON_SECONDS: 0.15;
|
|
75
|
+
|
|
76
|
+
declare const MOVIIE_VIEWER_TOKEN_SECURE_STORE_KEY: "moviie_viewer_token_v1";
|
|
77
|
+
declare class SecureStoreViewerTokenStore implements ViewerTokenStore {
|
|
78
|
+
private readonly fallback;
|
|
79
|
+
private readonly storageKey;
|
|
80
|
+
constructor(options?: {
|
|
81
|
+
fallback?: ViewerTokenStore;
|
|
82
|
+
storageKey?: string;
|
|
83
|
+
});
|
|
84
|
+
private loadSecureStore;
|
|
85
|
+
get(): Promise<string | null>;
|
|
86
|
+
set(token: string, ttlSec: number): Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface UseMoviiePlaybackArgs {
|
|
90
|
+
/** Public embed UUID — client SDK never calls admin APIs or private keys. */
|
|
91
|
+
embedId?: string;
|
|
92
|
+
}
|
|
93
|
+
interface UseMoviiePlaybackResult {
|
|
94
|
+
data: MoviiePlaybackData | null;
|
|
95
|
+
error: Error | null;
|
|
96
|
+
isLoading: boolean;
|
|
97
|
+
retry: () => void;
|
|
98
|
+
}
|
|
99
|
+
declare function useMoviiePlayback(args: UseMoviiePlaybackArgs): UseMoviiePlaybackResult;
|
|
100
|
+
|
|
101
|
+
type MoviieVideoPresentationProps = {
|
|
102
|
+
allowsPictureInPicture: boolean;
|
|
103
|
+
startsPictureInPictureAutomatically: boolean;
|
|
104
|
+
requiresLinearPlayback: boolean;
|
|
105
|
+
};
|
|
106
|
+
interface BuildMoviieVideoPresentationArgs {
|
|
107
|
+
profile: string;
|
|
108
|
+
showPip: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Integrator override: when set, replaces embed `showPip` for `allowsPictureInPicture`.
|
|
111
|
+
* When omitted, `showPip` is used.
|
|
112
|
+
*/
|
|
113
|
+
pictureInPicture?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Integrator override for `startsPictureInPictureAutomatically`.
|
|
116
|
+
* When omitted, defaults to `false` (no embed field today).
|
|
117
|
+
*/
|
|
118
|
+
pictureInPictureAutoStart?: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Maps embed playback flags onto `VideoView` presentation props.
|
|
122
|
+
* Optional fields let integrators override embed defaults explicitly; omit them to follow the API.
|
|
123
|
+
*/
|
|
124
|
+
declare function buildMoviieVideoPresentationProps(args: BuildMoviieVideoPresentationArgs): MoviieVideoPresentationProps;
|
|
125
|
+
|
|
126
|
+
interface UseMoviiePlayerOptions {
|
|
127
|
+
embedId?: string;
|
|
128
|
+
/**
|
|
129
|
+
* When set, overrides {@link MoviiePlaybackData.controls.autoplay}. When omitted, embed wins.
|
|
130
|
+
*/
|
|
131
|
+
autoplay?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* When set, overrides PiP capability vs embed `showPip` (passed into presentation props).
|
|
134
|
+
* When omitted, embed wins.
|
|
135
|
+
*/
|
|
136
|
+
pictureInPicture?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* When set, overrides auto-start PiP. When omitted, defaults to `false` in presentation props.
|
|
139
|
+
*/
|
|
140
|
+
pictureInPictureAutoStart?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Native-only: keep playback active when the app backgrounds (not part of embed controls).
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
backgroundPlayback?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Native-only: show Now Playing / lock-screen controls (not part of embed controls).
|
|
148
|
+
* @default false
|
|
149
|
+
*/
|
|
150
|
+
lockScreenNowPlaying?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* When set, overrides {@link MoviiePlaybackData.controls.rememberPosition}.
|
|
153
|
+
* When omitted, embed wins.
|
|
154
|
+
*/
|
|
155
|
+
rememberPosition?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface UseMoviiePlayerResult {
|
|
158
|
+
/**
|
|
159
|
+
* Native: `expo-video` player instance. Web (iframe): always `null` — use embed JS API / `onEmbedIframeRef`.
|
|
160
|
+
*/
|
|
161
|
+
player: VideoPlayer | null;
|
|
162
|
+
playback: MoviiePlaybackData | null;
|
|
163
|
+
error: Error | null;
|
|
164
|
+
isLoading: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Presentation props for `MoviieVideo` / `VideoView`: embed defaults, plus explicit hook overrides.
|
|
167
|
+
*/
|
|
168
|
+
videoPresentation: MoviieVideoPresentationProps;
|
|
169
|
+
/**
|
|
170
|
+
* Re-runs the playback fetch. Used by the built-in error shell for transient errors (network/rate_limit).
|
|
171
|
+
*/
|
|
172
|
+
retry: () => void;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
declare function useMoviiePlayer(options: UseMoviiePlayerOptions): UseMoviiePlayerResult;
|
|
176
|
+
|
|
177
|
+
type PublicPlayerEvent = (typeof PLAYER_API_EVENTS)[keyof typeof PLAYER_API_EVENTS];
|
|
178
|
+
declare function useMoviieEvent(player: VideoPlayer | null, eventName: PublicPlayerEvent, handler: () => void): void;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Natural playback end from expo-video (`playToEnd`), aligned with {@link PLAYER_API_EVENTS.ENDED}.
|
|
182
|
+
*/
|
|
183
|
+
declare function useMoviiePlaybackEnded(player: VideoPlayer | null, onEnded: () => void): void;
|
|
184
|
+
|
|
185
|
+
type MoviiePlaybackEndedUiArgs = {
|
|
186
|
+
playing: boolean;
|
|
187
|
+
currentTime: number;
|
|
188
|
+
duration: number;
|
|
189
|
+
isLive: boolean;
|
|
190
|
+
loop: boolean;
|
|
191
|
+
};
|
|
192
|
+
declare function computeMoviiePlaybackEnded(args: MoviiePlaybackEndedUiArgs): boolean;
|
|
193
|
+
|
|
194
|
+
type MoviiePlaybackEndedSubscription = {
|
|
195
|
+
remove: () => void;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Imperative listener for expo-video `playToEnd`. Prefer {@link useMoviiePlaybackEnded} in React components.
|
|
199
|
+
*/
|
|
200
|
+
declare function addMoviiePlaybackEndedListener(player: VideoPlayer, onEnded: () => void): MoviiePlaybackEndedSubscription;
|
|
201
|
+
|
|
202
|
+
declare function normalizeWatchOrigin(origin: string): string;
|
|
203
|
+
declare function buildMoviieWatchEmbedUrl(embedId: string, watchOrigin: string): string;
|
|
204
|
+
/**
|
|
205
|
+
* Resolve o origin público da página watch/embed.
|
|
206
|
+
* Usa `process.env.EXPO_PUBLIC_MOVIIE_WATCH_ORIGIN` quando definido (nome documentado como `EXPO_PUBLIC_MOVIIE_WATCH_ORIGIN_ENV` em `@moviie/player-expo`).
|
|
207
|
+
*/
|
|
208
|
+
declare function resolveMoviieWatchOrigin(): string;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Hooks opt-in para telemetria do consumer (Sentry, PostHog, Datadog, etc.).
|
|
212
|
+
*
|
|
213
|
+
* `@moviie/player-expo` já envia telemetria interna para o backend Moviie via
|
|
214
|
+
* `TelemetryClient` (impressions, playback duration). Estes callbacks servem
|
|
215
|
+
* exclusivamente para o consumer também observar eventos em **sua própria**
|
|
216
|
+
* pipeline de monitoring — não substituem nem ampliam a telemetria interna.
|
|
217
|
+
*
|
|
218
|
+
* **Garantias**:
|
|
219
|
+
* - Callbacks são síncronos e não-bloqueantes: exceções neles são engolidas e
|
|
220
|
+
* loggadas via `console.warn` (não derrubam o player).
|
|
221
|
+
* - Sem PII: eventos só carregam `embedId` público e métricas técnicas.
|
|
222
|
+
* - Cada evento é entregue at-most-once por ciclo de vida do player.
|
|
223
|
+
*/
|
|
224
|
+
type MoviieTelemetryErrorPhase =
|
|
225
|
+
/** Falha ao carregar metadata de playback (`useMoviiePlayback`). */
|
|
226
|
+
'playback_fetch'
|
|
227
|
+
/** Falha durante reprodução (network stall, decode error, DRM, etc.). */
|
|
228
|
+
| 'playback_runtime'
|
|
229
|
+
/** Falha capturada pelo `MoviieErrorBoundary` (render/effect throw). */
|
|
230
|
+
| 'render_boundary';
|
|
231
|
+
interface MoviieTelemetryErrorContext {
|
|
232
|
+
/** UUID público do embed em causa, se disponível. */
|
|
233
|
+
embedId?: string;
|
|
234
|
+
/** Categorização da fase onde o erro ocorreu. */
|
|
235
|
+
phase: MoviieTelemetryErrorPhase;
|
|
236
|
+
/** Código de erro classificado pelo SDK (quando aplicável). */
|
|
237
|
+
code?: string;
|
|
238
|
+
}
|
|
239
|
+
type MoviieTelemetryLifecycleEventName = 'playback_loaded' | 'playback_started' | 'playback_paused' | 'playback_seeking' | 'playback_ended' | 'fullscreen_enter' | 'fullscreen_exit' | 'pip_enter' | 'pip_exit' | 'cast_session_started' | 'cast_session_ended';
|
|
240
|
+
interface MoviieTelemetryLifecycleEvent {
|
|
241
|
+
name: MoviieTelemetryLifecycleEventName;
|
|
242
|
+
embedId?: string;
|
|
243
|
+
/** Posição (segundos) no momento do evento, quando relevante. */
|
|
244
|
+
positionSeconds?: number;
|
|
245
|
+
/** Duração total (segundos) quando conhecida. */
|
|
246
|
+
durationSeconds?: number;
|
|
247
|
+
}
|
|
248
|
+
type MoviieTelemetryOnError = (error: Error, context: MoviieTelemetryErrorContext) => void;
|
|
249
|
+
type MoviieTelemetryOnEvent = (event: MoviieTelemetryLifecycleEvent) => void;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Subconjunto do elemento iframe usado na integração web (embed watch).
|
|
253
|
+
* Evita acoplar o pacote à lib DOM completa no tsconfig.
|
|
254
|
+
*/
|
|
255
|
+
type MoviieWatchEmbedIframeHandle = {
|
|
256
|
+
readonly contentWindow: {
|
|
257
|
+
postMessage(message: unknown, targetOrigin: string): void;
|
|
258
|
+
} | null;
|
|
259
|
+
};
|
|
260
|
+
type MoviieWatchEmbedIframeRefCallback = (iframe: MoviieWatchEmbedIframeHandle | null) => void;
|
|
261
|
+
type MoviieVideoProps = Omit<VideoViewProps, 'player'> & {
|
|
262
|
+
/**
|
|
263
|
+
* Instância `VideoPlayer` do expo-video (iOS / Android).
|
|
264
|
+
* Na web, `useMoviiePlayer` devolve `null` e `MoviieVideo` usa iframe do embed.
|
|
265
|
+
*/
|
|
266
|
+
player: VideoPlayer | null;
|
|
267
|
+
nativeControls?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* When `true`, uses the platform `VideoView` chrome. When `false` or omitted, uses the Moviie custom chrome (default).
|
|
270
|
+
*/
|
|
271
|
+
native?: boolean;
|
|
272
|
+
playback?: MoviiePlaybackData | null;
|
|
273
|
+
/**
|
|
274
|
+
* Optional override: when set, replaces embed `showPip` for PiP capability (with {@link pictureInPictureAutoStart}).
|
|
275
|
+
* Raw `VideoView` props (`allowsPictureInPicture`, …) still win when passed explicitly.
|
|
276
|
+
*/
|
|
277
|
+
pictureInPicture?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Optional override for auto-start PiP. Embed has no field for this; omit for `false` unless set here or on the hook.
|
|
280
|
+
*/
|
|
281
|
+
pictureInPictureAutoStart?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Ignorado quando `native` é omitido ou `false`: o chrome Moviie não usa temporizador para ocultar.
|
|
284
|
+
*/
|
|
285
|
+
controlsAutoHideMs?: number;
|
|
286
|
+
controlsVisibleByDefault?: boolean;
|
|
287
|
+
children?: ReactNode;
|
|
288
|
+
/**
|
|
289
|
+
* Web: callback com referência ao iframe após montagem, para `Moviie.getPlayer(iframe)` (`embed.js`).
|
|
290
|
+
*/
|
|
291
|
+
onEmbedIframeRef?: MoviieWatchEmbedIframeRefCallback;
|
|
292
|
+
/**
|
|
293
|
+
* Web: injeta `<script src="{watchOrigin}/embed.js">` uma vez. Ignorado em nativo. Default `true`.
|
|
294
|
+
*/
|
|
295
|
+
loadEmbedScript?: boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Erro vindo de `useMoviiePlayer`/`useMoviiePlayback`. Quando preenchido (e sem `playback`),
|
|
298
|
+
* a shell built-in mostra feedback de erro com CTA mapeado por código.
|
|
299
|
+
*/
|
|
300
|
+
error?: Error | null;
|
|
301
|
+
/**
|
|
302
|
+
* Indica que o fetch de playback está em curso. Quando `true` (e sem `playback`), a shell
|
|
303
|
+
* built-in mostra estado de carregamento.
|
|
304
|
+
*/
|
|
305
|
+
isLoading?: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Aspect ratio do container reservado pelo player enquanto não há dimensões intrínsecas do
|
|
308
|
+
* vídeo. Default `16/9`. Após `playback` chegar, o container passa a usar `videoWidthPx/videoHeightPx`.
|
|
309
|
+
*/
|
|
310
|
+
aspectRatio?: number;
|
|
311
|
+
/**
|
|
312
|
+
* Callback opcional para erros transientes (network/rate_limit). Override do retry built-in.
|
|
313
|
+
* Tem precedência sobre {@link retry}.
|
|
314
|
+
*/
|
|
315
|
+
onRetry?: () => void;
|
|
316
|
+
/**
|
|
317
|
+
* Função de retry built-in fornecida por `useMoviiePlayer().retry`. Aceita o spread do hook
|
|
318
|
+
* sem boilerplate. Quando `onRetry` é fornecido, este é ignorado.
|
|
319
|
+
*/
|
|
320
|
+
retry?: () => void;
|
|
321
|
+
/**
|
|
322
|
+
* Adapter opcional para cast (Chromecast). Crie via factory do subpath
|
|
323
|
+
* `@moviie/player-expo/cast` (`createGoogleCastAdapter()`) e passe aqui.
|
|
324
|
+
*
|
|
325
|
+
* Quando omitido, o botão de cast não aparece. Se o embed pede cast
|
|
326
|
+
* (`playback.controls.chromecast === true`) e o adapter não foi fornecido,
|
|
327
|
+
* dispara um `console.warn` único com instruções.
|
|
328
|
+
*/
|
|
329
|
+
castAdapter?: MoviieCastAdapter | null;
|
|
330
|
+
/**
|
|
331
|
+
* Override explícito do flag `playback.controls.chromecast`. Quando definido,
|
|
332
|
+
* vence o painel:
|
|
333
|
+
* - `true`: força exibir botão (se adapter estiver disponível);
|
|
334
|
+
* - `false`: força esconder e silencia warning;
|
|
335
|
+
* - omitido: usa o flag do painel.
|
|
336
|
+
*/
|
|
337
|
+
cast?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Callback opt-in invocado quando um erro relevante ocorre — para integração
|
|
340
|
+
* com Sentry/PostHog/Datadog do consumer.
|
|
341
|
+
*
|
|
342
|
+
* Não substitui nem expande a telemetria interna enviada ao backend Moviie.
|
|
343
|
+
* Exceções lançadas dentro do callback são engolidas e logged via warn.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```tsx
|
|
347
|
+
* <MoviieVideo
|
|
348
|
+
* {...moviie}
|
|
349
|
+
* onTelemetryError={(error, ctx) => Sentry.captureException(error, { tags: ctx })}
|
|
350
|
+
* />
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
onTelemetryError?: MoviieTelemetryOnError;
|
|
354
|
+
/**
|
|
355
|
+
* Callback opt-in invocado em eventos de ciclo de vida do player
|
|
356
|
+
* (play, pause, seek, fullscreen, cast). Útil para correlacionar UX com erros
|
|
357
|
+
* em ferramentas de observability do consumer.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```tsx
|
|
361
|
+
* <MoviieVideo
|
|
362
|
+
* {...moviie}
|
|
363
|
+
* onTelemetryEvent={(e) => posthog.capture(`player.${e.name}`, e)}
|
|
364
|
+
* />
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
onTelemetryEvent?: MoviieTelemetryOnEvent;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
/** Subconjunto do VideoView nativo usado pela skin (tipagens expo-video × React). */
|
|
371
|
+
type MoviieVideoSurfaceRef = {
|
|
372
|
+
enterFullscreen?: () => Promise<void>;
|
|
373
|
+
exitFullscreen?: () => Promise<void>;
|
|
374
|
+
startPictureInPicture?: () => Promise<void>;
|
|
375
|
+
stopPictureInPicture?: () => Promise<void>;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
declare const MoviieVideo: React.ForwardRefExoticComponent<Omit<VideoViewProps, "player"> & {
|
|
379
|
+
player: expo_video.VideoPlayer | null;
|
|
380
|
+
nativeControls?: boolean;
|
|
381
|
+
native?: boolean;
|
|
382
|
+
playback?: _moviie_player_sdk.MoviiePlaybackData | null;
|
|
383
|
+
pictureInPicture?: boolean;
|
|
384
|
+
pictureInPictureAutoStart?: boolean;
|
|
385
|
+
controlsAutoHideMs?: number;
|
|
386
|
+
controlsVisibleByDefault?: boolean;
|
|
387
|
+
children?: React.ReactNode;
|
|
388
|
+
onEmbedIframeRef?: MoviieWatchEmbedIframeRefCallback;
|
|
389
|
+
loadEmbedScript?: boolean;
|
|
390
|
+
error?: Error | null;
|
|
391
|
+
isLoading?: boolean;
|
|
392
|
+
aspectRatio?: number;
|
|
393
|
+
onRetry?: () => void;
|
|
394
|
+
retry?: () => void;
|
|
395
|
+
castAdapter?: MoviieCastAdapter | null;
|
|
396
|
+
cast?: boolean;
|
|
397
|
+
onTelemetryError?: MoviieTelemetryOnError;
|
|
398
|
+
onTelemetryEvent?: MoviieTelemetryOnEvent;
|
|
399
|
+
} & React.RefAttributes<MoviieVideoSurfaceRef>>;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* React error boundary que isola crashes do player do resto da árvore.
|
|
403
|
+
*
|
|
404
|
+
* Quando uma exceção é lançada durante o render/effect de `MoviieVideo` (ex.: bug
|
|
405
|
+
* em `expo-video`, lib nativa ausente, payload corrompido), o consumer perderia
|
|
406
|
+
* a UI inteira se não houvesse boundary. Este wrapper captura o erro, opcionalmente
|
|
407
|
+
* notifica via `onError` (Sentry/PostHog do consumer) e renderiza um fallback.
|
|
408
|
+
*
|
|
409
|
+
* Use em torno de `MoviieVideo`:
|
|
410
|
+
*
|
|
411
|
+
* ```tsx
|
|
412
|
+
* <MoviieErrorBoundary onError={Sentry.captureException}>
|
|
413
|
+
* <MoviieVideo embedId={id} />
|
|
414
|
+
* </MoviieErrorBoundary>
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
|
|
418
|
+
interface MoviieErrorBoundaryProps {
|
|
419
|
+
/**
|
|
420
|
+
* Conteúdo protegido. Tipicamente `<MoviieVideo>` e árvores derivadas.
|
|
421
|
+
*/
|
|
422
|
+
children: React__default.ReactNode;
|
|
423
|
+
/**
|
|
424
|
+
* Render override quando há erro. Recebe `error` e função `reset` que limpa
|
|
425
|
+
* o estado de erro e força nova montagem dos children.
|
|
426
|
+
*
|
|
427
|
+
* Default: `null` (renderiza nada). Recomendado passar um placeholder visual.
|
|
428
|
+
*/
|
|
429
|
+
fallback?: (args: {
|
|
430
|
+
error: Error;
|
|
431
|
+
reset: () => void;
|
|
432
|
+
}) => React__default.ReactNode;
|
|
433
|
+
/**
|
|
434
|
+
* Hook chamado uma vez por erro capturado. Use para telemetria
|
|
435
|
+
* (Sentry/PostHog/Datadog) — não bloqueia o render do fallback.
|
|
436
|
+
*/
|
|
437
|
+
onError?: (error: Error, info: React__default.ErrorInfo) => void;
|
|
438
|
+
}
|
|
439
|
+
interface MoviieErrorBoundaryState {
|
|
440
|
+
error: Error | null;
|
|
441
|
+
}
|
|
442
|
+
declare class MoviieErrorBoundary extends React__default.Component<MoviieErrorBoundaryProps, MoviieErrorBoundaryState> {
|
|
443
|
+
state: MoviieErrorBoundaryState;
|
|
444
|
+
static getDerivedStateFromError(error: Error): MoviieErrorBoundaryState;
|
|
445
|
+
componentDidCatch(error: Error, info: React__default.ErrorInfo): void;
|
|
446
|
+
reset: () => void;
|
|
447
|
+
render(): React__default.ReactNode;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export { EXPO_PUBLIC_MOVIIE_API_BASE_URL_ENV, EXPO_PUBLIC_MOVIIE_EVENTS_BASE_URL_ENV, EXPO_PUBLIC_MOVIIE_WATCH_ORIGIN_ENV, MOVIIE_PLAYBACK_MEMORY_CACHE_TTL_MS, MOVIIE_PLAYBACK_PROFILE, MOVIIE_PLAYER_EXPO_EMBED_JS_MARKER_ATTR, MOVIIE_PLAYER_EXPO_PKG_VERSION, MOVIIE_REMEMBER_POSITION_DEBOUNCE_MS, MOVIIE_REMEMBER_POSITION_STORAGE_PREFIX, MOVIIE_SKIN_CONTROLS_AUTO_HIDE_MS, MOVIIE_SKIN_CONTROL_ICON_PX, MOVIIE_SKIN_DEFAULT_ACCENT_HEX, MOVIIE_SKIN_TIMELINE_END_SNAP_EPSILON_SECONDS, MOVIIE_SKIN_VOLUME_LOW_ICON_THRESHOLD, MOVIIE_VIDEO_DEFAULT_CONTENT_FIT, MOVIIE_VIEWER_TOKEN_SECURE_STORE_KEY, MOVIIE_WATCH_EMBED_JS_PATH, MOVIIE_WATCH_ORIGIN_DEFAULT, MoviieCastAdapter, MoviieErrorBoundary, type MoviieErrorBoundaryProps, type MoviiePlaybackEndedSubscription, type MoviiePlaybackEndedUiArgs, type MoviieTelemetryErrorContext, type MoviieTelemetryErrorPhase, type MoviieTelemetryLifecycleEvent, type MoviieTelemetryLifecycleEventName, type MoviieTelemetryOnError, type MoviieTelemetryOnEvent, MoviieVideo, type MoviieVideoPresentationProps, type MoviieVideoProps, type MoviieVideoSurfaceRef, type MoviieWatchEmbedIframeHandle, type MoviieWatchEmbedIframeRefCallback, SecureStoreViewerTokenStore, type UseMoviiePlaybackArgs, type UseMoviiePlaybackResult, type UseMoviiePlayerOptions, type UseMoviiePlayerResult, addMoviiePlaybackEndedListener, buildMoviieVideoPresentationProps, buildMoviieWatchEmbedUrl, computeMoviiePlaybackEnded, normalizeWatchOrigin, resolveMoviieWatchOrigin, useMoviieEvent, useMoviiePlayback, useMoviiePlaybackEnded, useMoviiePlayer };
|