發版說明:api更新時,在這個文檔末尾加上releasejavascript
發版說明:
一、廢棄client.initInnerCallBack中的videoCloseCB回調,將其精確通知到對應的回調事件中(增長closeVideoSuccess回調事件),涉及到的更改以下,示例代碼已添加java
二、統一SDK報錯的提示格式,從返回的數據的error.msg拿錯誤提示信息web
error: function(data) { if(data.error) { var msg = data.error.msg || '' } console.log(msg, '錯誤信息') }
發版說明:
一、增長是否在屏幕共享的API - isShareState
二、增長是否在三方視頻中的API - isMultipleVideowindows
發版說明:
一、client.initInnerCallBack 中添加了 visitorStreamOffline 事件,當會議中有成員視頻流中止超過3s 則推送此事件api
發版說明:
一、增長client.videoPickUp中的visitorDisconnect回調,提示音視頻接通後訪客端引發的掛斷,詳見示例代碼
二、增長client.multipleVideoPickUp中的kefuCloseVideoSuccess回調,提示音視頻接通後坐席或訪客端掛斷致使的會議結束(非被邀請的三方坐席)session
window.onload = function() { var client; function initIMClient(){ var HXPlugin = window.HXPlugin = 0; var wssrc = location.protocol == "https:" ? "wss://lccp-ex.easemob.com:1040" : "ws://127.0.0.1:1040"; client = new IMClient({ baseWsUrl: wssrc, videoBarVisible: true, ssoTo: "https://kefu.wecvideotest.pingan.com.cn/mo/agent/webapp/chat", success: function(data){ console.log("成功鏈接", data); HXPlugin = 0; this.linkStatus = true; }, error: function(error){ this.linkStatus = false; this.ready = false; console.log(error); HXPlugin = 0; }, ssoReady: function(){ console.log("進入單點登陸頁面了,能夠登陸了 123+"); }, kefuReady: function(){ console.log("進入客服系統了,能夠退出了 123-"); }, kefuWSClose: function(){ console.log("kefu系統的ws斷開"); } }); client.linkStatus = false; client.ready = false; client.detactExeReadyInterval = null; /** * 接收exe內部操做的回調 */ client.initInnerCallBack({ chatCloseCB: function(data){ console.log(data); }, visitorStreamOffline: function(data){ console.log(data) } }); return client; } window.initIMClient = initIMClient; }
client.startLogin({ minimize: true, data: { url: "https://pingan-test-video.easemob.com/doLogin?name=23160006&pwd=76160006&returnTo=", }, success: function (data) { console.log(data, "登陸成功回調"); }, error: function (err) { // 登陸超時邏輯處理 if (err && err.code == -1) { // 此時登陸超時 console.log("登陸超時") } } })
client.setWindowSize({ width: "300", height: "400" });
client.minimize()
client.startup({ clientUrl: "pocprotocol://" })
client.restore()
client.quit()
client.pickUpSession({ session_id: serviceSessionId, success: function (data) { console.log("IM接起成功!", data); }, error: function (data) { console.log("IM接起失敗!", data); } });
client.chatClose()
client.videoPickUp({ session_id: serviceSessionId, success: function (data) { console.log('video接起成功', data); }, timeoutDisconnect: function(data) { console.log('訪客超時未接聽', data) }, visitorDisconnect: function(data) { console.log('音視頻接通後訪客端引發的掛斷', data) }, kefuCloseVideoSuccess: function(data) { console.log('客服掛斷音視頻', data) }, error: function(error) { console.log(error, 'videoPickUp err') } });
client.multipleVideoPickUp({ acceptSuccess: function (data) { console.log('三方坐席接受當前視頻成功', data); }, exitSuccess: function (data) { console.log('三方坐席離開當前視頻成功', data); }, kefuCloseVideoSuccess: function(data) { console.log('客服掛斷音視頻', data) }, error: function(error) { console.log('三方坐席加入音視頻出錯', error) } });
client.videoInviteAgent({ agentName: 'XXXX', inviteSuccess: function (data) { console.log('三方坐席視頻邀請發送成功', data); }, acceptSuccess: function (data) { console.log('三方坐席接受視頻成功', data) }, exitSuccess: function (data) { console.log('三方坐席退出成功', data) }, kefuCloseVideoSuccess: function(data) { console.log('客服掛斷音視頻', data) }, error: function(data) { console.log(data, '邀請坐席失敗') } })
client.callbackToVisitor({ visitorName: 'XXXX', startVideo: true, inviteSuccess: function (data) { console.log(data, '外呼-訪客邀請發送成功') }, acceptSuccess: function (data) { console.log('外呼-訪客接受邀請', data) }, visitorRefuse: function (data) { console.log('外呼-訪客拒接邀請', data) }, visitorDisconnect: function (data) { console.log('外呼-訪客掛斷', data) }, videoBusyMark: function (data) { console.log('外呼-訪客忙線', data) }, timeoutDisconnect: function (data) { console.log('外呼-訪客超時未接聽', data) }, kefuCloseVideoSuccess: function(data) { console.log('客服掛斷音視頻', data) }, error: function (error) { console.log('外呼-訪客 出錯', error) /*error: { code: "SDK_11", msg: "當前訪客正在進行會話,沒法外呼" } error: { code: "SDK_08", msg: "查詢id出錯,請檢查訪客信息是否正確" }*/ } });
回調同外呼訪客,參上app
client.videoInviteCurrentVisitor({ inviteSuccess: function (data) { console.log(data, '邀請當前-訪客邀請發送成功') }, acceptSuccess: function (data) { console.log('邀請當前-訪客接受邀請', data) }, visitorRefuse: function (data) { console.log('邀請當前-訪客拒接邀請', data) }, visitorDisconnect: function (data) { console.log('邀請當前-訪客掛斷', data) }, videoBusyMark: function (data) { console.log('邀請當前-訪客忙線', data) }, timeoutDisconnect: function (data) { console.log('邀請當前-訪客超時未接聽', data) }, kefuCloseVideoSuccess: function(data) { console.log('客服掛斷音視頻', data) }, error: function (data) { console.log('邀請當前-訪客 出錯', data) } });
回調同外呼訪客,參上webapp
client.videoInviteVisitor({ visitorName: 'XXXX', inviteSuccess: function (data) { console.log(data, '邀請三方-訪客邀請發送成功') }, acceptSuccess: function (data) { console.log('邀請三方-訪客接受邀請', data) }, visitorRefuse: function (data) { console.log('邀請三方-訪客拒接邀請', data) }, visitorDisconnect: function (data) { console.log('邀請三方-訪客掛斷', data) }, videoBusyMark: function (data) { console.log('邀請三方-訪客忙線', data) }, timeoutDisconnect: function (data) { console.log('邀請三方-訪客超時未接聽', data) }, kefuCloseVideoSuccess: function(data) { console.log('客服掛斷音視頻', data) }, error: function (data) { console.log('邀請三方-訪客 出錯', data) /*error: { code: "SDK_11", msg: "當前訪客正在進行會話,沒法外呼" } error: { code: "SDK_08", msg: "查詢id出錯,請檢查訪客信息是否正確" }*/ }});
client.videoDisconnect()
// 拍照 client.takePhoto({ success: function (data) { console.log(data, '拍照數據') }, error: function(error) { console.log(error, '拍照失敗') // 拍照不可用會返回以下消息 {"mark":"takePhoto","subMark":"error","error":{"type":"snapShotDisabled","msg":"snapShotDisabled"}} } }); // 截圖 client.snapshot({ success: function (data) { console.log(data, '截圖數據') }, error: function(error) { console.log(error, '截圖失敗') } });
client.inviteShare({ open: function (data) { console.log('共享屏幕邀請成功', data) }, close: function (data) { console.log('訪客共享屏幕關閉了', data) }, error: function (error) { console.log('邀請訪客共享屏幕失敗') } });
client.sessionCount({ success: function(data) { console.log(data.payload.sessionCount) } })
client.sessionState({ success: function(data) { console.log(data) } })
參數說明ide
client.isMultipleVideo({ success: function(data) { console.log(data.data, '當前是否正在三方視頻中') } })
參數說明函數
client.isShareState({ success: function(data) { console.log(data.data, '當前是否在共享中') } })
發版說明: 一、整合brower端和app端sdk,採用狀態機管理應用工做狀態, 二、修改部分api的調用方式
const state = { currentState: '000000', //未遷入 notLogin: '000000', //忙 visitorInvite_timeout: '001001', agentInvite_timeout: '001002', //閒 callVisitor_visitorRefuse:'002001', callVisitor_Timeout:'002002', callVisitor_busy:'002003', callVisitor_error:'002004', callVisitor_agentCloseVideo_notAnswer:'002005', callCurrentVisitor_visitorRefuse:'002006', callCurrentVisitor_timeout:'002007', callCurrentVisitor_busy:'002008', callCurrentVisitor_error:'002009', callCurrentVisitor_agentCloseVideo_notAnswer:'002010', visitorInvite_error: '002011', agentInvite_error: '002012', //外呼中 callVisitor_inviteSendSuccess:'003001', callCurrentVisitor_inviteSendSuccess:'003002', //來電中 //話後處理 inviteThirdVisitor_masterAgentCloseVideo: '005001', inviteThirdAgent_masterAgentCloseVideo: '005002', callVisitor_visitorDisconnect:'005003', callVisitor_agentCloseVideo_answered:'005004', callCurrentVisitor_visitorDisconnect:'005005', callCurrentVisitor_agentCloseVideo_answered:'005006', visitorInvite_visitorDisconnect: '005007', visitorInvite_agentCloseVideo: '005008', agentInvite_visitorDisconnect: '005009', agentInvite_agentCloseVideo: '0050010', //兩方通話中 inviteThirdVisitor_visitorRefuse:'006001', inviteThirdVisitor_Timeout:'006002', inviteThirdVisitor_busy:'006003', inviteThirdVisitor_error:'006004', inviteThirdVisitor_visitorDisconnect:'006005', //inviteThirdAgent_visitorRefuse:'006006', //inviteThirdAgent_Timeout:'006007', //inviteThirdAgent_busy:'006008', inviteThirdAgent_error:'006009', inviteThirdAgent_visitorDisconnect:'006010', callVisitor_VisitorAcceptSuccess:'006011', callCurrentVisitor_VisitorAcceptSuccess:'006012', visitorInvite_Success: '006013', agentInvite_Success: '006014', //邀請中 inviteThirdVisitor_inviteSendSuccess:'007001', inviteThirdAgent_inviteSendSuccess:'007002', //三方通話中 inviteThirdVisitor_success:'008001', inviteThirdAgent_success:'008002', }
000000未簽入 001000忙 001001 訪客邀請-超時 001002 坐席邀請-超時 002000閒 002001 外呼訪客-訪客拒絕 002002 外呼訪客-訪客超時 002003 外呼訪客-訪客忙 002004 外呼訪客-訪客錯誤 002005 外呼訪客-坐席掛斷(未接通) 002006 外呼當前訪客-訪客拒絕 002007 外呼當前訪客-訪客超時 002008 外呼當前訪客-訪客忙 002009 外呼當前訪客-訪客錯誤 0020010 外呼當前訪客-坐席掛斷(未接通) 002011 訪客邀請-錯誤 002012 坐席邀請-錯誤 003000外呼中 003001 外呼訪客-邀請發送成功 003002 外呼當前訪客-邀請發送成功 004000來電中 005000話後處理 005001 邀請三方訪客-主坐席掛斷 005002 邀請三方坐席-主坐席掛斷 005003 外呼訪客-訪客掛斷 005004 外呼訪客-坐席掛斷(接通後) 005005 外呼當前訪客-訪客掛斷 005006 外呼當前訪客-坐席掛斷(接通後) 005007 訪客邀請-訪客掛斷 005008 訪客邀請-坐席掛斷 005009 坐席邀請-訪客掛斷 005010 坐席邀請-坐席掛斷 006000兩方通話中 006001 邀請三方訪客-訪客拒絕 006002 邀請三方訪客-訪客忙 006003 邀請三方訪客-訪客超時 006004 邀請三方訪客-訪客錯誤 006005 邀請三方訪客-訪客掛斷
006006 邀請三方坐席-坐席拒絕
006007 邀請三方坐席-坐席忙
006008 邀請三方坐席-坐席超時
006009 邀請三方坐席-坐席錯誤 006010 邀請三方坐席-坐席掛斷 006011 外呼訪客-訪客接受視頻成功 006012 外呼當前訪客-訪客接受視頻成功 006013 訪客邀請-成功 006014 坐席邀請-成功 007000邀請中 007001 邀請三方訪客-邀請發送成功 007002 邀請三方坐席-邀請發送成功 008000三方通話中 008001 邀請三方訪客-訪客接受視頻成功 008002 邀請三方坐席-坐席接受視頻成功
一、相關api採用統一調用參數格式 二、參數爲回調函數, para1: obj, para2: func(state, [payload])
client.videoInviteVisitor({ visitorName: 'XXXX', },function(state, payload){ if (state = 006001){ console.log('邀請三方訪客-訪客拒接邀請') } else if (state = 006002){ console.log('邀請三方訪客-訪客忙線') } else if (state = 006003){ console.log('邀請三方訪客-訪客超時') } else if (state = 006004){ console.log('邀請三方訪客-訪客錯誤') } else if (state = 006005){ console.log('邀請三方訪客-訪客掛斷') } else if (state = 007001){ console.log('邀請三方訪客-邀請發送成功') } else if (state = 008001){ console.log('邀請三方訪客-訪客接受視頻成功') } else if (state = 005001){ console.log('邀請三方訪客-主坐席掛斷') } });
client.videoInviteAgent({ agentName: 'XXXX' },function(state, payload){ if (state = 006006){ console.log('邀請三方訪客-訪客拒接邀請') } else if (state = 006007){ console.log('邀請三方訪客-訪客忙線') } else if (state = 006008){ console.log('邀請三方訪客-訪客超時') } else if (state = 006009){ console.log('邀請三方訪客-訪客錯誤') } else if (state = 0060010){ console.log('邀請三方訪客-訪客掛斷') } else if (state = 007002){ console.log('邀請三方訪客-邀請發送成功') } else if (state = 008002){ console.log('邀請三方訪客-訪客接受視頻成功') } else if (state = 005002){ console.log('邀請三方訪客-主坐席掛斷') } }); *注意:原始api只有邀請 錯誤、發送成功、接收成功、第三方坐席掛斷(exitSuccess而非visitorDisconnect)住坐席掛斷
- visitorName **必填** 訪客name - inviteSuccess 外呼-訪客邀請發送成功 - acceptSuccess 外呼-訪客接受邀請 - visitorRefuse 外呼-訪客拒接邀請 - visitorDisconnect 外呼-訪客掛斷 - videoBusyMark 外呼-訪客忙線 - timeoutDisconnect 外呼-訪客超時未接聽 - kefuCloseVideoSuccess 外呼-客服掛斷音視頻 - error 外呼-訪客 出錯,錯誤信息
client.callbackToVisitor({ visitorName: 'XXXX', startVideo: true, },function(state, payload){ if (state = 002001){ console.log('外呼訪客-訪客拒接邀請') } else if (state = 002002){ console.log('外呼訪客-訪客超時') } else if (state = 002003){ console.log('外呼訪客-訪客忙線') } else if (state = 002004){ console.log('外呼訪客-訪客錯誤') } else if (state = 002005){ console.log('外呼訪客-坐席掛斷(未接通)') } else if (state = 003001){ console.log('外呼訪客-邀請發送成功') } else if (state = 006011){ console.log('外呼訪客-訪客接受視頻成功') } else if (state = 005003){ console.log('外呼訪客-訪客掛斷') } else if (state = 005004){ console.log('外呼訪客-坐席掛斷(已接通)') } } });
client.videoInviteCurrentVisitor(null, function(state, payload){ if (state = 002006){ console.log('外呼當前訪客-訪客拒接邀請') } else if (state = 002007){ console.log('外呼當前訪客-訪客超時') } else if (state = 002008){ console.log('外呼當前訪客-訪客忙線') } else if (state = 002009){ console.log('外呼當前訪客-訪客錯誤') } else if (state = 0020010){ console.log('外呼當前訪客-坐席掛斷(未接通)') } else if (state = 003002){ console.log('外呼當前訪客-邀請發送成功') } else if (state = 006012){ console.log('外呼當前訪客-訪客接受視頻成功') } else if (state = 005005){ console.log('外呼當前訪客-訪客掛斷') } else if (state = 005006){ console.log('外呼當前訪客-坐席掛斷(已接通)') } });
client.videoPickUp({ session_id: serviceSessionId, }, function(state, payload){ if (state = 001001){ console.log(‘訪客邀請-訪客超時未接聽') } else if (state = 002011){ console.log('訪客邀請-錯誤') } else if (state = 006013){ console.log('訪客邀請-成功') } else if (state = 005007){ console.log('訪客邀請-訪客掛斷(接通後)') } else if (state = 005008){ console.log('訪客邀請-坐席掛斷(接通後)') } });
client.multipleVideoPickUp(null, function(state, payload){ if (state = 001002){ console.log('坐席邀請-訪客超時未接聽') } else if (state = 002011){ console.log('坐席邀請-錯誤') }else if (state = 006014){ console.log('坐席邀請邀請-成功') } else if (state = 005009){ console.log('坐席邀請-訪客掛斷(接通後)') } else if (state = 005010){ console.log('坐席邀請-坐席掛斷(接通後)') } });