iOS-SDK get video ID/object upon successful upload

Hello,

I’m trying to upload a video using the iOS-SDK in a sandbox mode.
So far it went well with the exception that I can’t get the video ID/object upon successful upload.

I need the video ID to be saved on my application’s database for my own internal logic.

On my first attempt I used:

videoApi.create(title: title, description: description, fileName: filename, filePath: filepath, url: url){ (created, resp) in
    if(resp != nil && resp?.statusCode != "200" && resp?.statusCode != "201" && resp?.statusCode != "202"){
        // Error
        // Do whatever you want
        // created == false & resp != nil
    }else{
        // Success
        // Do whatever you want
        // created == true & resp == nil
    }
}

It only returns boolean on success.

On my second attempt, I tried to create/init the metadata first before uploading…

videoApi.initVideo(title: title, description: description){ (uri, resp) in
    if(resp != nil && resp?.statusCode != "200" && resp?.statusCode != "201" && resp?.statusCode != "202"){
        // Error
        // Do whatever you want
        // uri == "" & resp != nil
    }else{
        // Success
        // Do whatever you want
        // uri == video uri & resp == nil
    }
}

This will return the full path instead of just the video ID:

/videos/{video-id}/source

Which then I will have to extract the ID manually before I can continue with uploading the video.

Am I missing anything?

Thanks!

Hello,

Indeed this was not able on this version of the sdk. We worked on it, you can now use the version 0.1.6 (published today). Now the method create return a video object instead of a boolean.

Romain

Thanks for this. I can confirm it works as expected.