Code Monkey home page Code Monkey logo

agora-with-qt's Introduction

Agora With Qt Quick

This opensource project shows how to integrate Agora video SDK with Qt Quick(32bit) and implements video broadcasting

The following features are included in this sample project:

  • Join / leave channel
  • Set role as broadcaster or audience
  • Mute / unmute audio
  • Change camera
  • Setup resolution, frame rate and bit rate

Qt Quick

  • UI

This project use Qt Quick as UI and Agora SDK capture,encode,transfer, decode, render video and audio.

Qt Quick reference Qt Quick website

Agora SDK reference [Agora Document](https://docs.agora.io/cn/Interactive Broadcast/product_live?platform=All Platforms)

Developer Environment Requirements

  • Win7 or higher/Mac
  • Qt Creator

Run the sample program

Register your account with Agora.io Registration and create your own test project to get the AppID.Fill in the AppID into source code agorartcengine.cpp

    context.appId = ""; // Specify your APP ID here

Next, download the Agora Video SDK from Agora.io SDK. Unzip the downloaded SDK package and copy the sdk to the "Agora-with-QT" folder in project(the old one may be over written).

  • Windows: copy folder sdk to the directory where AgoraVideoCall.pro is located in.
  • Mac:libs/AgoraRtcEngineKit.framework copy to lib folder

Finaly, use Qt Creator to open AgoraVideoCall.pro file, then build and run.

Running Environment

  • Windows/Mac

Contact us

  • For potential issues, you may take a look at our FAQ first
  • Dive into Agora SDK Samples to see more tutorials
  • Would like to see how Agora SDK is used in more complicated real use case? Take a look at Agora Use Case
  • Repositories managed by developer communities can be found at Agora Community
  • You can find full API document at Document Center
  • If you encounter problems during integration, you can ask question in Developer Forum
  • You can file bugs about this sample at issue

License

The MIT License (MIT)

agora-with-qt's People

Contributors

plutoless avatar prwrl avatar sbd021 avatar williamdxz avatar winking324 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agora-with-qt's Issues

GPU Soft Fault

Can the project run on the Mac M1?

Description:
there are not video screens on the UI window, when we run on the Mac M1
we are sure that the setupLocalVideo and the setupRemoteVideo return 0
and in the app output, it prints:
GPU Soft Fault count: 1

Environment:
OS: Mac OS 12.1
ARCH: arm64
xcode: 12.0
QT Version: 6.2

To Reproduce:

  1. build and run
  2. See output in app console
  3. there are not video screens on the UI window

Expected behavior:
it can show the video screens

建议修改一些glsl代码已适配gles

video_render_opengl.cpp
的片段着色器修改如下

    static const char fragmentShader[] = {
        "#ifdef GL_ES\n"
        "precision mediump float;\n"
        "#else\n"
        "mediump float;\n"
        "#endif\n"
        "uniform sampler2D Ytex;\n"
        "uniform sampler2D Utex,Vtex;\n"
        "varying vec2 vTextureCoord;\n"
        "void main(void) {\n"
        "  float nx,ny,r,g,b,y,u,v;\n"
        "  mediump vec4 txl,ux,vx;"
        "  nx=vTextureCoord[0];\n"
        "  ny=vTextureCoord[1];\n"
        "  y=texture2D(Ytex,vec2(nx,ny)).r;\n"
        "  u=texture2D(Utex,vec2(nx,ny)).r;\n"
        "  v=texture2D(Vtex,vec2(nx,ny)).r;\n"

        //"  y = v;\n"+
        "  y=1.1643*(y-0.0625);\n"
        "  u=u-0.5;\n"
        "  v=v-0.5;\n"

        "  r=y+1.5958*v;\n"
        "  g=y-0.39173*u-0.81290*v;\n"
        "  b=y+2.017*u;\n"
        "  gl_FragColor=vec4(r,g,b,1.0);\n"
        "}\n" };

增加了GL_ES的精度

使用 qmlplugindump 工具在windows平台产生plugin cannot be loaded for module错误

我将这个demo单独做成了qml的扩展插件方便其他项目复用,做qml插件要使用qmlplugindump工具生成plugins.qmltypes文件,在macos下没有产生问题可以正常生成plugins.qmltypes文件,但同样的代码在windows中就会出现下面错误

QQmlComponent: Component is not ready
file:///D:/musdoor/PlugIns/windows/typelist.qml:11:1: plugin cannot be loaded for module "MuseAgora": Cannot load library D:\musdoor\PlugIns\windows\MuseAgora\MuseAgora.dll: 找不到指定的模块。

入口文件代码如下:

#include "museagora_plugin.h"

#include "Cpp/avideowidget.h"
#include "Cpp/agorartcengine.h"
#include "Cpp/museagora.h"
#include "Cpp/testsingleton.h"

#include <qqml.h>
#include <QScopedPointer>

static QObject *agora_engine_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
    Q_UNUSED(engine)
    Q_UNUSED(scriptEngine)

    return new AgoraRtcEngine();
}

void MuseAgoraPlugin::registerTypes(const char *uri)
{
    // @uri MuseAgora
    qmlRegisterType<AVideoWidget>(uri, 1, 0, "AVideoWidget");

    // 单例模这里会产生问题
    qmlRegisterSingletonType<AgoraRtcEngine>(uri, 1, 0, "AgoraRtcEngine", agora_engine_singletontype_provider);
}

一点点注释点代码最终锁定了出问题的代码

// 注意下面注释掉了m_rtcEngine(createAgoraRtcEngine())和m_rtcEngine->release();
// 这两个只要有一个去掉注释就会引发qmlplugindump上面所说错误,加上注释就能正常生成plugins.qmltypes文件
AgoraRtcEngine::AgoraRtcEngine(QObject *parent) : QObject(parent)
  // ,m_rtcEngine(createAgoraRtcEngine())
  ,m_eventHandler(new AgoraRtcEngineEvent(*this))
{
}

AgoraRtcEngine::~AgoraRtcEngine()
{
    if(m_rtcEngine) {
        // m_rtcEngine->release();
    }
}

以上这个问题只有在windows上会发生,macos下一切正常,这个问题很奇怪为什么?
编译器 MSCV2019 64bit
qt 版本 5.15.0

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.