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

How to use SureVideo Android Javascript APIs?

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.
  • 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. 

    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.

Sample HTML Home Screen with SureVideo APIs:

HTML Code for Sample HTML Home Screen:

<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}
<table class=”tbview” style=”width: 100%; height: 100%;”>
<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 class=”tbview-right”>
<td class=”tbview-two” onclick = “window.surevideo.launch(‘/mnt/sdcard/video.mp4’);”>Testimonials</td>

To know more about SureVideoclick here

To download a trail version, click here

Was this helpful?
Updated on June 2021