Quick Start Guide
Get a public url to stream your video with only few lines of code and 5 steps !
1 - Login to 42videobricks
Click on: Login to Admin
If your are not aleady registered, you need to create an account: Register.
42videobricks is free to test: you just need to register and you will be able to test our api in the sandbox.
2 - Get your sandbox api key
You can get you sandbox api key in the api keys section of the admin: Api Keys Admin.
3 - Create a video
First, you need to create a video object which would contains metas informations such as video title, description.
In this test, you should set a title, a description and set public to true (it sets video pricacy to public).
Call the add a new video endpoint with your sendbox api key in the x-api-key header.
curl --request POST \
--url https://api-sbx.42videobricks.com/videos \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-api-key: 5350d5d233c806915aeace7f754bbd0c85066cb3489d354ed9cb2f05d94afd1a' \
--data '
{
"title": "My first video",
"description": "My first video with 42videobricks!",
"public": true
}
'
Return a 201 status code (Video Created):
{
"id": "dklwY3R1Tlh5ZnFlMHBxaQ==",
"title": "My first video",
"description": "My first video with 42videobricks!",
"duration": 0,
"status": "REQUESTED",
"ctime": 1688333813,
"mtime": 1688333813,
"assets": {
"thumbnail": "",
"player": "",
"stream": "",
"iframe": ""
},
"public": true,
"links":[]
}
Your video object id is: dklwY3R1Tlh5ZnFlMHBxaQ==.
4 - Upload a video file
Once your video object is created, you can upload and attached a video file in the edit video form.
You are going to use the single file upload process in 3 steps.
4.1 - Initialize upload
Call the single file upload intialization endpoint to get signedurl.
curl --request GET \
--url https://api-sbx.42videobricks.com/videos/dklwY3R1Tlh5ZnFlMHBxaQ%3D%3D/upload/init \
--header 'accept: application/json' \
--header 'x-api-key: 5350d5d233c806915aeace7f754bbd0c85066cb3489d354ed9cb2f05d94afd1a'
Returns a 200 status code (Signed url to post the video file to upload) with this json conent:
{
"signedUrl": "https://alchimie-vpaas-client-uploads.s3.amazonaws.com/ABknYkcUrKMAMTJJ/dklwY3R1Tlh5ZnFlMHBxaQ%3D%3D.mp4?AWSAccessKeyId=ASIAXDYZVN2L6DRFYJR5&Signature=XvRSbCEE0mxhZ86pzKkkwhCqWJA%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEHYaCWV1LXdlc3QtMSJGMEQCID%2B1Fr4%2BqR0MreZFq3cv11LOqLF4eRGUlYWuV2GctBeUAiBSptQHJDBDUKd1RzD2WAqYgyPdYGU3q5Yi8Hrnk8NeFSquAwjf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDQ4OTE0MzIzNDE5OSIMKV%2FJomqo4haMB0qbKoIDxKRgtRmGp9DqNT2trakOqXRP%2Foefw6Gf%2FIIHXlrGQcOcpiCgQNKwz%2BIk%2BoVxNuHAxWgG4U7Yzz2sq2uHBagX9%2BDFZ957jz4MjF4b2RMipSnfYkb62DGPXsHBnNG7bMSV19C6g5uBcYfCVz1p4DtyBIWWC5ArbrXgyZl%2FDgi8cMZGLlyhFLAv0GJKKzfv7JAFVGJ30jQOhE3d4X68ENaQ1kZckaRKICoQ01nbDx99S0xgzTWg43wblvOihJl53oAdz%2BkUtPUSi%2Frz%2FQdFJIiyEHrOE%2FScMXD5I4oMHtleNy7P70lvyH3OFKxP7BkS54crFM0IyAQZOAbXU0bZgBtBBmeIFt83pWcfarc4Rtt%2FUK9qEA%2FKYOVBHPJ0Hvd%2B45x6FOjy%2BtwfC1N0k%2FPcpc0B34mffWTEFot0A1zZXjGT4jrKsIAxRrrrqqqE51NOSDrX7N12hjx%2BN%2BbhqhINxsC%2Fuddv0k8e8VLOqqWaQaFYLl%2BFWXwRSeFB21OqSJrc5InKyMswrOGHpQY6ngF%2FFp%2F9o%2F7ycBN8N8L5jU8jrnz6W2iP0d%2BtlLGUu%2FyjJyYjEVwrU1hbKE3q2OWcF5qVDj280jFmDMrkm%2BxZHjRytHoAzN9m4qcBfbLMwHP23x9Nrq41subR97sY1EEw0eaepYm3cEGkjfM3pUlDEGcZ%2FqrQPNGa1msKIpTselMsi0NNuJpbvlzDzJhwSCowf8GiP6JkKj5HLk6C%2BT%2BscQ%3D%3D&Expires=1688335409"
}
4.2 - Upload video file
Upload the video file to the signed url with a PUT request:
curl -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AzN9m4qcBfbLMwHP23x9Nrq41subR97sY1EEw0eaepYm3cEGkjfM3pUlDEGcZ%2FqrQPNGa1msKIpTselMsi0NNuJpbvlzDzJhwSCowf8GiP6JkKj5HLk6C%2BT%2BscQ%3D%3D&Expires=1688335409"
4.3 - Finalize upload
Call the single file upload finalization endpoint to acknowledge the end of the file upload to the signed url.
curl --request PUT \
--url https://api-sbx.42videobricks.com/videos/dklwY3R1Tlh5ZnFlMHBxaQ%3D%3D/upload/finalize \
--header 'accept: application/json' \
--header 'x-api-key: 5350d5d233c806915aeace7f754bbd0c85066cb3489d354ed9cb2f05d94afd1a'
Returns a 202 status code (Upload accepted).
The transcoding start once the finalize endpoint is called.
You can get more details on file upload in this section: Upload a video.
5 - Get and share your video url
You need to get your video object by calling the retun a single video endpoint:
curl --request GET \
--url https://api-sbx.42videobricks.com/videos/dklwY3R1Tlh5ZnFlMHBxaQ%3D%3D \
--header 'accept: application/json' \
--header 'x-api-key: 5350d5d233c806915aeace7f754bbd0c85066cb3489d354ed9cb2f05d94afd1a'
returns 200 status code with the video object:
{
"id": "dklwY3R1Tlh5ZnFlMHBxaQ==",
"title": "My first video",
"description": "My first video with 42videobricks!",
"duration": 0,
"status": "TRANSCODING",
"ctime": 1688333813,
"mtime": 1688335218,
"assets": {
"thumbnail": "https://media-delivery-cdn.alchimie-services.net/image/v1/mediadb-product-filetype/1136123/COVER.jpg",
"player": "https://stream.42videobricks.com/dklwY3R1Tlh5ZnFlMHBxaQ==/player",
"stream": "https://stream.42videobricks.com/dklwY3R1Tlh5ZnFlMHBxaQ==/stream",
"iframe": "<iframe src=\"//stream.42videobricks.com/dklwY3R1Tlh5ZnFlMHBxaQ==/player\" gesture=\"media\" allow=\"encrypted-media\" allowfullscreen=\"allowfullscreen\" width=\"100%\"></iframe>"
},
"public": true,
"links":[]
}
Unfortunately the video not available yet and is still transcoding ("status": "TRANSCODING").
After transcoding you video is available: transcoding duration should take less than the uploaded video duration. i.e: a 5 minutes video should be available after less than 5 minutes transcoding.
So if we wait until the transcoding is completed by calling again the same endpoint, you should get an available video:
{
"id": "dklwY3R1Tlh5ZnFlMHBxaQ==",
"title": "My first video",
"description": "My first video with 42videobricks!",
"duration": 11,
"status": "AVAILABLE",
"ctime": 1688333813,
"mtime": 1688335321,
"assets": {
"thumbnail": "https://media-delivery-cdn.alchimie-services.net/image/v1/mediadb-product-filetype/1136123/COVER.jpg",
"player": "https://stream.42videobricks.com/dklwY3R1Tlh5ZnFlMHBxaQ==/player",
"stream": "https://stream.42videobricks.com/dklwY3R1Tlh5ZnFlMHBxaQ==/stream",
"iframe": "<iframe src=\"//stream.42videobricks.com/dklwY3R1Tlh5ZnFlMHBxaQ==/player\" gesture=\"media\" allow=\"encrypted-media\" allowfullscreen=\"allowfullscreen\" width=\"100%\"></iframe>"
},
"public": true,
"links":[]
}
Now, you can get link from the asset property of your video:
- assets.player: url to our player with your video embeded
- assets.stream: your video streaming url
- assets.iframe: to embed our player with your video as an iframe within a web page.
- assets.thumbnail: the video thumbnail image
That's all !!!
Updated 4 months ago