Super room

10.1 Get the StarRtc.StarRoomSDK instance and implement the callback function

function superTalkCallBack(data, status, oper) {
switch (status) {
case "connect success":
//connect success
break;
case "connect failed":
case "connect closed":
//connect failed
break;
case "onWebrtcMessage":
switch (data.type) {
case "createChannel":
//Create a super room,and the data.status == "success" means success
break;
case "delChannel":
//delete the super room,and the data.status == "success" means success
break;
case "streamCreated":
//Create the local video stream,and the data.status == "success" means success
break;
case "srcApplyUpload":
//Start Speech,and the data.status == "success" means success
break;
case "vdnApplyDownload":
//Join the super room,and the data.status == "success" means success
break;
case "addUploader":
// Add a member in the Super room
break;
case "removeUploader":
//Delete a member in the Super room
break;
case "serverErr":
//server error
break;
}
break;
}
}

/**
* Create a live room
* @param _type Type: vdn, viewer; src, uploader
* @param _oper Operation type: new: create, open: join
* @param _userCallback callback
* @param _userData Store information about the live room(id,name,creator),and the structure is{"roomInfo":{"id":"", "name":"", "creator":""}}
*/
StarRtc.StarSDK.getSuperRoomSDK = function (_oper, _userCallback, _userData)

Sample
var starSDK = new StarRtc.StarSDK();
currRoom = starSDK.getSuperRoomSDK("open", superTalkCallBack, {"roomInfo":{"id":"", "name":"", "creator":""}});

10.2 API description


/**
* Connect to the super room
*/
StarRtc.StarSuperRoomSDK.sigConnect = function ()

/**
* Disconnect to the super room
* @param flag The flag of Whether to disconnect actively, which is used to determine reconnection
*/
StarRtc.StarSuperRoomSDK.sigDisconnect = function (_flag)

/**
* Create a new room
*/
StarRtc.StarSuperRoomSDK.createNew = function ()

/**
* Delete the current room
*/
StarRtc.StarSuperRoomSDK.deleteCurrRoom = function ()

/**
* @param streamOption Stream configurationResolution, etc.),such as{ "video": true, "audio": { deviceId: { ideal: ["default"] } } }, or{ "video": { width: { ideal: 640 }, height: { ideal: 480 }, frameRate: { ideal: 25 }, facingMode: { ideal: ["user"] } }, "audio": { deviceId: { ideal: ["default"] } }
}
*/
StarRtc.StarSuperRoomSDK.createStream = function (streamOption)

/**
* Join the room
*/
StarRtc.StarSuperRoomSDK.joinRoom = function ()

/**
* Leave the room
* @param _flag Whether to leave actively(optional)
*/
StarRtc.StarSuperRoomSDK.leaveRoom = function (_flag)

/**
* Send chat room message
* @param msg message
*/
StarRtc.StarSuperRoomSDK.sendChatMsg = function (msg)

/**
* Send chat room private message
* @param toUserId the user ID the meaasge will be sent to
* @param msg message
*/
StarRtc.StarSuperRoomSDK.sendChatPrivateMsg = function (userId, msg)

/**
* kick out the user
* @param kickOutUserId the user ID who will be kicked out
*/
StarRtc.StarSuperRoomSDK.kickOutUser = function (kickOutUserId)

/**
* Speaking not allowed in the room
* @param banUserId the user ID of who is speaking not allowed
* @param banTime the time duration of speaking not allowed
*/
StarRtc.StarSuperRoomSDK.banToSendMsg = function (banUserId, banTime)

/**
* Get the number of online users in the chat room
*/
StarRtc.StarSuperRoomSDK.getRoomOnlineNum = function ()

/**
* Get the disconnect satus:active or passive?
*/
StarRtc.StarSuperRoomSDK.activeDisconnect = function ()

/**
* Start the intercom
*/
StarRtc.StarSuperRoomSDK.startTalk = function ()

/**
* End the intercom
*/
StarRtc.StarSuperRoomSDK.endTalk = function ()