public class TEduBoardController
extends java.lang.Object
构造器和说明 |
---|
TEduBoardController(android.content.Context context)
创建白板控制类实例
|
限定符和类型 | 方法和说明 |
---|---|
void |
addBackupDomain(java.lang.String domain,
java.lang.String backup,
int priority)
添加资源主备域名映射
|
java.lang.String |
addBoard(java.lang.String url,
int mode,
int type,
boolean needSwitch)
增加一页白板
白板页会被添加到默认文件(文件 ID 为#DEFAULT),自行上传的文件无法添加白板页
|
void |
addBoardToClassGroup(java.lang.String groupId,
java.lang.String boardId)
添加白板到分组
|
boolean |
addBoardViewToContainer(android.view.ViewGroup parentGroup,
android.view.View boardView,
android.view.ViewGroup.LayoutParams layoutParams)
将白板View设置到容器中
|
void |
addCallback(TEduBoardController.TEduBoardCallback callback)
设置事件回调监听
建议在 init 之前调用该方法,避免出现监听时机过晚,导致遗漏事件 |
java.lang.String |
addElement(int type,
java.lang.String url)
添加白板元素
|
java.lang.String |
addElement(int elementType,
TEduBoardController.TEduBoardTextElement tEduBoardTextElement)
添加文本白板元素
|
java.lang.String |
addElementFormula(java.lang.String expression)
添加公式元素
|
java.lang.String |
addElementFunctionGrapher(int type,
TEduBoardController.TEduBoardFunctionGrapher functionGrapher)
添加数学函数图像
|
java.lang.String |
addElementMathCanvas(int type,
TEduBoardController.TEduBoardMathCanvas mathCanvas)
添加数学函数画板
|
java.lang.String |
addH5File(java.lang.String url,
java.lang.String title,
boolean needSwitch)
添加 H5 页面
只支持展示,不支持互动 |
void |
addImageElement(java.lang.String url)
已过时。
该接口已废弃,请使用
addElement(int, java.lang.String) 接口代替 |
java.lang.String |
addImagesFile(java.util.List<java.lang.String> urls,
java.lang.String title,
boolean needSwitch)
批量导入图片
当传入文件的 URL 重复时,返回 URL 对应的 文件 ID 最大支持5k的数据 |
void |
addSnapshotMark()
生成板书图片标记
需要配合服务端API接口来生成,服务端会根据标记点进行快照截图 |
void |
addSyncData(java.lang.String data)
添加白板同步数据
|
void |
addTextFontFamily(java.lang.String fontFace,
java.lang.String fontUrl)
添加自定义字体
|
java.lang.String |
addTranscodeFile(TEduBoardController.TEduBoardTranscodeFileResult result,
boolean needSwitch)
添加转码文件
当传入文件的 URL 重复时,返回 URL 对应的 文件 ID 在收到对应的 onTEBAddTranscodeFile 回调前,无法用返回的文件 ID 查询到文件信息 |
void |
addUserToClassGroup(java.lang.String groupId,
java.lang.String userId)
添加用户到分组
|
java.lang.String |
addVideoFile(java.lang.String url,
java.lang.String title,
boolean needSwitch)
添加视频文件
支持的视频格式:Mp4( H264 视频编解码器和AAC音频编解码器),WebM(VP8 视频编解码器和 Vorbis 音频编解码器),Ogg(Theora 视频编解码器和 Vorbis音频编解码器) 当传入文件的 URL 重复时,返回 URL 对应的 文件 ID 在 TBS 环境下,受限于 X5 内核和视频资源I帧间隔,在 Android 平台下无法精准同步。 |
void |
applyFileTranscode(java.lang.String path,
TEduBoardController.TEduBoardTranscodeConfig config)
已过时。
|
void |
clear(boolean clearBackground)
清空当前白板页涂鸦
|
void |
clear(boolean clearBackground,
boolean clearSelectedOnly)
清空当前白板页涂鸦
目前不支持清除选中部分的同时清除背景 |
void |
clearFileDraws(java.lang.String fileId)
清空指定文件的所有白板涂鸦
|
void |
deleteBoard(java.lang.String boardId)
删除一页白板
只允许删除默认文件(文件 ID 为#DEFAULT)内的白板页,且默认白板页(白板 ID 为#DEFAULT)无法删除 |
void |
deleteFile(java.lang.String fileId)
删除文件
|
void |
enableAudioControl(boolean isEnable)
是否启用音频控制面板
|
static boolean |
enableCache()
获取缓存的启用状态
|
void |
enableMultiTouch(boolean enable)
开启多点触控
|
void |
enablePenAutoFit(boolean enable,
double delay)
开启绘制涂鸦过程中自动拟合图形
用户在绘制过程中,保持鼠标或触摸不抬起会自动触发拟合图形
开启后默认会使用TEduBoardPenFittingMode.AUTO模式拟合
|
java.util.List<java.lang.String> |
getAllClassGroupIds()
获取所有分组id
|
float |
getAudioVolume(java.lang.String elementId)
获取音量
|
TEduBoardController.TEduBoardColor |
getBackgroundColor()
获取当前白板页的背景色
|
int |
getBoardContentFitMode()
获取白板内容自适应模式
|
java.util.List<TEduBoardController.TEduBoardElementInfo> |
getBoardElementList(java.lang.String boardId)
获取白板当中所有元素
|
java.util.List<java.lang.String> |
getBoardList()
获取所有文件的白板列表
|
java.lang.String |
getBoardRatio()
获取当前白板页宽高比
|
java.util.HashMap<java.lang.String,java.lang.String> |
getBoardRemark(java.lang.String boardId)
获取白板备注
|
android.view.View |
getBoardRenderView()
获取白板渲染 View
在调用此接口获取 View 后,加入到视图树中后,在结束时需要 removeView 收到 onTEBBoardInit 回调之前调用该接口无效 |
int |
getBoardScale()
获取当前白板页缩放比例
|
TEduBoardController.ScrollInfo |
getBoardScroll()
获取白板滚动位置
|
TEduBoardController.TEduBoardColor |
getBrushColor()
获取画笔颜色
|
int |
getBrushThin()
获取画笔粗细
|
boolean |
getClassGroupEnable()
获取分组模式状态
|
java.util.List<java.lang.String> |
getClassGroupIdByUserId(java.lang.String userId)
获取用户所在的分组
|
TEduBoardController.GroupInfo |
getClassGroupInfoByGroupId(java.lang.String groupId)
获取分组信息
|
java.lang.String |
getCurrentBoard()
获取当前白板页 ID
|
java.lang.String |
getCurrentFile()
获取当前文件 ID
|
TEduBoardController.TEduBoardElement |
getElementById(java.lang.String elementId)
获取白板中的元素信息
|
int |
getEraserSize()
获取橡皮擦大小
|
java.util.List<java.lang.String> |
getFileBoardList(java.lang.String fileId)
获取指定文件的白板 ID 列表
|
TEduBoardController.TEduBoardFileInfo |
getFileInfo(java.lang.String fid)
获取白板中指定文件的文件信息
|
java.util.List<TEduBoardController.TEduBoardFileInfo> |
getFileInfoList()
获取白板中上传的所有文件的文件信息列表
|
void |
getFileTranscodeProgress(java.lang.String taskId)
主动查询文件转码进度
该接口仅用于特殊业务场景下主动查询文件转码进度,调用 applyFileTranscode 后,SDK 内部将会自动定期触发 onTEBFileTranscodeProgress 回调,正常情况下您不需要主动调用此接口 |
TEduBoardController.TEduBoardColor |
getGlobalBackgroundColor()
获取白板全局背景色
|
TEduBoardController.GlobalBackgroundPic |
getGlobalBackgroundPic()
获取白板背景图
|
TEduBoardController.TEduBoardGraphStyle |
getGraphStyle()
获取图形样式
|
TEduBoardController.TEduBoardColor |
getHighlighterColor()
获取荧光笔颜色
|
TEduBoardController.TEduBoardLineStyle |
getLineStyle()
获取直线样式
|
int |
getOvalDrawMode()
获取椭圆绘制模式
|
java.util.HashMap<java.lang.String,java.lang.String> |
getPPTRemarks(java.lang.String fid,
java.lang.Integer pageIndex)
获取PPT的备注
调用时机:收到PPT加载完成的事件onTEBH5PPTStatusChanged回调状态为`TEDU_BOARD_H5_PPT_STATUS_LOADED`
|
long |
getSyncTime()
获取同步时间戳
|
TEduBoardController.TEduBoardColor |
getTextColor()
获取文本颜色
|
java.lang.String |
getTextFontFamily()
获取当前使用字体
|
int |
getTextSize()
获取文本大小
|
int |
getTextStyle()
获取文本样式
|
java.util.List<java.lang.String> |
getThumbnailImages(java.lang.String fileId)
获取指定文件的缩略图,不支持默认文件(fileId=#DEFAULT)
|
int |
getToolType()
获取正在使用的白板工具
|
static java.lang.String |
getVersion()
获取 SDK 版本号
|
static java.lang.String |
getWebVersion()
获取白板SDK版本号
|
void |
gotoBoard(java.lang.String boardId)
跳转到指定白板页
|
void |
gotoBoard(java.lang.String boardId,
boolean resetStep)
跳转到指定白板页
|
void |
gotoClassGroupBoard(java.lang.String boardId)
分组内跳转
|
void |
gotoStep(java.lang.String boardId,
int step)
跳转指定动画步数
|
void |
init(TEduBoardController.TEduBoardAuthParam authParam,
int roomId,
TEduBoardController.TEduBoardInitParam initParam)
初始化白板
ke
|
boolean |
isDataSyncEnable()
获取白板是否开启数据同步
|
boolean |
isDrawEnable()
获取白板是否允许涂鸦
|
boolean |
isHandwritingEnable()
获取白板是否开启笔锋
|
boolean |
isPiecewiseErasureEnable()
获取分段擦除模式开启状态
|
static boolean |
isSingleMode()
获取单实例模式
|
void |
loadCustomResource(java.lang.String url,
int resourceType,
int expireTime)
加载自定义资源
|
void |
nextBoard()
向后翻页
若当前白板页为当前文件的最后一页,则该接口调用无效 |
void |
nextBoard(boolean resetStep)
向后翻页
|
void |
nextStep()
下一步
每个 Step 对应 PPT 的一个动画效果,若当前没有未展示的动画效果,则该接口调用会导致向后翻页 |
void |
pauseAudio(java.lang.String elementId)
暂停音频
|
void |
pauseVideo()
暂停视频
只对当前文件有效 触发状态改变回调 TEduBoardController.TEduBoardCallback.onTEBVideoStatusChanged(java.lang.String, int, float, float) ,一般在使用自定义视频控制栏时使用
移动端退后台调用 pause(WebView 默认行为) |
void |
playAudio(java.lang.String elementId)
播放音频
|
void |
playVideo()
播放视频
只对当前文件有效 触发状态改变回调 TEduBoardController.TEduBoardCallback.onTEBVideoStatusChanged(java.lang.String, int, float, float) ,一般在使用自定义视频控制栏时使用
移动端回前台调用 play(WebView 默认行为) |
void |
prevBoard()
向前翻页
若当前白板页为当前文件的第一页,则该接口调用无效 |
void |
prevBoard(boolean resetStep)
向前翻页
|
void |
prevStep()
上一步
每个 Step 对应 PPT 的一个动画效果,若当前没有已展示的动画效果,则该接口调用会导致向前翻页 |
void |
redo()
重做当前白板页上一次撤销
|
void |
refresh()
刷新当前页白板,触发
TEduBoardController.TEduBoardCallback.onTEBRefresh() 回调
如果当前白板包含PPT/H5/图片/视频时,刷新白板将会触发对应的回调。 |
void |
removeBackupDomain(java.lang.String domain,
java.lang.String backup)
删除资源主备域名映射
|
void |
removeBoardInClassGroup(java.lang.String groupId,
java.lang.String boardId)
从分组中删除白板
|
void |
removeCallback(TEduBoardController.TEduBoardCallback callback)
删除事件回调监听
|
void |
removeClassGroup(java.lang.String groupId)
删除分组
|
void |
removeElement(java.lang.String id)
删除白板元素
|
void |
removeUserInClassGroup(java.lang.String groupId,
java.lang.String userId)
从分组中删除用户
|
void |
reset()
重置白板
调用该接口后将会删除所有的白板页和文件 |
void |
resetClassGroup()
重置所有分组
|
void |
seekAudio(java.lang.String elementId,
float time)
音频进度拖动
|
void |
seekVideo(float time)
跳转(仅支持点播视频)
|
void |
setAccessibleUsers(java.util.List<java.lang.String> users,
java.util.List<java.lang.Integer> operationTypes,
java.util.List<java.lang.String> elementTypes)
设置允许操作哪些用户绘制的图形
|
void |
setAudioVolume(java.lang.String elementId,
float volume)
设置音量
|
void |
setBackgroundColor(TEduBoardController.TEduBoardColor color)
设置当前白板页的背景色
|
void |
setBackgroundH5(java.lang.String url)
设置当前白板页的背景 H5 页面
|
void |
setBackgroundImage(java.lang.String url,
int mode)
设置当前白板页的背景图片
|
void |
setBoardContentFitMode(int mode)
设置白板内容自适应模式
|
void |
setBoardRatio(java.lang.String ratio)
设置当前白板页宽高比
|
void |
setBoardRemark(java.lang.String boardId,
java.lang.String remark)
设置白板备注
|
void |
setBoardScale(int scale)
设置当前白板页缩放比例
|
void |
setBrushColor(TEduBoardController.TEduBoardColor color)
设置画笔颜色
|
void |
setBrushThin(int thin)
设置画笔粗细
|
void |
setClassGroup(java.lang.String groupId,
java.util.List<java.lang.String> boards,
java.util.List<java.lang.String> users,
java.lang.String title,
java.lang.String currentBoardId)
添加分组
|
void |
setClassGroupEnable(boolean enable)
开启分组模式
|
void |
setClassGroupTitle(java.lang.String groupId,
java.lang.String title)
设置分组标题
|
void |
setCursorIcon(int type,
TEduBoardController.TEduBoardCursorIcon icon)
自定义白板工具鼠标样式
|
void |
setDataSyncEnable(boolean enable)
设置白板是否开启数据同步
|
void |
setDrawEnable(boolean enable)
设置白板是否允许涂鸦
|
static void |
setEnableCache(boolean enable)
启用和关闭缓存, 请在创建TEduBoardController之前调用
|
void |
setEraseLayerLimit(int limit)
设置橡皮擦单次擦除图层数量
|
void |
setEraseLayerType(java.util.List<java.lang.Integer> typeArray)
设置橡皮擦可擦除的白板元素类型
|
void |
setEraserSize(int size)
设置橡皮擦大小
|
void |
setGlobalBackgroundColor(TEduBoardController.TEduBoardColor color)
设置所有白板的背景色
|
void |
setGlobalBackgroundPic(java.lang.String url,
int position,
int type)
设置白板背景图
|
void |
setGraphStyle(TEduBoardController.TEduBoardGraphStyle style)
设置图形样式
示例请参阅demo的 绘制无箭头的虚线直线、绘制终点实心箭头的实线直线、设置虚线直线,起点普通箭头、设置实线直线,起点实心箭头,终点普通箭头、绘制实心三角形、绘制虚线空心矩形 |
void |
setHandwritingEnable(boolean enable)
设置白板是否开启笔锋
|
void |
setHighlighterColor(TEduBoardController.TEduBoardColor color)
设置荧光笔颜色,画笔颜色用于所有荧光笔绘制
|
void |
setLineStyle(TEduBoardController.TEduBoardLineStyle style)
设置直线样式
虚线样式在 Android 4.4及以上版本支持,在4.4以下版本设置虚线样式将使用实线代替 |
void |
setLogLevel(int tEduBoardLogLevel)
设置输出日志级别
|
void |
setMathGraphType(int tEduBoardMathGraphType,
boolean setMouseTool)
设置几何画板元素
|
void |
setMouseToolBehavior(boolean whiteBoard,
boolean h5PPT,
boolean imgPPT,
boolean imgFile)
设置鼠标工具行为
|
void |
setNextTextInput(java.lang.String textContent,
boolean keepFocus)
预设文本工具内容
|
void |
setOvalDrawMode(int drawMode)
设置椭圆绘制模式
|
void |
setOwnerNickNameVisible(boolean visible)
是否本地显示自己的别名
|
void |
setPenAutoFittingMode(int mode)
设置画笔自动拟合模式
|
void |
setPiecewiseErasureEnable(boolean enable)
是否启用点擦
|
void |
setProxyServer(java.util.HashMap<java.lang.String,java.lang.String> serverMaps)
设置代理服务器
|
void |
setRemoteCursorVisible(boolean isShow,
int mode)
设置远端画笔在本地是否可见
|
void |
setScaleAnchor(float xRatio,
float yRatio)
对当前白板进行移动
|
void |
setScaleToolRatio(int ratio)
设置缩放工具缩放比例
|
void |
setScrollBarVisible(boolean enable)
设置白板滚动条是否可见
|
static void |
setSingleMode(boolean singleMode)
是否开启单实例模式
|
void |
setSyncAudioStatusEnable(boolean isEnable)
是否同步本地音频操作状态到远端
|
void |
setSyncFps(int fps)
修改信令同步频率,该值的允许范围为 [5, 20]
|
void |
setSyncVideoStatusEnable(boolean enable,
boolean isAppActiveChange)
是否同步本地视频操作到远端
|
void |
setSystemCursorEnable(boolean isEnable)
设置是否启用原生系统光标
|
void |
setTextColor(TEduBoardController.TEduBoardColor color)
设置文本颜色
|
void |
setTextFontFamily(java.lang.String fontFace)
设置自定义字体
|
void |
setTextSize(int size)
设置文本大小
|
void |
setTextStyle(int style)
设置文本样式
|
void |
setTextValue(java.lang.String id,
java.lang.String text)
设置文本组件内容
|
void |
setToolType(int type)
设置要使用的白板工具
|
void |
setToolTypeTitle(java.lang.String text,
TEduBoardController.TEduBoardToolTypeTitleStyle titleStyle,
int toolType)
设置白板工具提示语text
|
void |
setZoomCursorIcon(TEduBoardController.TEduBoardCursorIcon zoomInIconUrl,
TEduBoardController.TEduBoardCursorIcon zoomOutIconUrl)
自定义缩放工具图标
|
void |
showVideoControl(boolean show)
显示或隐藏视频控制栏
|
void |
snapshot(TEduBoardController.TEduBoardSnapshotInfo info)
白板快照
|
void |
soundMuteForPPT(boolean mute)
对转码后的H5PPT进行静音
|
void |
startSyncVideoStatus(int interval)
内部启动定时器,定时同步视频状态到远端(仅限于 mp4)
|
void |
stopSyncVideoStatus()
停止同步视频状态
只对当前文件有效 |
void |
switchFile(java.lang.String fileId)
切换文件
文件 ID 为必填项,为 null 或空字符串将导致文件切换失败 |
void |
switchFile(java.lang.String fileId,
java.lang.String boardId,
int stepIndex)
切换文件
|
void |
syncAndReload()
同步本地发送失败的数据到远端并刷新本地数据
接口用途:此接口主要用于网络恢复后,同步本地数据到远端,拉取远端数据到本地 调用时机:在网络恢复后调用 使用限制: (1)仅支持2.4.9及以上版本 (2)如果历史数据还没有加载完成,则不允许重复调用,否则回调告警 TEDU_BOARD_WARNING_ILLEGAL_OPERATION Reload等同于重新加载历史数据,会触发白板初始化时除onTEBInit之外的所有回调。 |
void |
syncRemoteTime(java.lang.String userId,
long timestamp)
同步远端时间戳
|
void |
undo()
撤销当前白板页上一次动作
|
void |
uninit()
反初始化白板,释放内部资源.在销毁白板对象后,将会结束计费。
|
void |
updateElementById(java.lang.String elementId,
int type,
int value) |
void |
updateElementById(java.lang.String elementId,
int type,
int top,
int left) |
void |
updateElementById(java.lang.String elementId,
int type,
java.lang.String value)
设置元素样式
|
void |
useMathTool(int tTEduMathToolType)
使用数学教具
|
public TEduBoardController(android.content.Context context)
context
- 应用程序的上下文环境public static java.lang.String getWebVersion()
public void addCallback(TEduBoardController.TEduBoardCallback callback)
callback
- 事件回调监听public void removeCallback(TEduBoardController.TEduBoardCallback callback)
callback
- 事件回调监听public void init(TEduBoardController.TEduBoardAuthParam authParam, int roomId, TEduBoardController.TEduBoardInitParam initParam)
authParam
- 授权参数roomId
- 课堂 ID,32位整型,取值范围[1, 4294967294]initParam
- 可选参数,指定用于初始化白板的一系列属性值
使用腾讯云 IMSDK 进行实时数据同步时,只支持一个白板实例,创建多个白板实例会导致涂鸦状态异常
可用 initParam.timSync 指定是否使用腾讯云 IMSDK 进行实时数据同步
initParam.timSync == true 时,会尝试反射调用腾讯云 IMSDK 作为信令通道进行实时数据收发(只实现消息收发,初始化、进房等操作需要用户自行实现),目前仅支持 IMSDK 4.3.118 及以上版本public void uninit()
public void setProxyServer(java.util.HashMap<java.lang.String,java.lang.String> serverMaps)
serverMaps
- key 类型为TEduBoardServiceType
public android.view.View getBoardRenderView()
public boolean addBoardViewToContainer(android.view.ViewGroup parentGroup, android.view.View boardView, android.view.ViewGroup.LayoutParams layoutParams)
parentGroup
- 存放白板的父容器boardView
- 白板View getBoardRenderViewlayoutParams
- 布局参数public void addSyncData(java.lang.String data)
data
- 接收到的房间内其他人发送的同步数据
该接口用于多个白板间的数据同步,使用内置 IM 作为信令通道时,不需要调用该接口
public void setDataSyncEnable(boolean enable)
enable
- 是否开启
白板创建后默认开启数据同步,关闭数据同步,本地的所有白板操作不会同步到远端和服务器
public boolean isDataSyncEnable()
public void enableMultiTouch(boolean enable)
enable
- 是否开启public void reset()
调用该接口后将会删除所有的白板页和文件
public static java.lang.String getVersion()
public static void setEnableCache(boolean enable)
enable
- 是否启用,默认为 YESpublic static boolean enableCache()
public static void setSingleMode(boolean singleMode)
singleMode
- 单实例模式,true为单例(第二个TEduBoardController实例初始化时会回收旧的实例),false则容许多实例
SDK默认为单实例模式public static boolean isSingleMode()
public long getSyncTime()
public void syncRemoteTime(java.lang.String userId, long timestamp)
userId
- 远端用户 IDtimestamp
- 远端用户毫秒级同步时间戳public void setDrawEnable(boolean enable)
enable
- 是否允许涂鸦,true 表示白板可以涂鸦,false 表示白板不能涂鸦
白板创建后默认为允许涂鸦状态
public boolean isDrawEnable()
public void addSnapshotMark()
public void setPenAutoFittingMode(int mode)
mode
- TEduBoardController.TEduBoardPenFittingMode
public void enablePenAutoFit(boolean enable, double delay)
enable
- 开启自动拟合delay
- 触发时延,默认2000ms
// 示例一:启用自动拟合
* teduBoard.enablePenAutoFit(true, 2000);
* // 示例二:修改自动拟合模式
* teduBoard.enablePenAutoFit(true, 2000);
* teduBoard.setPenAutoFittingMode(TEduBoardPenFittingMode.RECTANGLE);public void setAccessibleUsers(java.util.List<java.lang.String> users, java.util.List<java.lang.Integer> operationTypes, java.util.List<java.lang.String> elementTypes)
users
- 必填, 指定允许操作的用户集,为 null 表示不加限制operationTypes
- 选填, 指令允许的操作类型 TEduBoardController.TEduBoardAccessibleOperation
elementTypes
- 选填, 指定可操作的对象 TEduBoardController.TEduBoardElementType
该接口会产生以下影响:
1. ERASER 工具只能擦除 users 参数列出的用户绘制的涂鸦,无法擦除其他人绘制的涂鸦
2. POINTSELECT、SELECT 工具只能选中 users 参数列出的用户绘制的涂鸦,无法选中其他人绘制的涂鸦
3. clear 接口只能用于清空选中涂鸦以及 users 参数列出的用户绘制的涂鸦,无法清空背景及其他人绘制的涂鸦
4. 白板包含的其他功能未在本列表明确列出者都可以确定不受本接口影响public void setSystemCursorEnable(boolean isEnable)
isEnable
- public void setToolTypeTitle(java.lang.String text, TEduBoardController.TEduBoardToolTypeTitleStyle titleStyle, int toolType)
text
- 要显示的内容titleStyle
- 显示内容的样式 TEduBoardController.TEduBoardToolTypeTitleStyle
toolType
- 工具类型 TEduBoardController.TEduBoardToolType
public void setGlobalBackgroundColor(TEduBoardController.TEduBoardColor color)
color
- 要设置的全局背景色
调用该接口将导致所有白板的背景色发生改变 新创建白板的默认背景色取全局背景色
public TEduBoardController.TEduBoardColor getGlobalBackgroundColor()
public void setBackgroundColor(TEduBoardController.TEduBoardColor color)
color
- 要设置的背景色
白板页创建以后的默认背景色由 setDefaultBackgroundColor 接口设定
public TEduBoardController.TEduBoardColor getBackgroundColor()
public void setToolType(int type)
type
- 要设置的白板工具public int getToolType()
public void setZoomCursorIcon(TEduBoardController.TEduBoardCursorIcon zoomInIconUrl, TEduBoardController.TEduBoardCursorIcon zoomOutIconUrl)
zoomInIconUrl
- 放大工具图标zoomOutIconUrl
- 缩小工具图标public void setCursorIcon(int type, TEduBoardController.TEduBoardCursorIcon icon)
type
- 要设置鼠标样式的白板工具类型 TEduBoardController.TEduBoardToolType
icon
- 要设置的鼠标样式public void setBrushColor(TEduBoardController.TEduBoardColor color)
color
- 要设置的画笔颜色
画笔颜色用于所有涂鸦绘制
public TEduBoardController.TEduBoardColor getBrushColor()
public void setBrushThin(int thin)
thin
- 要设置的画笔粗细
画笔粗细用于所有涂鸦绘制,实际像素值取值(thin * 白板的高度 / 10000)px,如果结果小于1px,则涂鸦的线条会比较虚
public int getBrushThin()
public void setTextColor(TEduBoardController.TEduBoardColor color)
color
- 要设置的文本颜色public TEduBoardController.TEduBoardColor getTextColor()
public void setHighlighterColor(TEduBoardController.TEduBoardColor color)
color
- 要设置的荧光笔颜色public TEduBoardController.TEduBoardColor getHighlighterColor()
public void setTextValue(java.lang.String id, java.lang.String text)
id
- 文本元素IDtext
- 文本内容public void setTextSize(int size)
size
- 要设置的文本大小
实际像素值取值(size * 白板的高度 / 10000)px
public int getTextSize()
public void setTextStyle(int style)
style
- 要设置的文本样式 TEduBoardController.TEduBoardTextStyle
public int getTextStyle()
public void setTextFontFamily(java.lang.String fontFace)
fontFace
- 字体样式名称public java.lang.String getTextFontFamily()
public void addTextFontFamily(java.lang.String fontFace, java.lang.String fontUrl)
fontFace
- 字体样式名称fontUrl
- 字体资源链接public void clear(boolean clearBackground)
clearBackground
- 是否同时清空背景色以及背景图片public void clear(boolean clearBackground, boolean clearSelectedOnly)
clearBackground
- 是否同时清空背景色以及背景图片clearSelectedOnly
- 是否只清除选中部分涂鸦public void setLineStyle(TEduBoardController.TEduBoardLineStyle style)
style
- 要设置的直线样式 TEduBoardController.TEduBoardLineStyle
public TEduBoardController.TEduBoardLineStyle getLineStyle()
public void setGraphStyle(TEduBoardController.TEduBoardGraphStyle style)
style
- 【必填】要设置的图形样式public TEduBoardController.TEduBoardGraphStyle getGraphStyle()
public void setNextTextInput(java.lang.String textContent, boolean keepFocus)
textContent
- 预设文本内容keepFocus
- 是否继续保持焦点public void setOvalDrawMode(int drawMode)
drawMode
- 要设置的椭圆绘制模式 TEduBoardController.TEduBoardOvalDrawMode
public int getOvalDrawMode()
public void setBackgroundImage(java.lang.String url, int mode)
url
- 要设置的背景图片 URL,编码格式为 UTF8mode
- 要使用的图片填充对齐模式
当 URL 是一个有效的本地文件地址时,该文件会被自动上传到 COS。 当 URL 是一个网络地址时,默认支持 HTTPS 协议的链接。 在 Android 5.0以下,默认是采用的 MIXED_CONTENT_ALWAYS_ALLOW 模式,即总是允许 WebView 同时加载 HTTPS 和 HTTP; 而从 Android 5.0开始,默认用 MIXED_CONTENT_NEVER_ALLOW 模式,即总是不允许 WebView 同时加载 HTTPS 和 HTTP。 您可以在 getBoardRenderView 获得白板渲染视图控件时, 通过 WebSettings 自行进行设置,如下: WebSettings settings = (WebView) mWebView.getSettings(); if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) { settings.setMixedContentMode(0); } 对于 Android P 以上系统,限制了明文流量的网络请求,非加密的流量请求都会被系统禁止掉,可以参考以下方法解决:
1.res目录下新建xml目录,xml目录下新建network_security_config.xml文件:
2. build.gradle添加 useLibrary 'org.apache.http.legacy'
3.AndroidManifest.xml
同时,我们也极力建议使用系统支持(即HTTPS)的 URL。
public void setBackgroundH5(java.lang.String url)
url
- 要设置的背景 H5 页面 URL
该接口与 setBackgroundImage 接口互斥
public void undo()
public void redo()
public void setHandwritingEnable(boolean enable)
enable
- 【必填】是否开启,true 表示开启,false 表示关闭
白板创建后默认为关闭
public boolean isHandwritingEnable()
public void setEraseLayerLimit(int limit)
limit
- 默认为0,不限制图层数量public void setEraseLayerType(java.util.List<java.lang.Integer> typeArray)
typeArray
- 可擦除元素类型 TEduBoardController.TEduBoardErasableElementType
public void setPiecewiseErasureEnable(boolean enable)
enable
- true:开启 false:关闭public boolean isPiecewiseErasureEnable()
public void setEraserSize(int size)
size
- 橡皮擦大小,单位:像素public int getEraserSize()
public void setGlobalBackgroundPic(java.lang.String url, int position, int type)
url
- 资源链接position
- 图片填充对齐模式 TEduBoardController.TEduBoardImageFitMode
type
- 背景类型(0:背景图 ,1:h5)public TEduBoardController.GlobalBackgroundPic getGlobalBackgroundPic()
public java.lang.String addBoard(java.lang.String url, int mode, int type, boolean needSwitch)
url
- 可选。要使用的背景图片 URL,编码格式为 UTF8,为 null 表示不指定背景图片mode
- 可选,要使用的图片填充对齐模式,当设置url时有效 TEduBoardController.TEduBoardImageFitMode
type
- 可选,背景类型, img或h5 TEduBoardController.TEduBoardBackgroundType
needSwitch
- 可选,是否切换到添加的白板页public void deleteBoard(java.lang.String boardId)
boardId
- 要删除的白板 ID,为 null 表示删除当前页public void prevStep()
public void nextStep()
public void prevBoard()
public void nextBoard()
public void gotoBoard(java.lang.String boardId)
boardId
- 要跳转到的白板页 ID
允许跳转到任意文件的白板页
public void gotoStep(java.lang.String boardId, int step)
boardId
- step
- public void prevBoard(boolean resetStep)
resetStep
- 指定翻到指定页以后是否重置 PPT 动画步数
若当前白板页为当前文件的第一页,则该接口调用无效
public void nextBoard(boolean resetStep)
resetStep
- 指定翻到指定页以后是否重置 PPT 动画步数
若当前白板页为当前文件的最后一页,则该接口调用无效
public void gotoBoard(java.lang.String boardId, boolean resetStep)
boardId
- 要跳转到的白板页 IDresetStep
- 指定翻到指定页以后是否重置 PPT 动画步数
允许跳转到任意文件的白板页
public java.lang.String getCurrentBoard()
public java.util.List<java.lang.String> getBoardList()
public void setBoardRatio(java.lang.String ratio)
ratio
- 要设置的白板宽高比
格式如: "4:3"、"16:9"
public java.lang.String getBoardRatio()
public void setBoardScale(int scale)
scale
- 要设置的白板缩放比例
支持范围: [100,1600],实际缩放比为: scale/100
public int getBoardScale()
public void setScaleAnchor(float xRatio, float yRatio)
xRatio
- 左或右,小于0按照0处理,大于1按照1处理yRatio
- 上或下,小于0按照0处理,大于1按照1处理public void setScaleToolRatio(int ratio)
public TEduBoardController.ScrollInfo getBoardScroll()
public void setRemoteCursorVisible(boolean isShow, int mode)
isShow
- 【必填】,true: 可见 false: 不可见mode
- 【选填】TEduBoardRemoteCursorAction,远端画笔操作类型public void setBoardContentFitMode(int mode)
mode
- 要设置的白板内容自适应模式 TEduBoardController.TEduBoardContentFitMode
设置自适应模式后会影响所有后续白板内容操作,受影响接口包括:AddTranscodeFile
public int getBoardContentFitMode()
public void refresh()
TEduBoardController.TEduBoardCallback.onTEBRefresh()
回调
public void loadCustomResource(java.lang.String url, int resourceType, int expireTime)
url
- 资源url,请使用https协议的网络资源urlresourceType
- 具体请参考 TEduBoardController.TEduBoardReloadResourceType
expireTime
- 过期时间,单位秒,-1表示永久有效;超出过期时间后,本地预加载资源会失效public void syncAndReload()
public void setLogLevel(int tEduBoardLogLevel)
tEduBoardLogLevel
- 日志级别TEduBoardController.TEduBoardLogLevel
public void setSyncFps(int fps)
fps
- 频率
调整信令同步频率的,开启了多指后,如果频率不提高,消息会有延时会比较大public void setScrollBarVisible(boolean enable)
enable
- 是否可见public java.lang.String addImagesFile(java.util.List<java.lang.String> urls, java.lang.String title, boolean needSwitch)
urls
- 要使用的图片URL列表,编码格式为 UTF8title
- 文件名,选填needSwitch
- 添加转码文件是否需要立刻跳转到该文件@Deprecated public void applyFileTranscode(java.lang.String path, TEduBoardController.TEduBoardTranscodeConfig config)
path
- 要转码的文件路径,编码格式为 UTF8config
- 转码参数 TEduBoardController.TEduBoardTranscodeConfig
支持 PPT、PDF、Word 文件转码 PPT 文档默认转为 H5 动画,能够还原 PPT 原有动画效果,其它文档转码为静态图片 PPT 动画转码耗时约1秒/页,所有文档的静态转码耗时约0.5秒/页 转码进度和结果将会通过 onTEBFileTranscodeProgress 回调返回,详情参见该回调说明文档
public void getFileTranscodeProgress(java.lang.String taskId)
public java.lang.String addTranscodeFile(TEduBoardController.TEduBoardTranscodeFileResult result, boolean needSwitch)
result
- 文件转码结果needSwitch
- 是否切换到该文件
TEduBoardTranscodeFileResult 的字段信息主要来自: 1. 使用客户端 applyFileTranscode 转码,直接将转码结果用于调用此接口 2. (推荐)使用服务端 REST API 转码,只需传入转码回调结果的四个字段(title,resolution,url,pages),其服务端->客户端字段的对应关系为 Title->title、Resolution->resolution、ResultUrl->url、Pages->pages 字段 [转码文档](https://cloud.tencent.com/document/product/1137/40260)
调用该接口后,SDK 会在后台进行文件加载,期间用户可正常进行其它操作,加载成功或失败后会触发相应回调 文件加载成功后,将自动切换到该文件
触发 TEduBoardController.TEduBoardCallback.onTEBAddTranscodeFile(java.lang.String)
回调
public java.lang.String addElement(int type, java.lang.String url)
type
- 元素类型 TEduBoardController.TEduBoardElementType
url
- 元素urlpublic java.lang.String addElement(int elementType, TEduBoardController.TEduBoardTextElement tEduBoardTextElement)
elementType
- 元素类型 TEduBoardController.TEduBoardElementType
tEduBoardTextElement
- 文本元素 TEduBoardController.TEduBoardTextElement
public java.lang.String addElementMathCanvas(int type, TEduBoardController.TEduBoardMathCanvas mathCanvas)
type
- 元素类型 TEduBoardController.TEduBoardElementType
mathCanvas
- TEduBoardController.TEduBoardMathCanvas
public java.lang.String addElementFunctionGrapher(int type, TEduBoardController.TEduBoardFunctionGrapher functionGrapher)
type
- 元素类型 TEduBoardController.TEduBoardElementType
functionGrapher
- public java.lang.String addElementFormula(java.lang.String expression)
expression
- 数学公式public void removeElement(java.lang.String id)
id
- 元素idpublic void addImageElement(java.lang.String url)
addElement(int, java.lang.String)
接口代替url
- 【必填】图片地址
支持 png/jpg/gif/svg 格式的本地和网络图片,当 URL 是一个有效的本地文件地址时,该文件会被自动上传到 COS。上传进度回调 onTEBFileUploadProgress,上传结果回调 onTEBFileUploadStatuspublic void soundMuteForPPT(boolean mute)
mute
- true:静音 false:取消静音public void setMathGraphType(int tEduBoardMathGraphType, boolean setMouseTool)
tEduBoardMathGraphType
- 几何元素类型 TEduBoardController.TEduBoardMathGraphType
setMouseTool
- 是否切换到鼠标工具public void useMathTool(int tTEduMathToolType)
tTEduMathToolType
- 【必填】要使用的数学教具 TEduBoardController.TEduMathToolType
public void setMouseToolBehavior(boolean whiteBoard, boolean h5PPT, boolean imgPPT, boolean imgFile)
whiteBoard
- 普通白板,默认值trueh5PPT
- 动态ppt转码的文件,默认值trueimgPPT
- 静态ppt转码文件,默认值trueimgFile
- 图片文件(addImagesFile(java.util.List<java.lang.String>, java.lang.String, boolean)
接口添加的文件)默认值truepublic void setOwnerNickNameVisible(boolean visible)
visible
- 设置为false时,画笔部分不显示自己的NickName;public void setBoardRemark(java.lang.String boardId, java.lang.String remark)
boardId
- 【必填】要备注的白板idremark
- 【必填】要备注的内容public java.util.HashMap<java.lang.String,java.lang.String> getBoardRemark(java.lang.String boardId)
boardId
- public java.util.HashMap<java.lang.String,java.lang.String> getPPTRemarks(java.lang.String fid, java.lang.Integer pageIndex)
fid
- 【必填】文件IDpageIndex
- 【选填】-1表示获取当前ppt所有备注;其他表示获取当前ppt索引页(从0开始)的备注public void deleteFile(java.lang.String fileId)
fileId
- 要删除的文件 ID
文件 ID 为 nullptr 时表示当前文件,默认文件无法删除
public void switchFile(java.lang.String fileId)
fileId
- 要切换到的文件 IDpublic void switchFile(java.lang.String fileId, java.lang.String boardId, int stepIndex)
fileId
- 要切换到的文件 IDboardId
- 切换文件并跳转到这个白板页stepIndex
- 跳转到白板页并切换到这个动画
public java.lang.String getCurrentFile()
public java.util.List<TEduBoardController.TEduBoardFileInfo> getFileInfoList()
public TEduBoardController.TEduBoardFileInfo getFileInfo(java.lang.String fid)
fid
- 文件IDpublic java.util.List<TEduBoardController.TEduBoardElementInfo> getBoardElementList(java.lang.String boardId)
boardId
- 如果为空则获取当前白板所有元素public void updateElementById(java.lang.String elementId, int type, java.lang.String value)
type
- [必填]元素操作类型 元素操作类型 TEduElementOperatorTypevalue
- 与元素操作类型对应
BOARDER_COLOR: 颜色值,如@"rgba(255, 0, 0, 1)";
BOARDER_WIDTH: 线宽度值, 如500;
BOARDER_LINE_TYPE: `TEduBoardLineType`;
EL_DELETE: 传空字符串
CHANGE_POSITION: 传top left坐标elementId
- 元素idpublic void updateElementById(java.lang.String elementId, int type, int value)
public void updateElementById(java.lang.String elementId, int type, int top, int left)
public TEduBoardController.TEduBoardElement getElementById(java.lang.String elementId)
elementId
- 元素idpublic java.util.List<java.lang.String> getFileBoardList(java.lang.String fileId)
fileId
- 文件 IDpublic void clearFileDraws(java.lang.String fileId)
fileId
- 文件 IDpublic java.util.List<java.lang.String> getThumbnailImages(java.lang.String fileId)
fileId
- 文件 IDpublic java.lang.String addVideoFile(java.lang.String url, java.lang.String title, boolean needSwitch)
TEduBoardController.TEduBoardCallback.onTEBVideoStatusChanged(java.lang.String, int, float, float)
url
- 【必填】文件播放地址title
- 【选填】文件名needSwitch
- 【选填】添加文件后是否切换到该文件public void showVideoControl(boolean show)
show
- 是否显示
public void playVideo()
触发状态改变回调 TEduBoardController.TEduBoardCallback.onTEBVideoStatusChanged(java.lang.String, int, float, float)
,一般在使用自定义视频控制栏时使用
移动端回前台调用 play(WebView 默认行为)
public void pauseVideo()
触发状态改变回调 TEduBoardController.TEduBoardCallback.onTEBVideoStatusChanged(java.lang.String, int, float, float)
,一般在使用自定义视频控制栏时使用
移动端退后台调用 pause(WebView 默认行为)
public void seekVideo(float time)
time
- 播放进度,单位秒
触发状态改变回调 TEduBoardController.TEduBoardCallback.onTEBVideoStatusChanged(java.lang.String, int, float, float)
,一般在使用自定义视频控制栏时使用
public void setSyncVideoStatusEnable(boolean enable, boolean isAppActiveChange)
enable
- 【必填】是否同步
play/pause/seek 接口以及控制栏事件的触发是否影响远端,默认为 true 一般情况下学生设置为 false,老师设置为 true
isAppActiveChange
- 只有在移动端在app切换前后台的时候需要调用,其他端不需要设置public void startSyncVideoStatus(int interval)
interval
- 【选填】同步间隔,例如设置5秒
一般在老师端视频加载完成后调用,切换文件后内部自动销毁定时器,
public void stopSyncVideoStatus()
public void enableAudioControl(boolean isEnable)
isEnable
- 启用或禁止public void playAudio(java.lang.String elementId)
elementId
- addElement(int, java.lang.String)
返回的元素IDpublic void pauseAudio(java.lang.String elementId)
elementId
- addElement(int, java.lang.String)
返回的元素IDpublic void seekAudio(java.lang.String elementId, float time)
elementId
- 调用 addElement(int, java.lang.String)
返回的元素IDtime
- 播放进度public void setAudioVolume(java.lang.String elementId, float volume)
elementId
- 调用 addElement(int, java.lang.String)
返回的元素IDvolume
- 音频音量 ,取值范围[0-1]public float getAudioVolume(java.lang.String elementId)
elementId
- 调用 addElement(int, java.lang.String)
返回的元素IDpublic void setSyncAudioStatusEnable(boolean isEnable)
isEnable
- 是否同步public java.lang.String addH5File(java.lang.String url, java.lang.String title, boolean needSwitch)
url
- 【必填】网页地址title
- 【选填】文件名needSwitch
- 【选填】添加文件后是否切换到该文件public void snapshot(TEduBoardController.TEduBoardSnapshotInfo info)
info
- 快照信息public void addBackupDomain(java.lang.String domain, java.lang.String backup, int priority)
domain
- 主域名 (必填)backup
- 备用域名 (必填)priority
- 优先级,备用域名优先级相同时,按添加的顺序决定优先级,添加越前优先级越高
主备域名均需包含协议类型(支持http/https)
切换域名重试超时默认为5s
多次调用此接口,可为统一主域名添加多个备用域名。如果备用域名已在列表中则不再添加
当主域名不可用时,SDK将按从前往后的顺序从列表中选择一个备用域名并重试,请务必将可用性高的域名添加到列表前面public void removeBackupDomain(java.lang.String domain, java.lang.String backup)
domain
- 主域名 (必填)backup
- 备用域名 (必填)public void addBoardToClassGroup(java.lang.String groupId, java.lang.String boardId)
groupId
- 分组idboardId
- 白板idpublic void addUserToClassGroup(java.lang.String groupId, java.lang.String userId)
groupId
- 分组iduserId
- 用户idpublic java.util.List<java.lang.String> getAllClassGroupIds()
public boolean getClassGroupEnable()
public java.util.List<java.lang.String> getClassGroupIdByUserId(java.lang.String userId)
userId
- 用户idpublic TEduBoardController.GroupInfo getClassGroupInfoByGroupId(java.lang.String groupId)
groupId
- 分组idpublic void gotoClassGroupBoard(java.lang.String boardId)
boardId
- 白板idpublic void removeBoardInClassGroup(java.lang.String groupId, java.lang.String boardId)
groupId
- 分组idboardId
- 白板idpublic void removeClassGroup(java.lang.String groupId)
groupId
- 分组idpublic void removeUserInClassGroup(java.lang.String groupId, java.lang.String userId)
groupId
- 分组iduserId
- 用户idpublic void resetClassGroup()
public void setClassGroupEnable(boolean enable)
enable
- 是否启用public void setClassGroupTitle(java.lang.String groupId, java.lang.String title)
groupId
- 分组idtitle
- 分组标题public void setClassGroup(java.lang.String groupId, java.util.List<java.lang.String> boards, java.util.List<java.lang.String> users, java.lang.String title, java.lang.String currentBoardId)
groupId
- 分组idboards
- 分组白板列表users
- 分组用户列表title
- 分组标题currentBoardId
- 分组初始白板