Git Product home page Git Product logo

chatroom's Introduction

Chatroom

Read this in other languages: 简体中文

Introduction

A typical voice chatroom has a host and several audience.

in which:

  • The host talks and the audience hear the host.
  • The host invites the audience for interaction and the audience switches the user role to be a co-host.
  • The host can mute or unmute the co-host, and delete or add a host position.
  • Any change to the host state and host position is immediately known to the host, co-host, and audience in the channel.

This use case particularly applies to scenarios such as online KTV and FM radio.

Agora supports real-time voice interaction between a maximum of one host + 16 co-hosts.

Feature

Use the Agora SDK to implement the following features in your project:

  • Real-time voice interaction: Smooth communication between the host and audience guaranteed by ultra-low latency.
  • Co-hosting: The audience becomes a co-host and interact with the host, so that all users in the channel can hear the interaction.
  • Host position control: The host has the following control privileges: invite an audience to become a co-host, switch a co-host back to an audience, mute and unmute a co-host, delete and resume a host position. Any change to the host state and host position is immediately known to all users in the channel.
  • Real-time messaging: The host, co-host, and audience can send IM messages to each other. The audience can also send gifts to the host/co-host.
  • User management: Maintains the user list and nicknames of the users in the channel.
  • Audio mixing: The host and co-host can play background music while talking.
  • Voice changer: Adds special voice effect for the host or co-host to add more fun to the chatroom.

The sample app shows only the part related to voice chat and is not a complete product. If you want to develop a complete product, you need to implement the rest of the voice chatroom.

Run the Sample App

  1. Create a developer account at agora.io and create a project in Dashboard to get an App ID.

  2. Download Voice SDK and Real-time Messaging SDK.

Android

  1. Add the AppID and Token in the Android/app/src/main/res/values/strings_config.xml file.

    <string name="app_id" translatable="false"><#Your App Id#></string>
    <string name="token" translatable="false"><#Temp Access Token#></string>
    <string name="rtm_token" translatable="false"><#Temp Rtm Access Token#></string>
    
  2. Unpack the SDKs and do the following:

    • Copy the libs folder to the Android/app folder.
  3. Open the project with Android Studio and connect to an Android test device. Compile and run the sample app.

     Development environment:
     - Android Studio 2.0+.
     - minSdkVersion 16.
     - Emulators may lack the functionality or performance needed to run the sample app. Agora recommends using physical Android devices. 
    

iOS

  1. Add the AppID and Token in the KeyCenter.swift file.

    static let AppId: String = <#Your App Id#>
    static let Token: String? = <#Temp Access Token#>
    static let RtmToken: String? = <#Temp Rtm Access Token#>
    
  2. Unpack the SDKs and copy the libs folder to the iOS/AgoraChatRoom folder of your project.

  3. Open the iOS/AgoraChatRoom.xcodeproj file with XCode. Connect to an iOS test device and fill in a valid developer signature.

     Development environment:
     - XCode 10.0+.
     - iOS 8.0+.
    

Key API list

iOS Android
RTC sharedEngineWithAppId:delegate: create
setChannelProfile setChannelProfile
setClientRole setClientRole
setAudioProfile setAudioProfile
joinChannel joinChannel
muteLocalAudioStream muteLocalAudioStream
RTM initWithAppId:delegate: createInstance
loginByToken:user:completion: login
createChannelWithId:delegate: createChannel
joinWithCompletion: join
getChannelAttributes:ByKeys:completion: getChannelAttributes
sendMessage:toPeer:completion: sendMessageToPeer
addOrUpdateLocalUserAttributes:completion: addOrUpdateChannelAttributes

FAQ

  1. Q: Noise reduction is disabled when there is only one host and scenario in audioProfile is set to Default, ShowRoom, Education, and GameStreaming. How can I fix that?

    A: You can enable noise reduction through the private interface: agoraKit.setParameters("{\"che.audio.enable.ns\":true}")

  2. Q: Calling the disableAudio or leaveChannel method stops other apps from using AVAudioSession to play and record. How can I fix that?

    A: You can keep the audio session active by calling the agoraKit.setAudioSessionOperationRestriction(.deactivateSession)method after calling the disableAudio or leaveChannel method.

Contact Us

  • API documentation is available at the Document Center.
  • For any issue with integration, connect with global developers in the Developer Community.
  • For genera technical support, submit a ticket at the Agora Dashboard.
  • For any issue with the sample code, submit an issue at GitHub.

License

The MIT License (MIT).

chatroom's People

Contributors

lichking-2234 avatar prwrl avatar plutoless avatar cavansu avatar yeyuzhou avatar brianxcli avatar guohai avatar tongjiangyong avatar yuanzaiyu avatar

Watchers

James Cloos 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.