Search in documentation:     Advanced search
Browse by category:

Javascript events controled by Standard Player.

Views: 585
Votes: 0
Posted: 18 Aug, 2009
Updated: 21 Aug, 2009

Sample of how to use kewego player events

Player did not start playing video yet. Click on player play button to start.


Kewego standard player generates automatically 3 javascript calls :

- When player plays video : function KewegoEventPlay()
- When video is paused : function KewegoEventPause()
- When video is stopped (at the end of the video) : function KewegoEventStop()

In the sample shown above, text is displayed in a <div> tag called "textDiv", and is controlled by the javascript functions (see code below). You can then build your own javascript code, but keeping of course javascript functions names.


<style type="text/css">
.init { background-color:#33CCFF; padding:10px;}
.play { background-color:#00FF00; padding:10px;}
.pause {background-color:#FFCC00;padding:10px;}
.stop {    background-color:#FF0000;padding:10px;}
</style>   

<script language="JavaScript" type="text/javascript">

function KewegoEventPlay(){
  {
  if (document.getElementById)
    {
    document.getElementById("textDiv").innerHTML = '<span class="play">Player is playing video.</span>';
    }
  else if (document.all)
    {
    document.all["textDiv"].innerHTML = '<span class="play">Player is playing video.</span>';
    }
  }
}

function KewegoEventPause(){
 {
  if (document.getElementById)
    {
    document.getElementById("textDiv").innerHTML = '<span class="pause">Player is paused</span>';
    }
  else if (document.all)
    {
    document.all["textDiv"].innerHTML = '<span class="pause">Player is paused</span>';
    }
  }
}

function KewegoEventStop(){
 {
  if (document.getElementById)
    {
    document.getElementById("textDiv").innerHTML = '<span class="stop">Video is stopped - end of video is reached</span>';
    }
  else if (document.all)
    {
    document.all["textDiv"].innerHTML = '<span class="stop">Video is stopped - end of video is reached</span>';
    }
  alert ('Video has stopped. Next Module will now be displayed in player, for instance "Watch More" module (depends on player configuration)');
  }
}
</script>
Others in this Category
document Web tv widget



RSS