Spotlightr API opens up below defined set of methods and events you can use to:
Here are just a few real-world examples that showcase what the Spotlightr API enables you to do. Keep in mind that the combinations are infinate and only limited by your imagination.
A simple call may look like:
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'play')"> Play Video </button>
Here we specify a on click action which uses the spotlightrAPI function. This is the global access function for all the methods and events.
In the function we are passing two paramaters, the video id (MTM1MjA5MA==) of the video to reach, and the method ('play') you want to initiate.
So the expected result is that once the button is clicked the video with the id MTM1MjA5MA== will play.
Methods work by passing video id, desired method you want to initiate and an optional paramater.
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'play')"> Play Video </button>
Triggers the video player play event and play the video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
See the Pen CodePen HTML by devuser (@spotlightr-demo) on CodePen.
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'pause')"> Pause Video </button>
Triggers the video player pause event and pause the video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'captions', true)"> captions </button>
Hide or show captions
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Boolean | Show or hide captions | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'volume', [.5])"> Set volume to 50% </button>
sets the volume to the video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Increasing or decreasing value of volume | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'source', ['MTM1MjA5MA==','5'])"> Set Source </button>
Triggers the video player source event, and sets the current time.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Set VideoId and Source Time | Yes |
See the Pen CodePen HTML by devuser (@devuser007) on CodePen.
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'showControls', [1])"> Toggle Controls visibility </button>
show the control of the video player.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Set control visibility | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'hideControls', [0])"> Toggle Controls visibility </button>
hide the control of the video player.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Set control visibility | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'imageOnPause', [0])"> </button>
Disable already enabled image on pause.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Set show image on pause | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'currentTime', [30])"> Set Time To 30 </button>
sets current time of the player to given value in seconds.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Set current time of video | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'getTime', ['3','6'], getTime)"> Set Listener </button> <script> function getTime(time){ console.log('[vp]getTime',time); //DO STUFF HERE } </script>
Triggers the callback at specified seconds from the begning of the video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Time of video | Yes |
callback function | function | Callback function for get time | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'getCurrentTime', null, getCurrentTime)"> Set Listener </button> <script> function getCurrentTime(time){ console.log('[vp]getCurrentTime',time); //DO STUFF HERE } </script>
Get Current Time of a video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | - | No |
callback function | function | Callback function to get current time | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'getDuration', null, getDuration)"> Set Listener </button> <script> function getDuration(duration){ console.log('[vp]getDuration',duration); //DO STUFF HERE } </script>
Gives duration of the loaded video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Duration of video | Yes |
callback function | function | Callback function for get duration | Yes |
See the Pen CodePen HTML by devuser (@devuser007) on CodePen.
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'setRemainingTime', ['25','20'], setRemainingTime)"> Set Listener </button> <script> function setRemainingTime(time){ console.log('[vp]setRemainingTime',time); //DO STUFF HERE } </script>
Triggers callback at specified times in seconds before the end of the video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Set remaining time of video | Yes |
callback function | function | Callback function for set remaining time | Yes |
<button type="button" name="button" onclick="addNewPlayerSettings()"> Add New Player Settings </button> <script> function addNewPlayerSettings(time){ const playerId = 'MTM1MjA5MA==' function addNewPlayerSettings() { const newPlayerSettings = { alwaysVisibleControls: true, colors: { bars:"#fa07d8ff", controls:"#5aff2aff", skin:"#fff", } } spotlightrAPI(playerId, 'addNewPlayerSettings', newPlayerSettings) } } </script>
Add new player settings to a video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for adding new player settings to a video | Yes |
Method Parameter | Object | New player settings | Yes |
See the Pen Untitled by devuser (@devuser007) on CodePen.
<script> function completeOptin(){ spotlightrAPI('MTM1MjA5MA==', 'completeOptin', ["test@test.com"]); } </script>
Set pre-defined email for email optin lock (must be triggered before the optin is shown).
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Value of complete optin | Yes |
<script> function setCustomViewerID(){ spotlightrAPI('MTM1MjA5MA==', 'setCustomViewerID', ["member_123"]); } </script>
Sets customViewerId for the video.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Customer viewer id | Yes |
<script> function sendVideoAnalytics(){ spotlightrAPI('MTM1MjA5MA==', 'sendVideoAnalytics'); } </script>
Triggers the video player sendVideoAnalytics event and sned the video analytics data. Like device, percentWatched, watchedSegments, bandwidth, reportedBandwidth etc...
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'showLocks', [1 OR 0])"> Show Locks </button>
Sets visibility of lock, 0 don't show lock 1 show lock.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Set value for show lock in 0 or 1 | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'showOverlays', [1 OR 0])"> Show Overlays </button>
Sets visibility of overlays, 0 don't show overlay 1 show overlay.
Field | Type | Description | Required |
---|---|---|---|
Video Id | number | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | Array | Set value for show overlays in 0 or 1 | Yes |
Events are called the same way as methods, with the addition of providing a callback function when the desired event is fired.
<script> document.addEventListener('vooPlayerReady', vooPlayerReady, false); function vooPlayerReady(event){ console.log("[vp]vooPlayerReady",event); spotlightrAPI("MTM1MjA5MA==", 'getDuration', null, getDurationCallback); spotlightrAPI("MTM1MjA5MA==", 'setRemainingTime', ['25','20'], setRemainingTime); spotlightrAPI("MTM1MjA5MA==", 'getTime', ['3','6'], getTime); spotlightrAPI("MTM1MjA5MA==", 'onPause', null, onPause); } function getDurationCallback(duration){ console.log("[vp]getDurationCallback",duration); } function setRemainingTime(time){ console.log("[vp]setRemainingTime",time); } function getTime(time){ console.log("[vp]getTime",time); } function onPause(){ console.log("[vp]onPause"); } </script>
We made our event called 'vooPlayerReady'. If you want to know and to be sure that your video is loaded and ready for manipulating you can add listener for it.
See the Pen CodePen HTML by devuser (@devuser007) on CodePen.
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'onEnded', null, onVideoEnded)"> Set Listener </button> <script> function onVideoEnded(){ console.log('[vp]onVideoEnded'); //DO STUFF HERE } </script>
Trigger this event when video is ended.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onEnded | Yes |
See the Pen CodePen HTML by devuser (@devuser007) on CodePen.
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'onPlay', null, onVideoPlay)"> Set Listener </button> <script> function onVideoPlay(){ console.log('[vp]onVideoPlay'); //DO STUFF HERE } </script>
Trigger this event when video is played.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onVideoPlay | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'onPause', null, onVideoPaused)"> Set Listener </button> <script> function onVideoPaused(){ console.log('[vp]onVideoPaused'); //DO STUFF HERE } </script>
Trigger this event when video is paused.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onVideoPaused | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'onSeeked', null, onVideoSeeked)"> Set Listener </button> <script> function onVideoSeeked(time){ console.log('[vp]onVideoSeeked', time); //DO STUFF HERE } </script>
Handling the event when video is seeked.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onVideoSeeked | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'answerSubmitted', null, onAnswerSubmitted)"> Set Listener </button> <script> function onAnswerSubmitted(answerData){ console.log('[vp]onAnswerSubmitted', answerData); //DO STUFF HERE } </script>
Handling the event when quiz answer is submited.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onVideoSeeked | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'quizFinished', null, onQuizFinished)"> Set Listener </button> <script> function onQuizFinished(results){ console.log('[vp]onQuizFinished', results); //DO STUFF HERE } </script>
Handling the event when quiz is finished.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onVideoSeeked | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'onResolutionChange', null, onResolutionChange)"> Set Listener </button> <script> function onResolutionChange(data){ console.log('[vp]onResolutionChange', data.returnValue); //DO STUFF HERE } </script>
Handling the event when resolution change.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onResolutionChange | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'onPlaybackSpeedChange', null, onPlaybackSpeedChange)"> Set Listener </button> <script> function onPlaybackSpeedChange(data){ console.log('[vp]onPlaybackSpeedChange', data.returnValue); //DO STUFF HERE } </script>
Handling the event when playback speed change.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onPlaybackSpeedChange | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'onVolumeChange', null, onVolumeChange)"> Set Listener </button> <script> function onVolumeChange(data){ console.log('[vp]onVolumeChange', data.returnValue); //DO STUFF HERE } </script>
Handling the event when volume change.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onVolumeChange | Yes |
<button type="button" name="button" onclick="spotlightrAPI('MTM1MjA5MA==', 'onFullscreenChange', null, onFullscreenChange)"> Set Listener </button> <script> function onFullscreenChange(data){ console.log('[vp]onFullscreenChange', data.returnValue); //DO STUFF HERE } </script>
Handling the event when fullscreen change.
Field | Type | Description | Required |
---|---|---|---|
Video Id | string | Id of a Video | Yes |
Api Method | string | Method for spotlightrAPI to trigger | Yes |
Method Parameter | null | null | No |
Callback function | function | Callback function for onFullscreenChange | Yes |
Spotlightr REST API allows you to communicate with the Spotlightr database and servers using the here defined set of requests.
Here are just a few real-world examples that showcase what the Spotlightr API enables you to do.
For accessing the REST API client must have an API Key. It can be generated through the application: Settings > Integrations & APIs > Spotlightr API Key > Get API key
Q: How to create new video with youtube link?
It let's you to create a video in an application.
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
URL | string | Video URL | Yes (unless file provided) |
name | string | Video name | Yes |
customS3 | number | 0 or ID of custom integration | Yes |
hls | number | 1 - to encode OR 0 - to leave as unsecured | No |
videoGroup | number | Project ID | No |
create | number | 1 - to confirm OR 0 - to debug | No |
playerSettings | object | Video ID for coping playerSettings (decoded base64) | No |
file | File | File for upload | Yes (unless URL provided) |
See the Pen CodePen HTML by devuser (@devuser007) on CodePen.
Get projects
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
Create a new projects
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
name | string | Name of the Project | Yes |
Set new video source.
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
id | number | Video source to be replaced | Yes |
URL | string | New URL for the source | Yes |
Delete video from project.
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
IDs | Array | Array of ids to be deleted e.g. [1234,5678] | Yes |
Get top videos from the list.
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
days | number | Reporting Days | (default is 30) |
total | number | Number of top videos | (default is 3) |
Get video Analytics data.
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
videoID | number | Video Id | Yes |
{ "loads": 301, "watched": 26.55, "plays": 8, "playRate": 2, "completitionRate": 0, "shares": 0 }
Get video views.
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
videoID | number | videoMetrics | Yes |
customViewerID | string | id or email of a known viewer | No |
onlyWatched | bool | views with percentWatched > 1 | (true|false) |
allViews | bool | No data pagination | (true|false) |
Get videos.
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
videoID | integer | ID of a video | No |
videoGroup | integer | ID of a project | No |
Lists whitelisted domains
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
Adds whitelisted domain
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
domain | string | desired domain (e.g. example.com) | Yes |
Create Gallery codes
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
quantity | number | Yes | |
id | number | Gallery ID | Yes |
never | number | 0 OR 1 never expires | Yes |
unlocks | number | 0 OR any number | Yes |
time | number | 0 OR any number | Yes |
expires | date | 0000-00-00 OR any YYYY-MM-DD | Yes |
Update gallery access codes (expire them)
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
id | number | Code ID | Yes |
expires | number | 1 | Yes |
Search everything in your account
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
Update individual player settings
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
id | integer | Video ID (base64 decoded value) | Yes |
settings | json object | Object containing only keys to be updated | Yes |
Upload an asset
Field | Type | Description | Required |
---|---|---|---|
vooKey | string | API Key (user's integrations api key) | Yes |
file | file (form-data) | File to be uploaded | Yes |
Allows you to customize the URL of the Watch Page or source of the embedded iframe with added functionality.
For example: https://spotlightrteam.cdn.spotlightr.com/watch/MTMxNjk4NA==?t=62 will stat the video at 01:02
Field | Type | Description |
---|---|---|
s | number (seconds) | Sets a starting point for your video. |
e | number (seconds) | Set an ending point for your video. |
omitView | boolean | Disables video analytics. |
contact | string (email / id) | Identify a known viewer. Learn more |
personalized | boolean | Personalize the viewers experience - if known viewer. Find more |
resolution | number (360,720,1080...) | Set default resolution on the video. |
aspect | number | Set the video aspect ratio. |
videoBG | string (hex color) | Change video background color. |
chapter | number | Set video to start by specified chapter index. Learn more |
t | number | Sets video to a specific time |