[READ ONLY MIRROR] Open Source TikTok alternative built on AT Protocol github.com/sprksocial/client
flutter atproto video dart
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

sim

C3B 7a646c7c 3113c52c

+1 -66
+1 -2
app/(tabs)/CreateScreen.tsx
··· 1 - import { openVideoFromLocalPathExample } from '@/components/Creation/ShowVideoEditor'; 2 1 import { Ionicons } from '@expo/vector-icons'; 3 2 import { CameraView, CameraType, useCameraPermissions } from 'expo-camera'; 4 3 import { useState } from 'react'; ··· 32 31 <TouchableOpacity style={styles.button} onPress={toggleCameraFacing}> 33 32 <Ionicons name="camera-reverse" size={32} color="white" /> 34 33 </TouchableOpacity> 35 - <TouchableOpacity style={styles.button} onPress={() => {openVideoFromLocalPathExample()}}> 34 + <TouchableOpacity style={styles.button} onPress={() => {}}> 36 35 <Ionicons name="ellipse" size={64} color="white" /> 37 36 </TouchableOpacity> 38 37 <TouchableOpacity style={styles.button} onPress={() => {}}>
-64
components/Creation/ShowVideoEditor.tsx
··· 1 - import { Platform, Alert } from 'react-native'; 2 - import { ios_license, android_license } from './vesdk_license'; 3 - 4 - // Define type for VESDK 5 - interface VideoEditorSDK { 6 - unlockWithLicense: (license: string) => Promise<void>; 7 - openEditor: (video: any) => Promise<any>; 8 - } 9 - 10 - // Try to get VESDK dynamically to avoid immediate reference errors 11 - let VESDK: VideoEditorSDK | null = null; 12 - 13 - // Function to initialize VESDK safely 14 - const initVESDK = async () => { 15 - if (VESDK === null) { 16 - try { 17 - const VESDKModule = require('react-native-videoeditorsdk'); 18 - VESDK = VESDKModule.VESDK; 19 - } catch (error) { 20 - console.error('Failed to import VESDK:', error); 21 - return false; 22 - } 23 - } 24 - return !!VESDK; 25 - }; 26 - 27 - export const openVideoFromLocalPathExample = async (): Promise<void> => { 28 - try { 29 - // Initialize VESDK first 30 - const isSDKAvailable = await initVESDK(); 31 - 32 - if (!isSDKAvailable || !VESDK) { 33 - throw new Error('Video Editor SDK could not be initialized'); 34 - } 35 - 36 - // Get the license based on platform 37 - const license = Platform.OS === 'ios' ? ios_license : android_license; 38 - 39 - // Unlock with license 40 - await VESDK.unlockWithLicense(license); 41 - 42 - // Add a video from the assets directory 43 - const video = require('./cat.MOV'); 44 - 45 - // Open the video editor 46 - const result = await VESDK.openEditor(video); 47 - 48 - if (result != null) { 49 - // The user exported a new video successfully 50 - console.log(result?.video); 51 - } else { 52 - // The user tapped on cancel 53 - return; 54 - } 55 - } catch (error: any) { 56 - console.error('Video Editor Error:', error); 57 - Alert.alert( 58 - "Error", 59 - `Failed to open video editor: ${error.message || String(error)}`, 60 - [{ text: "OK" }] 61 - ); 62 - } 63 - }; 64 -
components/Creation/cat.MOV

This is a binary file and will not be displayed.