I’m currently testing an optimal workflow to get video to you and so far I’ve found the create API to be the cleanest way. I basically pass a signed google storage URL to video.create({ source }) and everything seems to go smoothly.
What is the best way to pass a foreign id to you guys? In other words I’d like to create our own ids for the videos, I’m guessing this is done via metadata? I noticed with the upload method you can supply your own videoId so I was curious if the same can be done with video.create()?
1 Like
Hi Michael,
Thanks for the post - the videoId is generated randomly by api.video - there is no way for you to use use an external id for the videoId (but I’ll put that on the board as a possible future idea).
When you create a video, you can add a title, a description, metadata or tag. The title is visible in the player, but the description, metadata and tag attributes are searchable when querying for a video - so you could place your internal ID in either of those fields.
Doug
1 Like
Thanks for the clarification Doug. The metadata will be more than enough if they are searchable.
1 Like
Hey Doug,
I actually think being able to specify a guaranteed unique id would be useful. The metadata is nice but if we want to guarantee that one video is uploaded per id it’s a little bit harder to orchestrate. I think what we will have to do is, query for the metadata id and then just use the latest one if there are multiple identical ids.
I also noticed when creating a video using the node-js client that a video will still get created even if it errors. In this case, I was receiving an error that the source was not valid but it proceeded to create the container anyway see screenshot:
Here’s the error: “The video source is not downloadable, please use an accessible valid http(s) URL.”
I think the video should not get created if there is an error, is this a bug?
Michael,
Currently the videoId is a global unique variable on our end - so letting developers pick an Id would require a check for availability. By assigning an Id - it works the first time, and there is no need for error handling on duplicate videoIds.
There is a good reason for this design: Once a videoId is created and a video is uploaded (or attempted to upload), that is the only video available for that videoId - so there is NO possibility for there to be multiple videos with the same videoId. (if you had an error on upload - your 1:1 correlation with videoId and your identifier would be broken).
The way our API works is that the videoID/container is created, and then the video is uploaded. The SDK obfuscates that a bit, but that is what is happening in the background. Perhaps if there is an error in upload - you could call delete video to remove that empty video container from your account. (This would also eliminate the duplicate Ids in the metadata.)
Doug
Nice info, thanks for sharing