London Escorts sunderland escorts 1v1.lol unblocked yohoho 76 https://www.symbaloo.com/mix/yohoho?lang=EN yohoho https://www.symbaloo.com/mix/agariounblockedpvp https://yohoho-io.app/ https://www.symbaloo.com/mix/agariounblockedschool1?lang=EN
2 C
New York
Wednesday, January 29, 2025

react native – Expo Digital camera saving video utilizing createAssetAsync not engaged on iOS solely. ERR_UNSUPPORTED_ASSET_TYPE for .mov file


I’m utilizing Expo in React Native, and I would like the consumer to file movies utilizing the digital camera and reserve it to the telephone. The whole lot is working effective on Android however on iOS, the createAssetAsync name is failing with the next error:

Error: This URL doesn’t include a legitimate asset kind: file:///var/cell/Containers/Knowledge/Software/22FC2F8C-E052-4FF5-B451-4973C95AD74E/Library/Caches/Digital camera/50220C17-AB3B-4586-80D7-67A6D27D6105.mov

And likewise {“code”: “ERR_UNSUPPORTED_ASSET_TYPE”}

Right here is my useEffect code that saves the video:

    useEffect(() => {

        const saveVideo = async () => {
            console.log('rURI:', recordedUri);
            console.log('recordedUri kind:', typeof recordedUri);
            if (recordedUri) {

                // Test file existence
                const fileInfo = await FileSystem.getInfoAsync(recordedUri);
                console.log('fileInfo:', fileInfo);
                if (!fileInfo.exists) {
                    console.error('File doesn't exist:', recordedUri);
                    return;
                }

                const { standing, canAskAgain } = await MediaLibrary.requestPermissionsAsync();
                if (standing !== 'granted' && canAskAgain) {
                    const fullPermission = await MediaLibrary.requestPermissionsAsync({ writeOnly: false });
                    console.log('Full permission standing:', fullPermission.standing);
                }


                strive{
                const asset = await MediaLibrary.createAssetAsync(recordedUri);
                console.log('asset:', asset);
                setNewAssetCounter(newAssetCounter + 1);}
                catch (err) {
                    console.log('Error creating asset:', JSON.stringify(err, null, 2))
                }
            }
            closeCamera();
        }
        saveVideo();
    },
    [recordedUri])

Right here is my code the place I file the video:

    const startRecording = async () => {
    if (cameraRef.present) {
        setVideoElapsedTime(0);
        const videoRecordPromise = cameraRef.present.recordAsync();
        if (videoRecordPromise) {
            setIsRecording(true);
            timerRef.present = setInterval(() => {
                setVideoElapsedTime((prevTime) => prevTime + 1);
            }, 1000);
            const video = await videoRecordPromise;
            setRecordedUri(video.uri);
        }
    }
};

// Cease recording
const stopRecording = async () => {

    const { standing } = await MediaLibrary.requestPermissionsAsync();
    console.log('standing:', standing);
    if (standing !== 'granted') {
        alert('Permission to entry media library is required!');
        return;
    }

    console.log('line157');
    strive {
        if (cameraRef.present && isRecording) {
            console.log('line159');
            cameraRef.present.stopRecording();
            setIsRecording(false);
            clearInterval(timerRef.present);
            console.log('line162');
        }
    } catch (error) {
        console.error('Error saving video:', error);
    }
};

Any strategies drastically appreciated!

Related Articles

Social Media Auto Publish Powered By : XYZScripts.com