Skip to content

Commit 88be10e

Browse files
authored
Add video layer
1 parent fe37a26 commit 88be10e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+25104
-1795
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ npm install expo-video
5555

5656
**Note:** `expo-av` is deprecated in SDK 52 and removed in SDK 53. For newer Expo versions, use `expo-video`.
5757

58+
### For Video Layer with Controls (CLDVideoLayer)
59+
If you want to use the `CLDVideoLayer` component with UI controls, you need to install additional dependencies:
60+
61+
```bash
62+
npm install @expo/vector-icons expo-font
63+
```
64+
Or
65+
```bash
66+
yarn add @expo/vector-icons expo-font
67+
```
68+
5869
## Usage
5970
### Setup
6071
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).
@@ -154,6 +165,62 @@ export default function App() {
154165
};
155166
```
156167
168+
### Video Layer with Controls
169+
The `CLDVideoLayer` component provides a full-screen video experience with overlay controls, seekbar, and customizable actions. **Note: This requires `@expo/vector-icons` and `expo-font` to be installed.**
170+
171+
```tsx
172+
import React from 'react';
173+
import { View, StyleSheet } from 'react-native';
174+
import { CLDVideoLayer } from 'cloudinary-react-native';
175+
import { Cloudinary } from '@cloudinary/url-gen';
176+
import { useFonts } from 'expo-font';
177+
import { Ionicons } from '@expo/vector-icons';
178+
179+
const myCld = new Cloudinary({
180+
cloud: {
181+
cloudName: "demo",
182+
},
183+
});
184+
185+
export default function App() {
186+
// Preload fonts to prevent warnings
187+
const [fontsLoaded] = useFonts({
188+
...Ionicons.font,
189+
});
190+
191+
if (!fontsLoaded) {
192+
return null; // or a loading component
193+
}
194+
195+
const video = myCld.video('sea_turtle');
196+
197+
const handleBack = () => {
198+
// Handle back navigation
199+
};
200+
201+
const handleShare = () => {
202+
// Handle custom share action
203+
};
204+
205+
return (
206+
<View style={styles.container}>
207+
<CLDVideoLayer
208+
cldVideo={video}
209+
onBack={handleBack}
210+
onShare={handleShare}
211+
/>
212+
</View>
213+
);
214+
}
215+
216+
const styles = StyleSheet.create({
217+
container: {
218+
flex: 1,
219+
backgroundColor: '#000',
220+
},
221+
});
222+
```
223+
157224
### Uploading Assets
158225
The following example performs an unsigned upload of a `string` using the default settings, a request upload callback, and an upload preset (required for unsigned uploads):
159226

0 commit comments

Comments
 (0)