Working with videos from Java SDK
Java SDK offers you a way to handle videos from the backend of your system.
What if you wanted to work with the videos through the API + from your Java server codes? Well with Ziggeo that is very simple and here you will see more about how exactly you can do that.
You will see each method available and then example code that you can check to see a working example of the same.
Java SDK Videos Methods
- index Query an array of videos (will return at most 50 videos by default). Newest videos come first.
ziggeo.videos().index(JSONObject arguments)
- 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.
ziggeo.videos().count(JSONObject arguments)
- 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.
ziggeo.videos().get(String token_or_key)
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.
ziggeo.videos().get_bulk(JSONObject arguments)
- 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.
ziggeo.videos().stats_bulk(JSONObject arguments)
- 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
ziggeo.videos().download_video(String token_or_key)
This method returns DATA - download_image Download the image data file
ziggeo.videos().download_image(String token_or_key)
This method returns DATA - get_stats Get the video's stats
ziggeo.videos().get_stats(String token_or_key)
This method returns JSON - push_to_service Push a video to a provided push service.
ziggeo.videos().push_to_service(String token_or_key, JSONObject arguments)
- 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.
ziggeo.videos().apply_effect(String token_or_key, JSONObject arguments)
- 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.
ziggeo.videos().apply_meta(String token_or_key, JSONObject arguments)
- metaprofiletoken Meta Profile token (from the Meta Profiles configured for the app)
This method returns JSON - update Update single video by token or key.
ziggeo.videos().update(String token_or_key, JSONObject arguments)
- 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.
ziggeo.videos().update_bulk(JSONObject arguments)
- 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.
ziggeo.videos().delete(String token_or_key)
- delete_file Delete video file only (keeps the data) by providing video token or key.
ziggeo.videos().delete_file(String token_or_key)
- create Create a new video.
ziggeo.videos().create(JSONObject arguments, String file)
- 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
ziggeo.videos().analytics(String token_or_key, JSONObject arguments)
- 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