JSON2Video provides you with SDKs for the most popular programming languages to make the implementation even easier. We currently support PHP and NodeJS, but other SDKs are in the short-term pipeline: Python, Go and other.
SDK basic concepts
All our SDKs have common concepts you should understand:
-
SDKs are Object-oriented
There are 2 main classes to use:Movie
andScene
-
Movie class
Represents the movie JSON schema and allows to define the output video properties, the project and the calls to the API (render
andgetStatus
). -
Scene class
Represents the scene JSON schema and defines the different scenes in the Movie object. -
Elements are created as JSON objects
There's not an class or language object for the elements. Instead, they are created as JSON objects. -
Hyphens become underscores in property names
These property names in the Movie and Scene schemes that include hyphens (likebackground-color
), the hyphen is always translated to underscores (like in$scene->background_color
).
Steps for creating a video with the SDKs
1. Create and setup the Movie object
- Create the
Movie
object - Set your API key
- Set your project name
- Define your desired resolution and quality (optional)
2. Create one or more Scenes
- Create one or more
Scene
objects - Add elements to them with the
addElement
method - Add the scenes to the movie with the
addScene
method
{
"project": "tutorial",
"resolution": "full-hd",
"quality": "high",
"scenes": [
{
"background-color": "#4392F1",
"elements": [
{
"type": "text",
"items": [
{
"text": "Hello world"
}
],
"y": 510,
"duration": 10
}
]
}
]
}
3. Send the render request
- Post the movie to be rendered with the
render
method
{
"project": "tutorial",
"resolution": "full-hd",
"quality": "high",
"scenes": [
{
"background-color": "#4392F1",
"elements": [
{
"type": "text",
"items": [
{
"text": "Hello world"
}
],
"y": 510,
"duration": 10
}
]
}
]
}
4. Check the render status
- Check the status of your rendering job calling the
getStatus
method every few seconds