Introduction
In order to show a video player inside a web page you need to call our js library (DigitalBees SDK) from
your web page (client), so this is client-server request to the digitalbees api system.
When invoked, the SDK application read at bootstrap the first element of "_sqrapiq" array that must be
set to "init", as showed below:
_srapiq.push(['init', apiKEY, callback]);
This method initializes the sdk reading the user configuration on the dibitalbees platform (server- side),
this means that the apiKEY value must correspond to an existing USER on digitalbees.
The 'init' method replaces the array "_sqrapiq" with an object "ExternalInterface" that exposes the public
methods of the SDK that you can invoke using the "push" method example:
_srapiq.push ( [ 'setOption' , 'autoStart' , true] ) ;
Alternatively, you can directly retrieve the object ExternalInterface to invoke methods in the traditional
way.
Example:
_srapiq.getApi ().searchVideo ('O Vient', 1, function(data){console.log(data)});
Getting Start
Below you can find the digitalbees client-side code example to include in your webpage:

<script type="text/javascript">
var _srapiq = _srapiq || [];
_srapiq.push(['init', apiKEY, < your_callback_method >]) ;
//Required
_srapiq.push(['setOption', 'width', 600]);
// Optional _srapiq.push(['setOption', 'height', 400]);
// Optional _srapiq.push(['setOption', 'autoStart', true]);
// Optional _srapiq.push(['setOption', 'advUrl', advURL]);
// Optional _srapiq.push(['embedVideo', 'videoContainer', '1']);
// Required
(function () {
var sr = document.createElement('script');
sr.type = 'text/javascript';
sr.async = true;
sr.src = '//sdk.digitalbees.it/jssdk-latest.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(sr, s);
})();
</script>
Public methods
init(apiKey, callback)
Initialize SDK
Method |
Description |
ApiKey |
Your apikey |
yourCallback |
you can specify your callback function to have a notification when the the player template is ready |
getApi().setOption(optKey, optValue)
use this method to set the player options as height, width, autostart, advUrl
Method |
Description |
OptKey |
In this value you can set one of this param height for manage height(int) of player, width(int) for manage width of it.
AutoStart(boolean) and advUrl(string) |
optValue |
Is value for optKey |
getApi().getVideoDuration()
Return the video duration of the last video player embedded in web page
getApi().embedVideo(parentElement, videoAssetId)
enables the Video Player in web page. If your SRAPI account is enabled from Digital Bees staff to manage Video,
you must use this method to enableVideos in your web page
Method |
Description |
parentElement |
It is the id or the instance of the dom element where you want append the video player |
videoAssetId |
A valid video id |
getApi().loadVideoid(videoAssetId, yourCallback)
Use this method to change the video asset inside the last player embedded in web page
Method |
Description |
videoAssetId |
Set the width for the video player in your web page |
yourCallback |
You can specify your callback function to have a notification when the the player template is ready |
getApi().playVideo()
Use this method to set play the last player embedded in web page
getApi().stopVideo()
Use this method to set stop the last player embedded in web page
getApi().pauseVideo()
Use this method to set pause the last player embedded in web page
getApi().searchVideo(searchTxt, limit, yourCallback)
Use this method to change the video asset inside the last player embedded in web page
Method |
Description |
searchTxt |
The text string that you want search (author name, video title or metatag) |
limit |
the max number of results you want obtain as response |
yourCallback |
Because the search is asynchronus, you can specify your callback function to have a notification when the the search results are ready |
New getApi().getCurrentPlayer()
Return an object to identify the current player. This function is powerfull if you use several video players in the same web page.
eg:{id: "7", videoName: "Martina McBride -Ride", container: "videoContainer3"}
New getApi().getEmbeddedPlayers()
Return an array object with the list of all players embedded (objects) in the web page. This function is powerfull
if you use several video players in the same web page.
getApi().getVersion();
Return version of sdk.
New getApi().setCurrentPlayerByVideoId(videoAssetId)
Use this method to set or change a video player as current player, by calling it with the videoAssetId.
Method |
Description |
videoAssetId |
the videoAssetId is an integer |
New getApi().setCurrentPlayerByContainerId(div_ContainerId)
use this method to set or change a video player as current player, by calling it with the id of the div container.
Method |
Description |
div_ContainerId |
id of the div container |