rtAPI is a simple set of Javascript APIs that offers access to manipulate and track a gallery on client side.
Use the following set of rtAPI to preform :
Register events :
Scenario 1 : when Cincopa's main lib - libasync.js already loaded
cincopa.registerEvent("cp_evt_mediaplay", "runtime.*"); function cp_evt_mediaplay(name, data, gallery) { if (name == "runtime.on-args") // make sure this event is runtime.on-load-html gallery.args.allow_search = "yes"; }
var cincopa = cincopa || {}; cincopa.registeredFunctions = cincopa.registeredFunctions || []; cincopa.registeredFunctions.push({ func: function (name, data, gallery) { gallery.args.allow_search = "yes"; }, filter: "runtime.on-args" });
When working with a gallery or a player you'll usually use the Wizard UI interface to customize the look and feel.
However sometimes you'll need to make a change during runtime that can effect only the specific instance of the player, for that you can use the runtime Javacsript API.
Change the runtime args by first register to the runtime.on-args event. Once this event is fire change the specific arg.
Check the full reference of documented args.
Some usecases can be
var cincopa = cincopa || {}; cincopa.registeredFunctions = cincopa.registeredFunctions || []; cincopa.registeredFunctions.push({ func: function (name, data, gallery) { gallery.args.autostart = "true"; gallery.args.download_button = true; }, filter: "runtime.on-args" });
Enable debug mode from the console to see every event and debug data during libasync lifetime.
Note that this mode is saved to a domain cookie so no need to do it every time.
When debug mode is set to true every event will appear in the console.
cincopa.set_debug(true)
See the Pen Cincopa PlayerAPI by oren (@cincopa) on CodePen.
See the Pen How to add lead generation form to a video by oren (@cincopa) on CodePen.
See the Pen How to add company logo to video control panel by oren (@cincopa) on CodePen.
See the Pen How to get video duration by oren (@cincopa) on CodePen.
See the Pen How to add watermark to video by oren (@cincopa) on CodePen.
See the Pen How to get progress while video is playing and video heatmap by oren (@cincopa) on CodePen.
See the Pen How to add a pre roll and post roll to a video by oren (@cincopa) on CodePen.
See the Pen How to add sharing option to a video by oren (@cincopa) on CodePen.
gallery.args.watermark_on_off = true; // true/false gallery.args.watermark_position = "top_left"; // top_left, top_right, bottom_left, bottom_right gallery.args.watermark = "https://wwwcdn.cincopa.com/_cms/design15/images/Smiling_Emoji_with_Smiling_Eyes.png"; gallery.args.watermark_link = "https://www.cincopa.com/video-hosting"; gallery.args.new_page = true;
gallery.args.share = true; gallery.args.share_url = "https://www.cincopa.com/video-hosting";
gallery.args.embed_code = "<iframe .... add your customized embed code here />"; gallery.args.embed_url = "https://www.cincopa.com/video-hosting";
gallery.args.prerollAssetID="AQJDeYiYFKhg"; // Pre roll video asset ID gallery.args.postrollAssetID ="AQJDeYiYFKhg"; // Post roll video asset ID gallery.args.prepostroll="true";// turn on ‘Pre/Post Roll Video’ option gallery.args.rollFrequency="on_each";// Role Frequency on_each, on_first, on_first_last
gallery.args.download_button = true; // true/false
gallery.args.download_button = true; // true/false
gallery.args.autostart = "true"; // true/false
gallery.args.theme_color_main ="DD5AD9" ;// hex value
gallery.args.allow_search = "yes"; // yes/no gallery.args.force_ratio = 1.78; // force the player ratio, this is useful to make sure player will always be same size even if video is portrait
Hooks can be used to manipulate gallery at any given stage. List of hooks :
_cp_go_hooks["before-building-upper-panel"] = function(go) { go.args.allow_search = "yes"; return "[this is a link]"; };