How to use the agora-electron-sdk.default function in agora-electron-sdk

To help you get started, we’ve selected a few agora-electron-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AgoraIO-Community / Agora-Electron-Quickstart / renderer-process / video-audio / join-channel.js View on Github external
const consoleContainer = document.getElementById('agora-join-channel-console')
  const sdkLogPath = path.resolve(os.homedir(), "./agoramainsdk.log")
  const localVideoContainer = document.getElementById('join-channel-local-video')
  const remoteVideoContainer = document.getElementById('join-channel-remote-video')
  const APPID = global.AGORA_APPID || ""
  
  if(!APPID) {
    alert(`AGORA_APPID not found in environment variables`)
  }
  
  if(global.rtcEngine) {
    // if rtc engine exists already, you must call release to free it first
    global.rtcEngine.release()
  }
  
  let rtcEngine = new AgoraRtcEngine()
  rtcEngine.initialize(APPID)
  
  // listen to events
  rtcEngine.on('joinedChannel', (channel, uid, elapsed) => {
    consoleContainer.innerHTML = `joined channel ${channel} with uid ${uid}, elapsed ${elapsed}ms`
    //setup render area for local user
    rtcEngine.setupLocalVideo(localVideoContainer)
  })
  rtcEngine.on('error', (err, msg) => {
    consoleContainer.innerHTML = `error: code ${err} - ${msg}`
  })
  rtcEngine.on('userJoined', (uid) => {
    //setup render area for joined user
    rtcEngine.setupViewContentMode(uid, 1);
    rtcEngine.subscribe(uid, remoteVideoContainer)
  })

agora-electron-sdk

agora-electron-sdk

MIT
Latest version published 3 months ago

Package Health Score

70 / 100
Full package analysis

Popular agora-electron-sdk functions