Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trtc-electron-sdk

Package Overview
Dependencies
Maintainers
1
Versions
543
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trtc-electron-sdk

  • 0.0.3
  • npm
  • Socket score

Version published
Weekly downloads
150
decreased by-86.5%
Maintainers
1
Weekly downloads
 
Created
Source

TRTC on Electron

Windows工程编译

  1. 安装win32 node环境
  2. 安装visual Studio 2015
  3. 确认安装node-gyp,如果node没有自带node-gyp,需要手动安装
  4. npm install
  5. npm start

mac 环境搭建

  • 安装npm:brew install node
  • 安装cnpm:npm install -g cnpm --registry=https://registry.npm.taobao.org
  • 安装Electron:npm install electron -g
  • npm install
  • npm start

TRTC_Electron 使用方法

通过npm下载trtc库

npm install trtc-electron-sdk (确认联网状态)

具体方法

//1、引入库
const TrtcEngine = require('trtc-electron-sdk');

//2、构建Trtc
this.rtcEngine = new TrtcEngine();

//3、注册回调
subscribeEvents = (rtcEngine) => {
    rtcEngine.on('onerror', (errcode, errmsg) => {
    console.info('trtc_demo: onerror :' + errcode + " msg" + errmsg);
    }); 

    rtcEngine.on('enterroom', (elapsed) => {
    console.info('trtc_demo: enterroom elapsed:' + elapsed);
    });
    rtcEngine.on('exitroom', (reason) => {
    console.info('exitroom: userenter reason:' + reason);
    });
    //.....
    //.....
};
subscribeEvents(this.rtcEngine);

//4、进入房间
enterroom () {
    //1. 开本地视频
    this.enableVideoCapture(this.enableCamera);

    //2. 编码参数
    let encparam = {
        videoResolution: TrtcEngine.TRTCVideoResolution.TRTCVideoResolution_640_360,
        videoFps: 15,
        videoBitrate: 600
    };
    this.rtcEngine.setVideoEncoderParam(encparam);

    //3. 进房参数
    let param = {
        sdkAppId: this.sdkAppId,
        roomId: this.roomID,
        userSig: this.findUserSig(this.userId),
        userId: this.userId,
        privateMapKey: '',
        businessInfo: ''
    };
    this.rtcEngine.enterRoom(param, 0);
},

//5、退出房间
exitroom() {
    this.rtcEngine.exitRoom();
},

//6、开启视频
enableVideoCapture(bEnable) {
    if (bEnable) {
        let view = this.findView("local", 0);
        this.rtcEngine.startLocalPreview(view);
    }
    else {
        this.rtcEngine.stopLocalPreview();
    }
},

//7、开启音频
enableAudioCapture(bEnable) {
    if (bEnable) {
        this.rtcEngine.startLocalAudio();
    }
    else {
        this.rtcEngine.stopLocalAudio();
    }
},

参考

demo: http://git.code.oa.com/TICSDK/TRTC_Electron_Demo.git

FAQs

Package last updated on 22 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc