Working with Movies

The Movie object is the root of the movie template hierarchy. To access other elements in the hierarchy you first need to have access to a Movie object.

Important Movie Properties

The important properties of a movie are the width, height, and the frame rate. Width and height are specified in pixels. The framerate is specified as a fractional number, given as a numerator and a denominator, e.g. 25/1 for 25 frames per second, or, 30000/1001 for a 29.97 frames per second movie. The default is 25 frames per second.

Creating a Movie from Scratch

You can create new movies from scratch, as demonstrated in the following example:

var project = new FX.Project({region: 'REGION'})    
var movie = new sdl.Movie({
    params: {
        vparams: {
            width: 640,
            height: 360
        },
        fps: {
            num: 25,
            den: 1
        }
    }
})

project.createMovie({Name: "MyMovieName", Movie: movie}, function(err, data) {
    console.log("Movie created")
})    

Loading and Saving an Existing Movie Template

To load an existing template you need to know the name of the dynamic movie and load it.

var project = new FX.Project({region: 'REGION'})    

project.getMovie({Name: "MyMovieName"}, function(err, data) {
    console.log("Movie:", data.Movie)

    project.createMovie({Name: "MyNewMovieName", Movie: data.Movie}, function(err, data) {
        console.log("Movie created")
    })    
})    

Asynchronous Operation

Remember, that all I/O operations in Javascript running in the browser are asynchronous and you can proceed in your script only after the operation is complete. Please see the FX Javascript SDK Documentation to learn more about callbacks, events, and Promises.

Terms of Use | © 2017, Impossible Software, or its affiliates. All rights reserved.