1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
function rtcInit() { uexESurfingRtc.onGlobalStatus = upgateGlobalStatus; uexESurfingRtc.cbLogStatus = upgateLogStatus; uexESurfingRtc.cbCallStatus = updateCallStatus;
appId = "70392"; appKey = uexESurfingRtc.setAppKeyAndAppId(appKey, appId); }
function upgateLogStatus(opCode, dataType, data) { if ("OK" == data.substring(0, 2)) { var status = data.split("OK:")[1]; var showStr = ""; if ("LOGIN" == status) { showStr = "登陆成功,点击退出"; $("#login").attr("name", "logout"); } else if ("LOGOUT" == status) { showStr = "登陆"; $("#login").attr("name", "login"); } $("#login").text(showStr); } else { alert(data); } }
function updateCallStatus(opCode, dataType, data) { alert(data); if ("OK" == data.substring(0, 2)) { var status = data.split("OK:")[1]; var showStr = ""; if ("NORMAL" == status) { showStr = "call"; } else if ("INCOMING" == status) { showStr = "accept"; } $("#call").attr("name", showStr); $("#call").text(showStr); } else { alert(data); } }
function upgateGlobalStatus(opCode, dataType, data) { $("#content").append(data); }
function login() { jsonViewConfig = { localView: { x: "10", y: "800", w: "432", h: "528", }, remoteView: { x: "440", y: "800", w: "432", h: "528", }, }; userName = "1234"; jsonDtr = JSON.stringify(jsonViewConfig);
uexESurfingRtc.login(jsonDtr, userName); }
function logout() { uexESurfingRtc.logout(); }
function call() { uexESurfingRtc.call("3", "4321"); }
function accept() { uexESurfingRtc.acceptCall("3"); }
appcan.button("#login", "ani-act", function () { var btnName = $("#login").attr("name"); if (btnName == "login") { $("#login").text("登陆中,请稍候..."); login(); } else if ((btnName = "logout")) { $("#login").text("退出中,请稍候..."); logout(); } });
appcan.button("#call", "ani-act", function () { var btnName = $("#call").attr("name"); if (btnName == "call") { $("#call").text("呼叫中,请稍候..."); call(); } else if ((btnName = "accept")) { $("#call").text("接听中,请稍候..."); accept(); } });
|