Skip to content

Commit e6af45c

Browse files
authored
Support Expo 52, 53
1 parent 52d7530 commit e6af45c

32 files changed

+8825
-35007
lines changed

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
engine-strict=false
2+
fund=false

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ This Readme provides basic installation and usage information.
2121
Transform and optimize assets. Visit our documentation to learn more about [media optimization](https://cloudinary.com/documentation/media_optimization) and [transformations](https://cloudinary.com/documentation/image_transformations).
2222

2323
## Version Support
24-
| SDK Version | React Native Version |
25-
|-------------|----------------------|
26-
| 1.x.x | > 0.6 |
24+
| SDK Version | React Native Version | Expo SDK Version | Video Library |
25+
|-------------|----------------------|------------------|---------------|
26+
| 1.x.x | >= 0.72 | 50-53 | expo-av / expo-video |
2727

2828
## Installation
2929
### Install using your favorite package manager (yarn, npm)
@@ -37,16 +37,20 @@ yarn add cloudinary-react-native --save
3737
```
3838

3939
### For Video Player functionality
40-
If you want to use the video player features, you need to install `expo-av`:
40+
The SDK supports both `expo-av` and `expo-video` libraries. The appropriate library will be automatically detected and used:
4141

42+
**For Expo SDK 50-51 (expo-av):**
4243
```bash
4344
npm install expo-av
4445
```
45-
Or
46+
47+
**For Expo SDK 52+ (expo-video - recommended):**
4648
```bash
47-
yarn add expo-av
49+
npm install expo-video
4850
```
4951

52+
**Note:** `expo-av` is deprecated in SDK 52 and removed in SDK 53. For newer Expo versions, use `expo-video`.
53+
5054
## Usage
5155
### Setup
5256
The `Cloudinary` class is the main entry point for using the library. Your `cloud_name` is required to create an instance of this class. Your `api_key` and `api_secret` are also needed to perform secure API calls to Cloudinary (e.g., image and video uploads). Setting the configuration parameters can be done either programmatically using an appropriate constructor of the Cloudinary class or globally using an environment variable. You can find your account-specific configuration parameters in the **Dashboard** page of your [account console](https://cloudinary.com/console).
@@ -83,7 +87,7 @@ export default function App() {
8387
```
8488

8589
### Video Player
86-
The `AdvancedVideo` component provides video playback capabilities with optional analytics tracking. **Note: This requires `expo-av` to be installed.**
90+
The `AdvancedVideo` component provides video playback capabilities with optional analytics tracking. **Note: This requires either `expo-av` (SDK 50-51) or `expo-video` (SDK 52+) to be installed.**
8791

8892
```tsx
8993
import { AdvancedVideo } from 'cloudinary-react-native';

example/.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
engine-strict=false
2+
fund=false
3+
audit=false
4+
update-notifier=false

example/App.tsx

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { StyleSheet, View, Text, TouchableOpacity, Alert, Platform, Dimensions } from 'react-native';
22
import { StatusBar } from 'expo-status-bar';
3+
34
import {AdvancedImage, AdvancedVideo} from 'cloudinary-react-native';
45
import {Cloudinary} from '@cloudinary/url-gen';
56
import {scale} from "@cloudinary/url-gen/actions/resize";
@@ -9,16 +10,14 @@ import React, {useRef, useState} from "react";
910

1011
const { height: screenHeight, width: screenWidth } = Dimensions.get('window');
1112

12-
// Calculate safe area padding based on screen dimensions
1313
const getTopPadding = () => {
1414
if (Platform.OS === 'ios') {
15-
// For iPhone X and newer (with notch), screen height is typically 812+ or width 390+
1615
if (screenHeight >= 812 || screenWidth >= 390) {
17-
return 60; // Devices with notch
16+
return 60;
1817
}
19-
return 40; // Older devices
18+
return 40;
2019
}
21-
return 35; // Android
20+
return 35;
2221
};
2322

2423
const cld = new Cloudinary({
@@ -49,7 +48,6 @@ export default function App() {
4948
const newAnalyticsState = !analyticsEnabled;
5049
setAnalyticsEnabled(newAnalyticsState);
5150

52-
// Auto-enable tracking when analytics are enabled for better UX
5351
if (newAnalyticsState && !autoTracking) {
5452
setAutoTracking(true);
5553
}
@@ -118,7 +116,7 @@ export default function App() {
118116
videoPlayer.current.addCustomEvent('user_interaction', {
119117
action: 'button_clicked',
120118
buttonName: 'share',
121-
videoPosition: 30.5, // seconds
119+
videoPosition: 30.5,
122120
customData: {
123121
userId: 'demo-user-123',
124122
sessionId: 'session-456'
@@ -138,7 +136,6 @@ export default function App() {
138136
<AdvancedImage cldImg={createMyImage()} style={{backgroundColor:"black", width:300, height:200}}/>
139137
</View>
140138

141-
{/* Analytics Controls */}
142139
<View style={styles.controlsContainer}>
143140
<Text style={styles.title}>Analytics Testing</Text>
144141

@@ -157,34 +154,39 @@ export default function App() {
157154
<TouchableOpacity style={styles.button} onPress={addCustomEventToVideo}>
158155
<Text style={styles.buttonText}>Send Custom Event</Text>
159156
</TouchableOpacity>
157+
158+
160159
</View>
161160

162161
<View style={styles.videoContainer}>
163-
<AdvancedVideo
164-
ref={videoPlayer}
165-
videoStyle={styles.video}
166-
cldVideo={createMyVideoObject()}
167-
enableAnalytics={analyticsEnabled}
168-
autoTrackAnalytics={autoTracking}
169-
analyticsOptions={{
170-
customData: {
171-
userId: 'demo-user-123',
172-
appVersion: '1.0.0',
173-
platform: 'react-native'
174-
},
175-
videoPlayerType: 'expo-av',
176-
videoPlayerVersion: '14.0.0'
177-
}}
178-
/>
162+
{(() => {
163+
return (
164+
<AdvancedVideo
165+
ref={videoPlayer}
166+
videoStyle={styles.video}
167+
cldVideo={createMyVideoObject()}
168+
enableAnalytics={analyticsEnabled}
169+
autoTrackAnalytics={autoTracking}
170+
analyticsOptions={{
171+
customData: {
172+
userId: 'demo-user-123',
173+
appVersion: '1.0.0',
174+
platform: 'react-native'
175+
},
176+
videoPlayerType: 'auto-detected',
177+
videoPlayerVersion: 'auto-detected'
178+
}}
179+
/>
180+
);
181+
})()}
179182
</View>
180-
181-
{/* Status Display */}
183+
182184
<View style={styles.statusContainer}>
183185
<Text style={styles.statusText}>
184-
Analytics: {analyticsEnabled ? 'Enabled' : 'Disabled'}
186+
Analytics: {analyticsEnabled ? 'Enabled' : 'Disabled'}
185187
</Text>
186188
<Text style={styles.statusText}>
187-
Auto Tracking: {autoTracking ? 'Enabled' : 'Disabled'}
189+
Auto Tracking: {autoTracking ? 'Enabled' : 'Disabled'}
188190
</Text>
189191
</View>
190192
</View>

0 commit comments

Comments
 (0)