Working with videos from Node SDK
Node SDK offers you a way to handle videos from the backend of your system.
If you ever wanted to reach out through API from your Node based codes and do something with video, now you can. Check out bellow what calls you can make and how to get you started.
You will see each method available and then example code that you can check to see a working example of the same.
Node SDK Videos Methods
- index Query an array of videos (will return at most 50 videos by default). Newest videos come first.
ZiggeoSdk.Videos.index(arguments, [callbacks])
- limit Limit the number of returned videos. Can be set up to 100.
- skip Skip the first [n] entries.
- reverse Reverse the order in which videos are returned.
- states Filter videos by state
- tags Filter the search result to certain tags, encoded as a comma-separated string
This method returns JSON[ { "volatile":false, "token":"a7edab8c635ec37047d8ae75411528e3", "key":null, "state":5, "max_duration":null, "duration":1, "tags":null, "submission_date":1390257799, "resubmission_date":1390257799, "stream_submission_date":1390257799, "delete_old_streams":true, "type":"ApiVideo", "created":1390257798, "owned":false, "state_string":"READY", "streams":[ { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }], "original_stream": { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }, "default_stream": { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }}]
- count Get the video count for the application.
ZiggeoSdk.Videos.count(arguments, [callbacks])
- states Filter videos by state
- tags Filter the search result to certain tags, encoded as a comma-separated string
This method returns JSON - get Get a single video by token or key.
ZiggeoSdk.Videos.get(token_or_key, [callbacks])
This method returns JSON{ "volatile":false, "token":"a7edab8c635ec37047d8ae75411528e3", "key":null, "state":5, "max_duration":null, "duration":1, "tags":null, "submission_date":1390257799, "resubmission_date":1390257799, "stream_submission_date":1390257799, "delete_old_streams":true, "type":"ApiVideo", "created":1390257798, "owned":false, "state_string":"READY", "streams":[ { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }], "original_stream": { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }, "default_stream": { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }}
- get_bulk Get multiple videos by tokens or keys.
ZiggeoSdk.Videos.get_bulk(arguments, [callbacks])
- tokens_or_keys Comma-separated list with the desired videos tokens or keys (Limit: 100 tokens or keys).
This method returns JSON - stats_bulk Get stats for multiple videos by tokens or keys.
ZiggeoSdk.Videos.stats_bulk(arguments, [callbacks])
- tokens_or_keys Comma-separated list with the desired videos tokens or keys (Limit: 100 tokens or keys).
- summarize Boolean. Set it to TRUE to get the stats summarized. Set it to FALSE to get the stats for each video in a separate array. Default: TRUE.
This method returns JSON - download_video Download the video data file
ZiggeoSdk.Videos.download_video(token_or_key, [callbacks])
This method returns DATA - download_image Download the image data file
ZiggeoSdk.Videos.download_image(token_or_key, [callbacks])
This method returns DATA - get_stats Get the video's stats
ZiggeoSdk.Videos.get_stats(token_or_key, [callbacks])
This method returns JSON - push_to_service Push a video to a provided push service.
ZiggeoSdk.Videos.push_to_service(token_or_key, arguments, [callbacks])
- pushservicetoken Push Services's token (from the Push Services configured for the app)
This method returns JSON - apply_effect Apply an effect profile to a video.
ZiggeoSdk.Videos.apply_effect(token_or_key, arguments, [callbacks])
- effectprofiletoken Effect Profile token (from the Effect Profiles configured for the app)
This method returns JSON - apply_meta Apply a meta profile to a video.
ZiggeoSdk.Videos.apply_meta(token_or_key, arguments, [callbacks])
- metaprofiletoken Meta Profile token (from the Meta Profiles configured for the app)
This method returns JSON - update Update single video by token or key.
ZiggeoSdk.Videos.update(token_or_key, arguments, [callbacks])
- min_duration Minimal duration of video
- max_duration Maximal duration of video
- tags Video Tags
- key Unique (optional) name of video
- volatile Automatically removed this video if it remains empty
- expiration_days After how many days will this video be deleted
- expire_on On which date will this video be deleted. String in ISO 8601 format: YYYY-MM-DD
This method returns JSON{ "volatile":false, "token":"a7edab8c635ec37047d8ae75411528e3", "key":"brandnewname", "state":5, "max_duration":"10", "duration":1, "tags":null, "submission_date":1390257799, "resubmission_date":1390257799, "stream_submission_date":1390257799, "delete_old_streams":true, "type":"ApiVideo", "created":1390257798, "owned":false, "state_string":"READY", "streams":[ { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }], "original_stream": { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }, "default_stream": { "volatile":false, "token":"d751140b4e1cf0a243f32092f6110296", "key":null, "creation_type":5, "state":5, "streamable":2, "video_type":"mp4", "video_sub_type":"other", "image_size":0, "video_size":36078, "video_width":640, "video_height":360, "duration":1, "has_video":true, "has_image":true, "submission_date":1390257799, "type":"ApiVideoStream", "created":1390257799, "owned":true, "creation_type_string":"SERVER_UPLOAD", "streamable_string":"DEGRADED", "state_string":"READY" }}
- update_bulk Update multiple videos by token or key.
ZiggeoSdk.Videos.update_bulk(arguments, [callbacks])
- tokens_or_keys Comma-separated list with the desired videos tokens or keys (Limit: 100 tokens or keys).
- min_duration Minimal duration of video
- max_duration Maximal duration of video
- tags Video Tags
- volatile Automatically removed this video if it remains empty
- expiration_days After how many days will this video be deleted
- expire_on On which date will this video be deleted. String in ISO 8601 format: YYYY-MM-DD
This method returns JSON - delete Delete a single video by token or key.
ZiggeoSdk.Videos.destroy(token_or_key, [callbacks])
- delete_file Delete video file only (keeps the data) by providing video token or key.
ZiggeoSdk.Videos.delete_file(token_or_key, [callbacks])
- create Create a new video.
ZiggeoSdk.Videos.create(arguments, [callbacks])
- file Video file to be uploaded
- min_duration Minimal duration of video
- max_duration Maximal duration of video
- tags Video Tags
- key Unique (optional) name of video
- volatile Automatically removed this video if it remains empty
- effect_profile Set the effect profile that you want to have applied to your video.
- meta_profile Set the meta profile that you want to have applied to your video once created.
- video_profile Set the video profile that you want to have applied to your video as you create it.
This method returns JSON{ "volatile":true, "token":"a7edab8c635ec37047d8ae75411528e3", "key":null, "state":3, "max_duration":null, "duration":null, "tags":null, "submission_date":null, "resubmission_date":null, "stream_submission_date":null, "delete_old_streams":true, "type":"ApiVideo", "created":1390257798, "owned":false, "state_string":"EMPTY", "streams":[], "original_stream":null, "default_stream":null }
- analytics Get analytics for a specific videos with the given params
ZiggeoSdk.Videos.analytics(token_or_key, arguments, [callbacks])
- from A UNIX timestamp in microseconds used as the start date of the query
- to A UNIX timestamp in microseconds used as the end date of the query
- date A UNIX timestamp in microseconds to retrieve data from a single date. If set, it overwrites the from and to params.
- query The query you want to run. It can be one of the following: device_views_by_os, device_views_by_date, total_plays_by_country, full_plays_by_country, total_plays_by_hour, full_plays_by_hour, total_plays_by_browser, full_plays_by_browser
This method returns JSON