Could someone help me convert this into a function that I can use/call, my knowledge of js is very limited.
Thanks!
Code:
<script language="javascript" for="PlaybackCtrl" event="ErrorReceived(errorCode, param)">
// program additional -------------------------------------------------
var PB_ERR_CONNECT_FAIL = 0xf0000000; //
var PB_ERR_DISCONNECTED = 0xf0000001; //
var PB_ERR_SOCKET_ERROR = 0xf0000002; //
var PB_ERR_NO_VIDEO = 0xf0000003; //
var PB_ERR_OPEN_FAIL = 0xf0000020; //
var PB_ERR_SOCKET_SEND = 0xff000001; // send
var PB_ERR_SOCKET_RECV = 0xff000002; // receive
var PB_ERR_BODY_SIZE = 0xff000003; // body
// playback additional ---------------------------------------------------
var PB_ERR_HDD_NOT_FOUNT = 0x00040000;
var PB_ERR_HDD_NOT_ENABLED = 0x00040001;
var PB_ERR_OUT_OF_RANGE = 0x00040002;
var PB_ERR_IN_SEARCH = 0x00040004;
var PB_ERR_OPEN_FILE = 0xfff00001;
var bDisconnect = true;
var error = "";
alert("ErrorReceived Code "+errorCode);
switch ( errorCode ) {
case PB_ERR_CONNECT_FAIL : //
error = "Connection failed";
break;
case PB_ERR_DISCONNECTED : //
error = "Disconnected";
break;
case PB_ERR_SOCKET_ERROR : //
error = "Socked error";
break;
case PB_ERR_NO_VIDEO : //
bDisconnect = false;
error = "No Video";
break;
case PB_ERR_HDD_NOT_FOUNT :
error = "Hdd not founded";
break;
case PB_ERR_HDD_NOT_ENABLED :
error = "Hdd not enabled";
break;
case PB_ERR_OUT_OF_RANGE :
bDisconnect = false;
error = "Out of range";
break;
default:break;
}
alert(error);
if ( error.length ) alert(error);
if ( bDisconnect && m_bConnect ) {
m_bConnect = false;
PlaybackCtrl.Disconnect();
}
</script>
Thanks!