1. Home
  2. SureVideo
  3. SureVideo Android
  4. How to use SureVideo Android Javascript APIs?

How to use SureVideo Android Javascript APIs?

KB ID: 42G2009471
Views: 475
Updated: June 2021

SureVideo SureVideo for Android now comes with a set of built-in Javascript APIs, which can be used in an HTML file and specify the file as Custom Layout Home Screen.

The APIs are written as window.surevideo.<API_Name>

Following is a comprehensive list of SureVideo APIs:

  • launch(‘file_path’): Launches a media file.
window.surevideo.launch(‘/mnt/sdcard/samplevideo.mp4’);
  • loopMedia(): Loops the allowed media file from the defined file path, number of times the file has to be looped, and choose to have a cross symbol to the close the screen. 

    Note:
    For every internal or sd card path related function, SureVideo will require Storage permission.
 loopMedia(file path,loopCount,showCloseSign)
  • launchApp(‘packagename‘ , freshlaunch): Launches an application.
window.surevideo.launchApp(‘com.android.contacts’, true);
  • closeSureVideo(): Closes SureVideo.
window.surevideo.closeSureVideo()

Sample HTML Home Screen with SureVideo APIs:

HTML Code for Sample HTML Home Screen:

<html>
<style type=”text/css”>
.tbview {border-collapse:collapse;border-spacing:0;}
.tbview td{font-family:Arial, sans-serif;font-size:14px;padding:10px 8px;border-style:solid;border-width:1px;}
.tbview th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;}
.tbview .tbview-left{font-size:x-large;background-color:#2980b9;}
.tbview .tbview-one{background-color:#F660AB}
.tbview .tbview-two{font-size:large;background-color:#50EBEC}
</style>
<body>
<table class=”tbview” style=”width: 100%; height: 100%;”>
<tr>
<th rowspan=”2″ class=”tbview-left” onclick = “window.surevideo.launch(‘/mnt/sdcard/movie.mp4’);”>Demo Video</th>
<th class=”tbview-one” onclick = “window.surevideo.launch(‘/mnt/sdcard/a.mp4’);”>Products</th>
<td class=”tbview-five” onclick = “window.surevideo.loopMedia(‘/mnt/sdcard/a.mp4’,4,false);”>Click to loop videos</td>
</tr>
<tr class=”tbview-right”>
<td class=”tbview-two” onclick = “window.surevideo.launch(‘/mnt/sdcard/video.mp4’);”>Testimonials</td>
</tr>
<tr>
</tr>
</table>
</body>
</html>

To know more about SureVideoclick here

To download a trail version, click here

Related Articles