其他语言版本: 简体中文
The API-Example-Unity project is an open-source demo that will show you different scenes on how to integrate Agora SDK APIs into your project.
Any scene of this project can run successfully alone.
- Basic demos:
Demo | Description | APIs |
---|---|---|
JoinChannelAudio | basic demo to show audio call | GetEngine, JoinChannelByKey, LeaveChannel |
JoinChannelVideo | video demo with role selection in Editor Inspector | SetChannelProfile,SetClientRole,EnableVideo,EnableVideoObserver, JoinChannelByKey, VideoSurface |
- Advanced demos:
Demo | Description | APIs |
---|---|---|
ScreenShareOnMobile | sharing application screen view from Unity camera | PushVideoFrame, SetExternalVideoSource |
ScreenShareOnDesktop | sharing desktop screen or individual windows | StartScreenCaptureByWindowId, StartScreenCaptureByDisplayId, StartScreenCaptureByScreenRect |
AudioMixing | audioMixing and play audio effect in the channel | StartAudioMixing, PlayEffect |
CustomRenderAudio | use AudioSource to play raw data received in the Agora channel | PullAudioFrame |
CustomCaptureAudio | Sending raw data from AudioSource into the Agora channel | PushAudioFrame |
CustomCaptureAudioFile | feeding audio raw data using a file | PushAudioFrame |
DeviceManager | show how to get and set Device on the desktop platforms | GetAudioRecordingDeviceManager, CreateAAudioRecordingDeviceManager, GetAudioRecordingDeviceCount, GetAudioRecordingDevice, GetVideoDevice, SetAudioRecordingDevice, SetAudioPlaybackDevice, SetAudioRecordingDeviceVolume, SetAudioPlaybackDeviceVolume, ReleaseAAudioRecordingDeviceManager, ReleaseAAudioPlaybackDeviceManager, ReleaseAVideoDeviceManager |
SetEncryption | sending video with encryption | EnableEncryption |
JoinMultipleChannel | multi-channel video call with AgoraChannel class | CreateChannel, SetClientRole, EnableEncryption, LeaveChannel, ReleaseChannel |
ProcessVideoRawData | show how to setup raw video capture and render | SetOnCaptureVideoFrameCallback, SetOnRenderVideoFrameCallback, OnRenderVideoFrameHandler, OnCaptureVideoFrameHandler |
ProcessAudioRawData | playback audio frames from the channel on an AudioSource object | RegisterAudioRawDataObserver, SetOnPlaybackAudioFrameCallback, OnPlaybackAudioFrameHandler |
RtmpStreaming | stream video by RTMP Push to a CDN | SetVideoEncoderConfiguration, SetLiveTranscoding, AddPublishStreamUrl, RemovePublishStreamUrl |
JoinChannelVideoToken | demo on how to run Agora app with a token | RenewToken |
PlaybackAudioFrame | playback single user's audio frame on an AudioSource object | RegisterAudioRawDataObserver, SetOnPlaybackAudioFrameBeforeMixingCallback, OnPlaybackAudioFrameBeforeMixingHandler |
SetVideoEncoderConfiguration | video demo with multiple encoding dimension choice | SetVideoEncoderConfiguration |
- Unity 2017 LTS and up
First, create a developer account at Agora.io, and obtain an App ID.
Then do the following:
-
Clone this repository.
-
Open the project in Unity Editor. Note that you will see compiler errors before you download the SDK package.
-
You may download the SDK package in either of the following two ways:
a. From Unity Asset Store download and import the Agora Video SDK
b. Download the Agora Video SDK from Agora.io SDK. Unzip the downloaded SDK package and copy the files from samples/Hello-Video-Unity-Agora/Assets/AgoraEngine/ in SDK to API-Example-Unity/Assets/ in project
-
Choose one of the scene that you want to run
-
Fill your App ID into the scene on the game controller (attached on VideoCanvas most likely), like the following example:
Run the game and you are now good to go!
If you have any problems or suggestions regarding the sample projects, feel free to file an issue.
- You can find full API document at Document Center
- You can file issues about this demo at issue
- For advanced features such as screensharing and transcoding, please refer to this repo, which implements advanced guides in the documentation.
- Check our FAQ to see if your issue has been recorded.
- Dive into Agora SDK Samples to see more tutorials
- Take a look at Agora Use Case for more complicated real use case
- Repositories managed by developer communities can be found at Agora Community
- If you encounter problems during integration, feel free to ask questions in Stack Overflow
The sample projects are under the MIT license.