OnProgressChange Event



 
Fires when the progress of an action changes.


Syntax

    function id_name::OnProgressChange(progress, progressmax)
Parameters
    progress DWORD value that contains the current progress.
    progressmax DWORD value that contains the maximum progress.
Remarks
    Depending on which action is currently active the parameters contain the current progress and maximum progress of capturing or compression.
Examples
    The following example shows the functionality of the SiteCam ActiveX Control.

    <html>
    <body>
    <table border="0" bgcolor="#ebebeb" width="600" cellspacing="5"
    cellpadding="5" style="font-family:verdana;font-size:8pt;"
    align="center">
    <tr><td bgcolor="f8f8f8">
    The Webcam [Plug-In] provides functions to use a webcam. Click "preview"
    to start the streaming, "capture" to start recording the
    stream, "compress" to save a recorded stream, "play" to play
    the last recorded stream, "snapshot" to take and save a single
    picture or "stop" to stop all actions.
    </td></tr>
    <tr><td style="font-family:verdana;font-size:8pt;">
    <pre>
    <object classid='clsid:54632F4A-055A-44C1-B1E6-EDB62AC2AC3E'
    id='webcam' border='0' width='320' height='240' style='margin:5px;'>
    </object>
    <br>
    <span id='cst' style='position:relative;top:5px;'>Status: -</span>
    <span id='id_camprogress'>Progress: -</span>
    <br>
    <span id='id_camlastimage'>Last image: -</span>
    <span id='id_camlastvideo'>Last video: -</span>
    <SCRIPT TYPE="text/javascript">
    window.external.InitScriptInterface();
    function webcam::OnStatusChange()
    {
       switch (webcam.Status)
       {
          case 0 : cst.innerHTML = "Status: stopped";break;
          case 1 : cst.innerHTML = "Status: initializing";break;
          case 2 : cst.innerHTML = "Status: preview started";break;
          case 3 : cst.innerHTML = "Status: capture started";break;
          case 4 : cst.innerHTML = "Status: playback started";break;
          case 5 : cst.innerHTML = "Status: compressing";break;
       }
       if (webcam.LastVideoFile == "") camlvf = "-";
       else camlvf = webcam.LastVideoFile;
       id_camlastvideo.innerHTML = "Last video: " + camlvf;
    }
    function webcam::OnProgressChange(pr, prmax)
    {
       id_camprogress.innerHTML = pr + " / " + prmax;
    }
    function webcam::OnSnapshot(filename)
    {
       camlif = filename;
       id_camlastimage.innerHTML = "Last image: " + camlif;
    }
    function webcam::OnError(errorcode)
    {
       switch (errorcode)
       {
          case 1 : alert("Error : device lost");break;
          case 2 : alert("Error : init failed");break;
       }
    }
    function delfiles()
    {
       webcam.DeleteCreatedFiles();
       cst.innerHTML = "Status: files deleted";
    }
    function camaction(camactionid)
    {
       if (webcam.IsSiteCamEnabled)
       {
          switch (camactionid)
          {
             case 1 : webcam.Preview();break;
             case 2 : webcam.Capture();break;
             case 3 : webcam.Snapshot();break;
             case 4 : webcam.Compress();break;
             case 5 : webcam.Stop();break;
             case 6 : webcam.PlayFile();break;
             case 7 : delfiles();break;
          }
       } else alert("The Webcam plugin has not been configured");
    }
    if (webcam.IsSiteCamEnabled)
    {
       window.setTimeout("camaction(1)", 1500);
    }
    else
    {
       cst.innerHTML = "Status: The Webcam plugin has not been configured";
    }
    </SCRIPT>
    </pre>
    </td></tr>
    </table>
    <br><br>
    <div align="center">
    <a href="javascript:camaction(1)">Preview</a>&nbsp;
    <a href="javascript:camaction(2)">Capture</a>&nbsp;
    <a href="javascript:camaction(4)">Compress</a>&nbsp;
    <a href="javascript:camaction(6)">Play</a>&nbsp;
    <a href="javascript:camaction(3)">Snapshot</a>&nbsp;
    <a href="javascript:camaction(5)">Stop</a>&nbsp;
    <a href="javascript:camaction(7)">Delete created files</a>
    </div>
    </body>
    </html>
    

Applies to
    SiteKiosk v5.0 (and later versions).

Back to top