Ziggeo / ReactNativeSDK

React Native SDK
Apache License 2.0
7 stars 6 forks source link

iOS Ziggeo.VideosApi.update not resolving/throwing #68

Closed jessypouliot98 closed 5 months ago

jessypouliot98 commented 3 years ago

We need to set customData to the sent video (recording or uploads), we also add the mobile tag in case we need to debug something and know where it is coming from.

I have contacted the support a couple weeks ago and they said to use "Ziggeo.setExtraArgsForRecorder" which worked for recordings but not uploads. (also can't remember if tags worked or not)

So I found out I can update the video with it's token to add these values.

Unfortunately, this is not working anymore.. It might be because of this other issue.

Though there is still a problem with the actual function. The function never ends. It is never resolved and it doesn't ever throw an Error.

Haven't run into this issue on Android. Currently testing on Iphone 12 mini, iOS - 14.6

setEventListeners = () => {
    const emitter = Ziggeo.recorderEmitter();

    emitter.addListener('UploadProgress', this.onUploadProgress);
    // as per other issue, no other events are working.
};

upload = async () => {
    Ziggeo.setAppToken(ZIGGEO_APP_TOKEN);

    this.setEventListeners();

    this.setState({ currentState: VideoCommunication.STATUS.SELECTING_FILE }, this.onStatusUpdated);

    try {
        const token = await Ziggeo.uploadFromFileSelector(); // I think something changed here since v1.5.0, it resolves the token when file has been Uploaded instead of when it is Processed

        await this.onProcessed({ token });
    } catch (_) {
        await this.delete();
    }
}

onProcessed = async ({ token }) => {
    const thumbnail = VideoCommunication.uri.video.thumbnail(token);
    const { width, height } = await getImageSize(thumbnail);

    const updatePayload = {
        tags: ['mobile'],
        data: JSON.stringify(this.props.customData),
    };

    try {
        await Ziggeo.VideosApi.update(token, JSON.stringify(updatePayload)); // Code gets stuck here on iOS..
    } catch (error) {
        LogHandler.logError(error, 'Could not update Ziggeo Video', {
            token,
            updatePayload,
        });
    }

    this.setState({
        token,
        currentState: VideoCommunication.STATUS.PROCESSED,
        source: {
            uri: VideoCommunication.uri.video.thumbnail(token),
            width,
            height,
        },
    }, () => {
        this.onTokenUpdated();
        this.onStatusUpdated();
    });
}

react-native-ziggeo-library@1.5.2

katolykdev commented 1 year ago

Hello, @jessypouliot98 Please check on current version 1.6.26.