Stupeflix Factory documentation¶
Stupeflix Factory allows you to integrate a feature complete Stupeflix Editor into your application flow.
Getting started¶
A Stupeflix Factory demo is available at http://studio.stupeflix.com/factory/demo/.
Editing sessions¶
Stupeflix Factory works with editing sessions. One editing session ends with one produced video.
Every editing session goes like this: 1. Configure a session 2. Display the session’s editing interface 3. Get the session’s output
Configure a session¶
Each factory has its own https endpoint, in the form of https://studio.stupeflix.com/factory/FACTORY_ID/. To configure an editing session you need to http POST your configuration to this endpoint.
Configuration parameters¶
Stupeflix Factory works like basic html forms with action, method and target parameters defining how the factory will call you server back.
- action
- The URL of the program that will process the information submitted by the factory. If this value is not specified the factory will submit to a debug page.
- method
- The HTTP method to use to submit the factory information to the action URL. Possible values are get (default) or post.
- target
- A name or keyword indicating where to display the response returned by the action URL.
- _self: Load the response into the same frame as the factory.
- _blank: Load the response into a new unnamed window.
- _parent: Load the response into the factory parent frame. If there is no parent, this option behaves the same way as _self.
- _top (default): Load the response into the factory top-level parent frame. If there is no parent, this option behaves the same way as _self.
- allow_preview
- Defines if the factory allows the user to preview her video. Possible values are true (default) or false.
- custom_css_url
- The URL of an extra css file to include into the factory html pages.
- export_label
- The label to display for the export button, default is Export.
- rendering_label
- The label to display on the video rendering screen (progress bar), default is Please wait while Stupeflix.com creates your video....
- custom_media_library_url
- The URL of a custom media library server. See How to implement a Custom Media Library Server.If configured Stupeflix Factory will display the custom media library option alongside the others media importers.
- custom_media_library_name
- The name to display for the custom media library option.
- definition
- Use the definition parameter to prepopulate the editor. The definition value must be a valid json project definition.
- secret
- Your factory has been associated with a Stupeflix API key. Use your API key secret to authenticate your configuration call.
Response¶
A successfull configuration call returns a response like this:
{
"factory_id": "ABCDEF",
"video_id": "ABCDEF/12345"
"edit_video_url": "https://studio.stupeflix.com/factory/ABCDEF/edit/?video_id=ABCDEF%2F12345"
}
- factory_id
- Your Stupeflix Factory unique identifier.
- video_id
- This editing session unique identifier. That’s the identifier your have to associate with your users if you want to keep track of which videos were created by which users.
- edit_video_url
- This editing session url, to display in an iframe.
Additionnal configuration parameters¶
- video_id
- Resume an existing editing session. video_id must be a valid editing session identifier.
- remix
- Clone an existing editing session (the video in it may be exported or not). remix must be a valid editing session identifier.
Display the session’s editing interface¶
Once you get an edit_video_url, you have to display its content to your user. You can either do it by redirecting your user’s browser to this url or by setting this url as an iframe src:
<iframe src="https://studio.stupeflix.com/factory/ABCDEF/edit/?video_id=ABCDEF%2F12345"
width="960" height="600" scrolling="no" frameborder="no"></iframe>
Get the session’s output¶
When your user’s video is ready, Stupeflix Factory will call your server back, respecting your action, method and target configuration with the following data:
- video_id
- This editing session unique identifier.
- video_name
- The name your user gave to her video.
- video_url
- The URL of the exported video file.
- thumb_url
- An URL pointing to a thumbnail of the exported video.
- hres
- The horizontal (x) resolution of the exported video and thumbnail.
- vres
- The vertical (y) resolution of the exported video and thumbnail.
Static configuration¶
Stupeflix Factory supports a number of server side configuration parameters. For now these parameters can only be set by Stupeflix staff.
- video_name
- The default name for new videos, default is My Stupeflix Video.
- export_profile
- The video format to use to export the user’s video. See Stupeflix API supported formats.
- upload_target
- Where to upload the exported video.Stupeflix Factory supports Youtube, Facebook, Dailymotion, S3, FTP, HTTP POST and HTTP PUT uploads.
How to implement a Custom Media Library Server¶
Requests¶
Stupeflix Factory will query the configured custom_media_library_url each time an user wants to access the custom library content.
Root level content¶
To get a 50 items list starting at the item n°0, Stupeflix Factory will issue a GET request to:
http://custom_media_library_url?method=getList&offset=0&limit=50
- GET parameters:
name value method getList offset 0 limit 50
to get the next 50 items the request will be:
http://custom_media_library_url?method=getList&offset=50&limit=50
- GET parameters:
name value method getList offset 50 limit 50
Folder content¶
To get the 50 first items of the folder 562436708, Stupeflix Factory will issue a GET request to:
http://custom_media_library_url?method=getList&id=562436708&offset=50&limit=50
- GET parameters:
name value method getList id 562436708 offset 0 limit 50
Responses¶
custom_media_library_url server responses are expected in JSON format (http://www.json.org/) with an application/javascript Content-Type.
{
/* offset & limit values used for this response */
"offset": 0,
"limit": 50,
/* Items to display (array)
supported types are folder, image, video */
"items": [
{
"type": "folder",
"id": "562436708", /* Unique folder identifier on your server.
Stupeflix Factory will issue a GET request to:
http://custom_media_library_url?method=getList&id=562436708&offset=0&limit=50
to get this folder content */
"title": "Folder A", /* Name to display */
"thumb_url": "http://whatever/thumbnail/url.jpg", /* Url of the thumbnail to display */
/* Optional properties */
"num_entries": 10 // Number of entries in this folder */
},
{
"type": "image",
"title": "Image 1",
"file_url": "http://image-1/url.jpg",
"thumb_url": "http://image-1/thumbnail/url.jpg",
/* Optional properties */
"height": 800, // Height of the image in pixels
"width": 600 // Width of the image in pixels
},
{
"type": "video",
"title": "Video 1",
"file_url": "http://video-1/url.mp4",
"thumb_url": "http://video-1/thumbnail/url.jpg",
/* Optional properties */
"height": 640, // Height of the video in pixels
"width": 480, // Width of the video in pixels
"duration": 120 // Duration of the video in seconds
}
],
/* Does the server have more items in this list ?
If has_more is true, Stupeflix Factory will issue a new GET request with an incremented offset parameter */
"has_more": false
}