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 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
Elements do not have a dedicated class or object. Instead, they are created as simple JSON objects. -
Hyphens become underscores in property names
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 (that will be sent in the
x-api-key
header) - 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
3. Send the render request
- Post the movie to be rendered with the
render
method
4. Check the render status
- Check the status of your rendering job calling the
getStatus
method every few seconds