@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.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +230 -0
  3. package/app.plugin.cjs +3 -0
  4. package/dist/cast.cjs +100 -0
  5. package/dist/cast.cjs.map +1 -0
  6. package/dist/cast.d.cts +15 -0
  7. package/dist/cast.d.ts +15 -0
  8. package/dist/cast.mjs +92 -0
  9. package/dist/cast.mjs.map +1 -0
  10. package/dist/chunk-67DJ7NOB.mjs +294 -0
  11. package/dist/chunk-67DJ7NOB.mjs.map +1 -0
  12. package/dist/chunk-7U2LKIGU.mjs +12 -0
  13. package/dist/chunk-7U2LKIGU.mjs.map +1 -0
  14. package/dist/chunk-BJTO5JO5.mjs +10 -0
  15. package/dist/chunk-BJTO5JO5.mjs.map +1 -0
  16. package/dist/index.cjs +3934 -0
  17. package/dist/index.cjs.map +1 -0
  18. package/dist/index.d.cts +450 -0
  19. package/dist/index.d.ts +450 -0
  20. package/dist/index.mjs +3571 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/layout.cjs +217 -0
  23. package/dist/layout.cjs.map +1 -0
  24. package/dist/layout.d.cts +20 -0
  25. package/dist/layout.d.ts +20 -0
  26. package/dist/layout.mjs +4 -0
  27. package/dist/layout.mjs.map +1 -0
  28. package/dist/moviie-cast-adapter-DmSU2u3j.d.cts +53 -0
  29. package/dist/moviie-cast-adapter-DmSU2u3j.d.ts +53 -0
  30. package/dist/plugin/with-moviie.cjs +88 -0
  31. package/dist/plugin/with-moviie.cjs.map +1 -0
  32. package/dist/plugin/with-moviie.d.cts +52 -0
  33. package/dist/plugin/with-moviie.d.ts +52 -0
  34. package/dist/plugin/with-moviie.mjs +76 -0
  35. package/dist/plugin/with-moviie.mjs.map +1 -0
  36. package/package.json +134 -0
  37. package/plugin/validate-options.ts +31 -0
  38. package/plugin/with-moviie-types.ts +21 -0
  39. package/plugin/with-moviie.ts +84 -0
  40. package/src/apply-expo-moviie-endpoints.ts +47 -0
  41. package/src/cast/google-cast-adapter.ts +111 -0
  42. package/src/cast/index.ts +12 -0
  43. package/src/components/controls/moviie-bottom-timeline.tsx +477 -0
  44. package/src/components/controls/moviie-cast-buttons.tsx +96 -0
  45. package/src/components/controls/moviie-chrome-edge-gradients.tsx +162 -0
  46. package/src/components/controls/moviie-controls.tsx +585 -0
  47. package/src/components/controls/moviie-skin-chrome-context.tsx +374 -0
  48. package/src/components/controls/moviie-skin-smart-progress.tsx +157 -0
  49. package/src/components/icons/embed-media-icons.tsx +282 -0
  50. package/src/components/icons/moviie-embed-brand-mark.tsx +58 -0
  51. package/src/components/moviie-error-boundary.tsx +80 -0
  52. package/src/components/moviie-player-error-shell.tsx +143 -0
  53. package/src/components/moviie-player-loading-shell.tsx +59 -0
  54. package/src/components/moviie-skin-custom-fullscreen-modal.tsx +232 -0
  55. package/src/components/moviie-video-props.ts +134 -0
  56. package/src/components/moviie-video.tsx +568 -0
  57. package/src/components/moviie-video.web.tsx +167 -0
  58. package/src/components/overlays/moviie-watermark.tsx +53 -0
  59. package/src/constants.ts +374 -0
  60. package/src/hooks/use-moviie-event.ts +103 -0
  61. package/src/hooks/use-moviie-playback-ended.ts +14 -0
  62. package/src/hooks/use-moviie-playback-resume-persistence.ts +76 -0
  63. package/src/hooks/use-moviie-playback.ts +99 -0
  64. package/src/hooks/use-moviie-player-types.ts +55 -0
  65. package/src/hooks/use-moviie-player.ts +236 -0
  66. package/src/hooks/use-moviie-player.web.ts +57 -0
  67. package/src/hooks/use-moviie-telemetry.ts +133 -0
  68. package/src/index.ts +90 -0
  69. package/src/layout.ts +4 -0
  70. package/src/lib/add-moviie-playback-ended-listener.ts +16 -0
  71. package/src/lib/build-moviie-branding-marketing-url.ts +14 -0
  72. package/src/lib/build-moviie-embed-brand-home-url.ts +16 -0
  73. package/src/lib/build-moviie-skin-layout-metrics.ts +166 -0
  74. package/src/lib/build-moviie-video-presentation.ts +42 -0
  75. package/src/lib/build-moviie-watch-embed-url.ts +30 -0
  76. package/src/lib/cast-adapter-registry.ts +13 -0
  77. package/src/lib/clamp-unit-interval.ts +3 -0
  78. package/src/lib/compute-custom-fullscreen-stage-dimensions.ts +39 -0
  79. package/src/lib/compute-moviie-playback-ended.ts +31 -0
  80. package/src/lib/compute-playback-buffering.ts +41 -0
  81. package/src/lib/compute-playback-progress-ratio.ts +33 -0
  82. package/src/lib/compute-timeline-scrub-commit-time.ts +40 -0
  83. package/src/lib/custom-fullscreen-native-orientation.ts +88 -0
  84. package/src/lib/format-playback-clock.ts +27 -0
  85. package/src/lib/jsx-native-bridge.ts +45 -0
  86. package/src/lib/map-smart-progress-display-ratio.ts +43 -0
  87. package/src/lib/moviie-cast-adapter.ts +53 -0
  88. package/src/lib/moviie-error-display.ts +149 -0
  89. package/src/lib/moviie-shell-tokens.ts +27 -0
  90. package/src/lib/moviie-telemetry-callbacks.ts +76 -0
  91. package/src/lib/optional-status-bar.ts +48 -0
  92. package/src/lib/partition-moviie-video-host-style.ts +54 -0
  93. package/src/lib/remember-playback-position-storage.ts +98 -0
  94. package/src/lib/resolve-moviie-skin-layout-scale.ts +17 -0
  95. package/src/lib/resolve-orientation-lock-for-rotate-z-deg.ts +21 -0
  96. package/src/lib/resolve-skin-accent-color.ts +10 -0
  97. package/src/lib/resolve-web-embed-iframe-src.ts +17 -0
  98. package/src/lib/warn-once.ts +23 -0
  99. package/src/platform/native-application-id.ts +10 -0
  100. package/src/platform/platform-client-info.ts +31 -0
  101. package/src/playback/fetch-playback-fresh.ts +27 -0
  102. package/src/playback/playback-memory-cache.ts +52 -0
  103. package/src/provider/moviie-provider.tsx +99 -0
  104. package/src/secure-store-viewer-token-store.ts +80 -0
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Vertical chrome gradients (black → transparent).
3
+ * Svg primitives use `jsx-native-bridge` for TS 5.9 compatibility with class-based RN SVG exports.
4
+ */
5
+
6
+ import type { ReactNode } from "react"
7
+ import { useCallback, useMemo, useState } from "react"
8
+ import type { LayoutChangeEvent } from "react-native"
9
+ import { StyleSheet, View } from "react-native"
10
+ import Svg, { Defs, LinearGradient, Rect, Stop } from "../../lib/jsx-native-bridge"
11
+
12
+ import {
13
+ MOVIIE_SKIN_CHROME_EDGE_GRADIENT_EDGE_SOLID_FADE_END_FRACTION,
14
+ MOVIIE_SKIN_CHROME_EDGE_GRADIENT_MIN_CLEAR_MIDDLE_PX,
15
+ MOVIIE_SKIN_CHROME_GRADIENT_BLACK_HEX,
16
+ MOVIIE_SKIN_CHROME_GRADIENT_EDGE_ALPHA,
17
+ MOVIIE_SKIN_CHROME_SVG_GRADIENT_BOTTOM_EDGE_ID,
18
+ MOVIIE_SKIN_CHROME_SVG_GRADIENT_TOP_EDGE_ID,
19
+ } from "../../constants"
20
+ import type { MoviieSkinLayoutMetrics } from "../../lib/build-moviie-skin-layout-metrics"
21
+
22
+ export function MoviieSkinChromeEdgeGradients(props: {
23
+ layout: MoviieSkinLayoutMetrics
24
+ showProgress: boolean
25
+ }): ReactNode {
26
+ const [hostWidth, setHostWidth] = useState(0)
27
+ const [hostHeight, setHostHeight] = useState(0)
28
+
29
+ const onHostLayout = useCallback((event: LayoutChangeEvent) => {
30
+ const { height, width } = event.nativeEvent.layout
31
+ setHostWidth(width)
32
+ setHostHeight(height)
33
+ }, [])
34
+
35
+ const rawTopPx = props.layout.chromeEdgeGradientHeightPx
36
+ const rawBottomPx =
37
+ props.layout.chromeEdgeGradientHeightPx +
38
+ (props.showProgress ? props.layout.timelineStackHeightChromeVisiblePx : 0)
39
+
40
+ const { effBottomPx, effTopPx, svgWidthPx } = useMemo(() => {
41
+ if (hostWidth <= 0 || hostHeight <= 0) {
42
+ return { effBottomPx: 0, effTopPx: 0, svgWidthPx: 0 }
43
+ }
44
+
45
+ const svgWidthPx = hostWidth
46
+ const maxTotalPx = Math.max(
47
+ 0,
48
+ hostHeight - MOVIIE_SKIN_CHROME_EDGE_GRADIENT_MIN_CLEAR_MIDDLE_PX
49
+ )
50
+
51
+ const rawSum = rawTopPx + rawBottomPx
52
+ const scale =
53
+ rawSum > maxTotalPx && maxTotalPx > 0 && rawSum > 0 ? maxTotalPx / rawSum : 1
54
+
55
+ return {
56
+ effBottomPx: rawBottomPx * scale,
57
+ effTopPx: rawTopPx * scale,
58
+ svgWidthPx,
59
+ }
60
+ }, [hostHeight, hostWidth, rawBottomPx, rawTopPx])
61
+
62
+ const topFillUrl = `url(#${MOVIIE_SKIN_CHROME_SVG_GRADIENT_TOP_EDGE_ID})`
63
+ const bottomFillUrl = `url(#${MOVIIE_SKIN_CHROME_SVG_GRADIENT_BOTTOM_EDGE_ID})`
64
+
65
+ const layoutReady = hostWidth > 0 && hostHeight > 0 && svgWidthPx > 0
66
+
67
+ const fadeEndOffset = String(MOVIIE_SKIN_CHROME_EDGE_GRADIENT_EDGE_SOLID_FADE_END_FRACTION)
68
+
69
+ return (
70
+ <View
71
+ accessibilityElementsHidden
72
+ importantForAccessibility="no-hide-descendants"
73
+ onLayout={onHostLayout}
74
+ pointerEvents="none"
75
+ style={StyleSheet.absoluteFillObject}
76
+ testID="moviie-chrome-edge-gradients"
77
+ >
78
+ {layoutReady && effTopPx > 0 ? (
79
+ <View
80
+ accessibilityElementsHidden
81
+ importantForAccessibility="no-hide-descendants"
82
+ pointerEvents="none"
83
+ style={{
84
+ height: effTopPx,
85
+ left: 0,
86
+ overflow: "hidden",
87
+ position: "absolute",
88
+ top: 0,
89
+ width: hostWidth,
90
+ }}
91
+ >
92
+ <Svg accessibilityElementsHidden height={effTopPx} width={svgWidthPx}>
93
+ <Defs>
94
+ <LinearGradient
95
+ gradientUnits="objectBoundingBox"
96
+ id={MOVIIE_SKIN_CHROME_SVG_GRADIENT_TOP_EDGE_ID}
97
+ x1="0"
98
+ x2="0"
99
+ y1="0"
100
+ y2="1"
101
+ >
102
+ <Stop
103
+ offset="0"
104
+ stopColor={MOVIIE_SKIN_CHROME_GRADIENT_BLACK_HEX}
105
+ stopOpacity={MOVIIE_SKIN_CHROME_GRADIENT_EDGE_ALPHA}
106
+ />
107
+ <Stop
108
+ offset={fadeEndOffset}
109
+ stopColor={MOVIIE_SKIN_CHROME_GRADIENT_BLACK_HEX}
110
+ stopOpacity={0}
111
+ />
112
+ <Stop offset="1" stopColor={MOVIIE_SKIN_CHROME_GRADIENT_BLACK_HEX} stopOpacity={0} />
113
+ </LinearGradient>
114
+ </Defs>
115
+ <Rect fill={topFillUrl} height={effTopPx} width={svgWidthPx} />
116
+ </Svg>
117
+ </View>
118
+ ) : null}
119
+ {layoutReady && effBottomPx > 0 ? (
120
+ <View
121
+ accessibilityElementsHidden
122
+ importantForAccessibility="no-hide-descendants"
123
+ pointerEvents="none"
124
+ style={{
125
+ bottom: 0,
126
+ height: effBottomPx,
127
+ left: 0,
128
+ overflow: "hidden",
129
+ position: "absolute",
130
+ width: hostWidth,
131
+ }}
132
+ >
133
+ <Svg accessibilityElementsHidden height={effBottomPx} width={svgWidthPx}>
134
+ <Defs>
135
+ <LinearGradient
136
+ gradientUnits="objectBoundingBox"
137
+ id={MOVIIE_SKIN_CHROME_SVG_GRADIENT_BOTTOM_EDGE_ID}
138
+ x1="0"
139
+ x2="0"
140
+ y1="1"
141
+ y2="0"
142
+ >
143
+ <Stop
144
+ offset="0"
145
+ stopColor={MOVIIE_SKIN_CHROME_GRADIENT_BLACK_HEX}
146
+ stopOpacity={MOVIIE_SKIN_CHROME_GRADIENT_EDGE_ALPHA}
147
+ />
148
+ <Stop
149
+ offset={fadeEndOffset}
150
+ stopColor={MOVIIE_SKIN_CHROME_GRADIENT_BLACK_HEX}
151
+ stopOpacity={0}
152
+ />
153
+ <Stop offset="1" stopColor={MOVIIE_SKIN_CHROME_GRADIENT_BLACK_HEX} stopOpacity={0} />
154
+ </LinearGradient>
155
+ </Defs>
156
+ <Rect fill={bottomFillUrl} height={effBottomPx} width={svgWidthPx} />
157
+ </Svg>
158
+ </View>
159
+ ) : null}
160
+ </View>
161
+ )
162
+ }