AnyClip Players‎ > ‎

Embedded Player

 

 

The player is designed to play a single clip and can be embedded in any Blog, website, social pages, etc'.
The player is located at: http://api.anyclip.com/player.swf
A sample page showing the player and its functionality can be seen at: http://api.anyclip.com/player.html

Embedding the player

In order to play clips in your website, add the following HTML to your web page:

       

<div style="width: 640px; height: 360px;">

  <object height="100%" width="100%" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"

      class="player" id="VideoPlayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

      style="z-index: 10;">

    <param value="http://player.anyclip.com/Player.swf" name="movie" />

    <param value="high" name="quality" />

    <param value="true" name="allowfullscreen" />

    <param value="#000000" name="bgcolor" />

    <param value="always" name="allowScriptAccess" />

    <param value="code=UNfi27tbJh27J&autoPlay=false" name="flashVars" />

    <param value="transparent" name="wmode" />

    <embed height="100%" align="middle" width="100%" flashvars="code=UNfi27tbJh27J&autoPlay=false"

        wmode="transparent" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash"

        allowfullscreen="true" allowscriptaccess="always" quality="high" loop="false"

        play="true" name="VideoPlayer" bgcolor="#000000" src="http://player.anyclip.com/Player.swf" />

  </object>

</div>



In the HTML snippet you can change the following parameter according to your requirements:
  • Code - The code of the clip to be played
  • Width, height – specifies the sizes of the player, can be either:
    • 160 X 90
    • 320 X 180
    • 640 X 360
  • AutoPlay - accept either "true" or "false" values

In order to play a clip using the player you should change the Code in both “param name” and “embed src” in the above HTML snippet:

JavaScript API

A JavaScript API is supported in the player.
The API includes the following methods:
  • play()
  • pause()
  • stop()
  • setClip({clip code}) - load another clip into the player, accept a valid clip code as parameter
  • setVolume({level}) - set the volume level, accept values between 0 and 1
  • getVolume() - returns the current volume of the player
  • setPosition({time in milisecond}) - skip to another position in the video, the new position needs to be defined in miliseconds reative to the begiining of the clip
  • getDuration() - returns the duration of the clip in miliseconds
  • getState() - returns the current state of the player, the state can be one of the following:
    • "loading"
    • "playing"
    • "paused"
    • "stopped"
The API includes the following events:
  • clipPlayerSourceChanged - fires when clip changed.


In order to use the JS API, the following code should be added to the head of the page:

 

<head>

<script type="text/javascript">

    var jsReady = false;

    function isPageReady(){

        return jsReady;

    }

    function init(){

        jsReady = true;

    }

</script>

</head>

 <body onload="init()">

 Example of JavaScript functions:
   function play(){
    getSWF("VideoPlayer").playClip();
   }
   
   function stop(){
    getSWF("VideoPlayer").stopClip();
   }
   
   function setClip(){
    stop();
       var code = document.getElementById("clipCode").value;
    getSWF("VideoPlayer").setClip(code);
   }
   
   function pause(){
    getSWF("VideoPlayer").pauseClip();
   }
   
   function setVolume(){
    var volume = document.getElementById("clipVolume").value;
    getSWF("VideoPlayer").setClipVolume(volume);
   }
   
   function getVolume(){
    var volume = getSWF("VideoPlayer").getClipVolume();
    document.getElementById("clipVolumeGet").value = volume;
   }
   
   function getPosition(){
    //getClipPosition setClipPosition getClipDuration
    var position = getSWF("VideoPlayer").getClipPosition();
    document.getElementById("clipPositionGet").value = position;
   }
   
   function setPosition(){
    var position = document.getElementById("clipPositionSet").value
    getSWF("VideoPlayer").setClipPosition(position);
  }
   
   function getDuration(){
    var duration = getSWF("VideoPlayer").getClipDuration();
    document.getElementById("clipDuration").value = duration;
   }
   
   function getState(){
    var state = getSWF("VideoPlayer").getState();
    document.getElementById("clipState").value = state;
   }

    function getClipCode(){
        var code = getSWF("VideoPlayer").getClipCode();
        document.getElementById("currentClipCode").value = code;
    }


    function clipPlayerSourceChanged(){

    }

   function getSWF(movieName)
   {
       if (navigator.appName.indexOf("Microsoft") != -1)
       {
           return window[movieName];
       }
       else
       {
           return document[movieName];
       }
   }

 

Comments