Custom Metadata
In some scenarios you may need to associate your videos with an id or other data originating in your application before you upload your video. In order to faciliate this the create video api has a field for customMetadata
. You can pass stringified JSON data here and that will be returned in any webhook event for the video.
const formData = new FormData();
const customMetadata = JSON.stringify({productId: 'someUuid'})
formData.append('file', videoFile);
formData.append('resolutions', '144p,240p,480p');
formData.append('isPublic', 'true');
formData.append('customMetadata', customMetadata)
fetch(`https://dev.api.hyperserve.io/api/video`, {
method: 'POST',
headers: {
'X-API-KEY': YOUR_HYPERSERVE_API_KEY,
},
body: formData
});
For example, this is useful in the scenario where you create product in an ecommerce site and then upload the video. You could include the product id in custom_metadata, when the webhook event for processing complete comes through you would be able to determine which product's video is ready for the users to view and update your database accordingly.