Working with effect profiles from Ruby SDK
Ruby SDK offers you a way to handle effect profiles from the backend of your system.
Create and manage your effect profiles and their processes through simple API calls. All that from the comfort of your Ruby scripts.
It is simple, fast and bellow you can see exactly how to do it.
Ruby SDK Effect Profiles Methods
- create Create a new effect profile.
ziggeo.effectProfiles().create(arguments = nil)
- key Effect profile key.
- title Effect profile title.
- default_effect Boolean. If TRUE, sets an effect profile as default. If FALSE, removes the default status for the given effect
This method returns JSON - index Get list of effect profiles.
ziggeo.effectProfiles().index(arguments = nil)
- limit Limit the number of returned effect profiles. Can be set up to 100.
- skip Skip the first [n] entries.
- reverse Reverse the order in which effect profiles are returned.
This method returns JSON - get Get a single effect profile
ziggeo.effectProfiles().get(token_or_key)
This method returns JSON - delete Delete the effect profile
ziggeo.effectProfiles().delete(token_or_key)
- update Updates an effect profile.
ziggeo.effectProfiles().update(token_or_key, arguments = nil)
- default_effect Boolean. If TRUE, sets an effect profile as default. If FALSE, removes the default status for the given effect
This method returns JSON
Ruby SDK Effect Profile Processes Methods
- index Return all processes associated with a effect profile
ziggeo.effectProfileProcess().index(effect_token_or_key, arguments = nil)
- states Filter streams by state
This method returns JSON - get Get a single process
ziggeo.effectProfileProcess().get(effect_token_or_key, token_or_key)
This method returns JSON - delete Delete the process
ziggeo.effectProfileProcess().delete(effect_token_or_key, token_or_key)
- create_filter_process Create a new filter effect process
ziggeo.effectProfileProcess().create_filter_process(effect_token_or_key, arguments = nil)
- effect Effect to be applied in the process
This method returns JSON - create_watermark_process Attaches an image to a new stream
ziggeo.effectProfileProcess().create_watermark_process(effect_token_or_key, arguments = nil, file = nil)
- file Image file to be attached
- vertical_position Specify the vertical position of your watermark (a value between 0.0 and 1.0)
- horizontal_position Specify the horizontal position of your watermark (a value between 0.0 and 1.0)
- video_scale Specify the image scale of your watermark (a value between 0.0 and 1.0)
This method returns JSONExample:=begin This script shows you how to attach effect process (like watermark) to the existing effect profile Please note that effect profile has to exist for this to work. It can be anything, we are using key to make it easier Parameters you need to pass: 1. APP_TOKEN 2. PRIVATE_KEY Example call: ruby effectprofileprocess_create_watermark_process.rb APP_TOKEN PRIVATE_KEY ruby effectprofileprocess_create_watermark_process.rb APP_TOKEN PRIVATE_KEY ENCRIPTION_KEY =end require_relative "../lib/Ziggeo" ziggeo = Ziggeo.new(*ARGV) =begin We first create the effect profile, unless we were to use some existing profile, in which case we would use its key or token instead and skip this step Will not be setting up a key at this time, rather let system make a token for us. =end opts_profile = { "title" => "Ruby SDK Made Effect Profile" } profile = ziggeo.effectProfiles().create( opts_profile ) puts profile =begin Would be object such as: { "volatile"=>false, "token"=>"3765534c0024b619d7d9a9966e2e08f2", "key"=>nil, "title"=>"Ruby SDK Made Effect Profile", "default_effect"=>false, "type"=>"ApiEffectProfile", "created"=>1587044236, "owned"=>false } =end opts_watermark = { "video_scale" => '0.25', "horizontal_position" => '0.95', "vertical_position" => '0.95'} watermark_path = "../sample/logo-white.png" watermark = ziggeo.effectProfileProcess().create_watermark_process(profile['token'], opts_profile, watermark_path) puts watermark
- edit_watermark_process Edits an existing watermark process.
ziggeo.effectProfileProcess().edit_watermark_process(effect_token_or_key, token_or_key, arguments = nil, file = nil)
- file Image file to be attached
- vertical_position Specify the vertical position of your watermark (a value between 0.0 and 1.0)
- horizontal_position Specify the horizontal position of your watermark (a value between 0.0 and 1.0)
- video_scale Specify the image scale of your watermark (a value between 0.0 and 1.0)
This method returns JSON