Code Monkey home page Code Monkey logo

trtc-electron-quickstart's Introduction

trtc-electron-quickstart

如何快速创建一个Electron+WebRTC桌面应用

1. 准备

  • 一个常用的的编辑器(或者 IDE)
  • 系统安装了Node.js 和 npm
  • 了解HTML/CSS/JavaScript
  • 两台有摄像头的电脑

2. 运行示例代码

安装依赖,在文件目录下执行:

npm install

这一步会安装electron,后续打包需要的electron-builder;以及实时音视频SDK:trtc-sdk 启动项目:

npm run start

执行后,项目启动: 此处输入图片的描述

点击“我要视频通话” 此处输入图片的描述

要想体验多人通话,我们还需要另一台电脑也运行Demo。把your-app文件夹拷贝到另一台电脑,安装好依赖,运行Demo:

npm install
npm run start

可以互相通话了!两台设备物理距离过近的话,会有啸叫,物理距离远一些就好了。 此处输入图片的描述

3. 打包应用

在package.json中已经做了mac和Windows的electron-builder打包配置:

    "build": {
        "appId": "com.webrtc.app",
        "mac": {
            "target": [
                "dmg",
                "zip"
            ]
        },
        "win": {
            "target": [
                "nsis",
                "zip"
            ]
        }
    },
    "scripts": {
        "dist": "electron-builder"
    },

执行

npm run dist

在不同平台下生成对应平台的相关文件,这个过程可能比较长需要等待一两分钟,在Windows 64位平台执行完成后生成的文件如下: 此处输入图片的描述 自上往下分别是:

未压缩的文件夹,其中包含可执行文件; 更新相关的文件; 安装程序; 安装程序的blockmap; 第一个文件夹的压缩文件夹

解压zip包或执行setup安装文件,应用启动后且没有报错,则说明本次打包成功。

trtc-electron-quickstart's People

Contributors

mengyaocui avatar woody134 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.