Options
All
  • Public
  • Public/Protected
  • All
Menu

房间工具栏接口

Hierarchy

  • WhiteBoardSDK

Index

Methods

getInstance

  • G1互动白板getInstance

    example
    //html
    //<script src='url/WhiteBoardSDK_IM_v{x.y.z}.js'></script>
    
    const whiteboardSDK = WhiteBoardSDK.getInstance({
     appKey: 'xxxx',
     account: 'im account',
     token: 'im token',
     nickname: 'xxx',
     debug: true,
     record: true,
     container: document.getElementById('whiteboard'),
     platform: 'web',
     getAuthInfo: () => {
         return axios.getAuth('server_request_url')
             .then(function(response) {
                 return {
                     checksum: response.data.checksum,
                     nonce: response.data.nonce,
                     curTime: response.data.curTime
                 }
             })
     }
    })
    

    Parameters

    Returns WhiteBoardSDKInstance

  • G2互动白板getInstance

    example
    //html
    //<script src='url/WhiteBoardSDK_v{x.y.z}.js'></script>
    
    const whiteboardSDK = WhiteBoardSDK.getInstance({
     appKey: 'xxxx',
     //与用户的账号体系对应的用户标志id。 同一个uid不允许多处同时登陆白板
     uid: 123123,
     nickname: 'xxx',
     debug: true,
     record: true,
     container: document.getElementById('whiteboard'),
     platform: 'web',
     getAuthInfo: () => {
         return axios.getAuth('server_request_url')
             .then(function(response) {
                 return {
                     checksum: response.data.checksum,
                     nonce: response.data.nonce,
                     curTime: response.data.curTime
                 }
             })
     }
    })
    

    Parameters

    Returns WhiteBoardSDKInstance

hideToast

  • hideToast(): void
  • 移除正在显示的Toast

    Returns void

interceptShowToast

  • 监听showToast请求,并可以修改showToast的参数。 若返回为true,则继续按照之前的参数显示Toast,若返回为false,则不显示Toast

    若返回为IShowToastOption,则按照返回的参数显示。开发者可以修改Toast的类型, 位置,信息,以及时间。

    example

    每个消息的长度都增加3s

    WhiteBoardSDK.interceptShowToast((option) => {
       option.time = option.time + 3
       return option
    })
    
    example

    修改消息的文本

    WhiteBoardSDK.interceptShowToast((option) => {
       if (option.msgType === 'NOT_ALLOWED_REPLACE_ACTIVE_BROADCASTER') {
          option.msg = `当前会议参会者${option.args.broadcasterName}正在共享视角`
          return option
       } else {
          return true
       }
    })
    
    example

    客户端若需要定制Toast,可以先将拦截函数转化为string,然后作为参数传入

    const funcStr = ((option) => {
       option.time = option.time + 3
       return option
    }).toString()
    
    WhiteBoardSDK.interceptShowToast(funcStr)
    

    { action: 'jsDirectCall', param: { target: 'WhiteBoardSDKClass', funcName: 'interceptShowToast', arg1: ((option) => { option.time = option.time + 3 return option }).toString() } }

    Parameters

    Returns void

removeToastIntercept

  • removeToastIntercept(): void
  • 移除之前设置的Toast拦截函数

    Returns void

showToast

  • 显示Toast。如果调用此函数时,另一个Toast正在显示,则正在显示的Toast会被移除

    example

    Parameters

    Returns void