Giter VIP home page Giter VIP logo

agora-python-sdk's Introduction

Agora Python SDK

δΈ­ζ–‡ | English

Use Agora RTC SDK with Python!

Prerequisites

  • Xcode (macOS)
  • Visual Studio 2017+ with C++ (Windows)
  • Python 3.6+

Installation

Either can you install this module from PyPI using pip3 or compile the SDK yourself using the code in this repository.

Method 1: Use PyPI (Recommended)

Only support for 64-bit OS. For 32-bit OS, please refer to Method 2.

pip3 install agora-python-sdk

Method 2: Compile SDK

  1. Clone the repository.

    git clone https://github.com/AgoraIO-Community/Agora-Python-SDK.git
  2. Download the required SDK.

    • (macOS) Download SDK Agora Video SDK for macOS. Unzip the downloaded SDK package and copy the AograRtcEngineKit.framework from libs folder into the repository root folder.
    • (Windows) Download SDK Agora Video SDK for Windows. Unzip the downloaded SDK package and copy the agora_rtc_sdk.dll and agora_rtc_sdk.lib files from libs/x86_64(64-bit) or libs/x86(32-bit) into repository root folder.
  3. Compile SDK.

    Open Terminal and use cd to go to the repository root folder. Then compile using:

    python3 setup.py build_ext --inplace
  4. (Optional) Add agorartc module to site-packages folder.

    If you would like to use our SDK globally, you need to copy the related files and folder to your python site-packages folder. You can find the path using:

    python3 -c 'import site; print(site.getsitepackages())'

    Copy _agorartc.cpython-38-darwin.so, agorartc.py and AgoraRtcKit.framework or agora_rtc_sdk.dll and agora_rtc_sdk.lib to your site-packages path.

    • macOS (Terminal)

      cp _agorartc.cpython-38-darwin.so [your-site-packages-folder-path]
      cp agorartc.py [your-site-packages-folder-path]
      cp -r AgoraRtcKit.framework [your-site-packages-folder-path]
    • Windows (PowerShell)

      cp _agorartc.cpython-38-darwin.so [your-site-packages-folder-path]
      cp agorartc.py [your-site-packages-folder-path]
      cp agora_rtc_sdk.dll [your-site-packages-folder-path]
      cp agora_rtc_sdk.lib [your-site-packages-folder-path]

Usage

Visit Agora-Python-QuickStart to obtain some existed GUI demos.

You can also write a simple demo yourself by the following instructins.

  1. Open a Python3 console in Terminal (macOS) or PowerShell (Windows).

    python3
  2. Write a simple demo in Python console.

    >>> import agorartc
    >>> rtc = agorartc.createRtcEngineBridge()
    >>> eventHandler = agorartc.RtcEngineEventHandlerBase()
    >>> rtc.initEventHandler(eventHandler)
    0 (Success)
    >>> rtc.initialize("your-appID", None, agorartc.AREA_CODE_GLOB & 0xFFFFFFFF)  # If you do not have an App ID, see Appendix (https://github.com/AgoraIO-Community/Agora-Python-SDK#appendix).
    0 (Success)
    >>> rtc.enableVideo()
    0 (Success)
    >>> rtc.joinChannel("", "channel-name", "", 0)
    0 (Success)
    >>> rtc.leaveChannel()  # Leave channel
    0 (Success)

Help

For more information about our API, please refer to Agora C++ API.

The API reference for Python is on proceeding while C++ API is similar.

Appendix

Create an Account and Obtain an App ID

To use our SDK, you must obtain an app ID:

  1. Create a developer account at agora.io. Once you finish the sign-up process, you are redirected to the dashboard.
  2. Navigate in the dashboard tree on the left to Projects > Project List.
  3. Copy the app ID that you obtained from the dashboard into a text file. You will use it when you call our SDK.

agora-python-sdk's People

Contributors

jinyeqing avatar longyuyang avatar plutoless avatar williamdxz avatar yiqingjackiehuang 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.