Interactive live broadcast

3.1 Create a live room

Create an XHLiveManager object

The class which the object belongs to needs to implement the ILiveListener interface.
XHLiveManager::addChatroomGetListListener(this);
m_pLiveManager = new XHLiveManager(this);

3.2 The description of getting live list

The method without AEC

/**
* Get the live list
*/
void getLiveList()
{
list<ChatroomInfo> listData;
XHLiveManager::getLiveList(m_pUserManager, "", CHATROOM_LIST_TYPE_LIVE,listData);
}
After calling this method, there will be a corresponding chatroomQueryAllListOK callback function.

/*
* Save the live info
*/
string strInfo = "{\"id\":\"";
strInfo += strLiveId;
strInfo += "\",\"creator\":\"";
strInfo += m_pUserManager->m_ServiceParam.m_strUserId;
strInfo += "\",\"name\":\"";
strInfo += strName.GetBuffer(0);
strInfo += "\"}";
m_pLiveManager->saveToList(m_pUserManager->m_ServiceParam.m_strUserId, CHATROOM_LIST_TYPE_LIVE, strLiveId, strInfo);

The method of AEC

/**
* Get the live list
*/
void getLiveList()
{
list<ChatroomInfo> listData;
CInterfaceUrls::demoQueryList(strListType, listData);
}

/*
* Save the live info
*/
string strInfo = "{\"id\":\"";
strInfo += strLiveId;
strInfo += "\",\"creator\":\"";
strInfo += m_pUserManager->m_ServiceParam.m_strUserId;
strInfo += "\",\"name\":\"";
strInfo += strName.GetBuffer(0);
strInfo += "\"}";
CInterfaceUrls::demoSaveToList(pUserManager->m_ServiceParam.m_strUserId, CHATROOM_LIST_TYPE_LIVE, strLiveId, strInfo);

3.3 XHLiveManager API Description

/**
* Get the live list
* @param strUserId user ID
* @param listType List type
* @return listData list information
*/
static void getLiveList(CUserManager* pUserManager, string strUserId, string listType, list<ChatroomInfo>& listData);

/**
* Create a live room
*/
string createLive(string strName, int chatroomType, int channelType);

/**
* Start a live room
* @param strLiveID ID
*/
bool startLive(string strLiveID);

/*
* Set the global parameter
*/
void globalSetting(int w, int h, int fps, int bitrate);

/*
* Start the live encoder
*/
bool startEncoder(int audioSampleRateInHz, int audioChannels, int audioBitRate, unsigned char* ppsData,int ppsDataLen, unsigned char* spsData,int spsDataLen);

/**
* Save the live room information to the list
* @param userId
* @param type
* @param liveId
* @param data
*/
bool saveToList(string userId, int type, string liveId, string data);

/**
* Delete the live info from the list
* @param userId 用户ID
* @param type 类型
* @param liveId liveID
*/
void deleteFromList(string userId, int type, string liveId);

/**
* Insert the video data
* @param videoData
* @param dataLen
* @param isBig
*/
void insertVideoRaw(unsigned char* videoData, int dataLen, int isBig);