How to use agora-electron-sdk - 5 common examples

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 / Agora-Electron-React / src / renderer / App.jsx View on Github external
componentDidMount(){
        if(global.rtcEngine) {
            global.rtcEngine.release()
            global.rtcEngine = null
        }

        if(!APPID) {
            alert('Please provide APPID in App.jsx')
            return
        }

        const consoleContainer = document.querySelector('#console')

        let rtcEngine = new AgoraRtcEngine()
        rtcEngine.initialize(APPID)
        
        // listen to events
        rtcEngine.on('joinedChannel', (channel, uid, elapsed) => {
            consoleContainer.innerHTML = `join channel success ${channel} ${uid} ${elapsed}`
            let localVideoContainer = document.querySelector('#local')
            //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
          let remoteVideoContainer = document.querySelector('#remote')
          rtcEngine.setupViewContentMode(uid, 1);
github AgoraIO-Community / Agora-Electron-Quickstart / Agora-Electron-Vue / src / renderer / App.vue View on Github external
this.$nextTick(function () {
                // Code that will run only after the
                // entire view has been rendered
                if(global.rtcEngine) {
                    global.rtcEngine.release()
                    global.rtcEngine = null
                }

                if(!APPID) {
                    alert('Please provide APPID in App.vue')
                    return
                }

                const consoleContainer = document.querySelector('#console')

                let rtcEngine = new AgoraRtcEngine()
                rtcEngine.initialize(APPID)
                
                // listen to events
                rtcEngine.on('joinedChannel', (channel, uid, elapsed) => {
                    consoleContainer.innerHTML = `join channel success ${channel} ${uid} ${elapsed}`
                    let localVideoContainer = document.querySelector('#local')
                    //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
                let remoteVideoContainer = document.querySelector('#remote')
                rtcEngine.setupViewContentMode(uid, 1);
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)
  })
github AgoraIO-Community / Agora-Electron-Quickstart / src / renderer / App.js View on Github external
getRtcEngine() {
    if(!this.rtcEngine) {
      this.rtcEngine = new AgoraRtcEngine()
      this.rtcEngine.initialize(APP_ID)
      this.subscribeEvents(this.rtcEngine)
      window.rtcEngine = this.rtcEngine;
    }

    return this.rtcEngine
  }
github AgoraIO-Community / Agora-Electron-Quickstart / src / renderer / App.vue View on Github external
created() {
    this.rtcEngine = new AgoraRtcEngine();
    if (!APP_ID) {
      return alert("APP_ID cannot be empty!");
    } else {
      this.rtcEngine.initialize(APP_ID);
    }
  },
  mounted() {

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