Reputation: 16992
How does contentful return video content? Is it returned in JSON format or is it returned as a binary data stream? Contentful's delivery api always seems to return REST response ,however I am not sure how video content is returned and served.
Upvotes: 1
Views: 4754
Reputation: 1457
Video, and any other kinds of media are stored as Assets. When you get an Asset from the REST API it is returned as JSON, with a property containing a url to the relevant media file stored in that asset.
You can see that in this particular example from the API docs:
{
"fields": {
"title": "Nyan Cat",
"file": {
"fileName": "Nyan_cat_250px_frame.png",
"contentType": "image/png",
"url": "//images.contentful.com/cfexampleapi/4gp6taAwW4CmSgumq2ekUm/9da0cd1936871b8d72343e895a00d611/Nyan_cat_250px_frame.png",
"details": {
"image": {
"width": 250,
"height": 250
},
"size": 12273
}
}
},
"sys": {
...
}
}
In this case it's an image, but if it was a video you'd have a video url instead and the relevant content type.
More details here https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/assets/assets-collection/get-a-single-asset?console=1
Upvotes: 4