|
1 | 1 | # API Example macOS
|
2 | 2 |
|
3 |
| -*English | [中文](README.zh.md)* |
| 3 | +_English | [中文](README.zh.md)_ |
4 | 4 |
|
5 |
| -This project presents you a set of API examples to help you understand how to use Agora APIs. |
| 5 | +## Overview |
6 | 6 |
|
7 |
| -## Prerequisites |
| 7 | +This repository contains sample projects using the Agora RTC Objective-C SDK for macOS. |
8 | 8 |
|
9 |
| -- Xcode 10.0+ |
| 9 | + |
10 | 10 |
|
11 |
| -## Quick Start |
12 | 11 |
|
13 |
| -This section shows you how to prepare, build, and run the sample application. |
| 12 | +## Project structure |
14 | 13 |
|
15 |
| -### Prepare Dependencies |
| 14 | +The project uses a single app to combine a variety of functionalities. Each function is loaded as a storyboard for you to play with. |
16 | 15 |
|
17 |
| -Change directory into **macOS** folder, run following command to install project dependencies, |
| 16 | +| Function | Location | |
| 17 | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | |
| 18 | +| Custom audio capture | [CustomAudioSource.swift](./APIExample/Examples/Advanced/CustomAudioSource/CustomAudioSource.swift) | |
| 19 | +| Custom video renderer | [CustomVideoRender.swift](./APIExample/Examples/Advanced/CustomVideoRender/CustomVideoRender.swift) | |
| 20 | +| Raw audio and video frames (Objective-C with C++, uses `AgoraMediaRawData.h` ) | [RawMediaData.swift](./APIExample/Examples/Advanced/RawMediaData/RawMediaData.swift) | |
| 21 | +| Raw audio frames (Native Objective-C interface) | [RawAudioData.swift](./APIExample/Examples/Advanced/RawAudioData/RawAudioData.swift) | |
| 22 | +| Custom video capture (Push) | [CustomVideoSourcePush.swift](./APIExample/Examples/Advanced/CustomVideoSourcePush/CustomVideoSourcePush.swift) | |
| 23 | +| Custom video capture (mediaIO) | [CustomVideoSourceMediaIO.swift](./APIExample/Examples/Advanced/CustomVideoSourceMediaIO/CustomVideoSourceMediaIO.swift) | |
| 24 | +| Join multiple channels | [JoinMultiChannel.swift](.Examples/Advanced/JoinMultiChannel/JoinMultiChannel.swift) | |
| 25 | +| Join an audio channel | [JoinChannelAudio.swift](./APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift) | |
| 26 | +| Join a video channel | [JoinChannelVideo.swift](./APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift) | |
| 27 | +| Play audio files and audio mixing | [AudioMixing.swift](API-Examples/iOS/APIExample/Examples/Advanced/AudioMixing/AudioMixing.swift) | |
| 28 | +| Voice effects | [VoiceChanger.swift](./APIExample/Examples/Advanced/VoiceChanger/VoiceChanger.swift) | |
| 29 | +| RTMP streaming | [RTMPStreaming.swift](./APIExample/Examples/Advanced/RTMPStreaming/RTMPStreaming.swift) | |
| 30 | +| Audio/video stream SDK/custom encryption | [StreamEncryption.swift](./APIExample/Examples/Advanced/StreamEncryption/StreamEncryption.swift) | |
| 31 | +| Pre-call test | [PrecallTest.swift](./APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift) | |
| 32 | +| Use multi-processing to send video streams from screen sharing and local camera | [ScreenShare.swift](./APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift) | |
| 33 | +| Send data stream | [CreateDataStream.swift](./APIExample/Examples/Advanced/CreateDataStream/CreateDataStream.swift) | |
18 | 34 |
|
19 |
| -``` |
20 |
| -pod install |
21 |
| -``` |
| 35 | +### Steps to run |
22 | 36 |
|
23 |
| -Verify `APIExample.xcworkspace` has been properly generated. |
| 37 | +1. Navigate to the **macOS** folder and run following command to install project dependencies: |
24 | 38 |
|
25 |
| -### Obtain an App Id |
26 |
| - |
27 |
| -To build and run the sample application, get an App Id: |
28 |
| - |
29 |
| -1. Create a developer account at [agora.io](https://dashboard.agora.io/signin/). Once you finish the signup process, you will be redirected to the Dashboard. |
30 |
| -2. Navigate in the Dashboard tree on the left to **Projects** > **Project List**. |
31 |
| -3. Save the **App Id** from the Dashboard for later use. |
32 |
| -4. Generate a temp **Access Token** (valid for 24 hours) from dashboard page with given channel name, save for later use. |
| 39 | + ```shell |
| 40 | + $ pod install |
| 41 | + ``` |
33 | 42 |
|
34 |
| -5. Open `APIExample.xcworkspace` and edit the `KeyCenter.swift` file. In the `KeyCenter` struct, update `<#Your App Id#>` with your App Id, and change `<#Temp Access Token#>` with the temp Access Token generated from dashboard. Note you can leave the token variable `nil` if your project has not turned on security token. |
| 43 | +2. Open the generated `APIExample.xcworkspace` file with Xcode. |
| 44 | +3. Edit the `KeyCenter.swift` file. |
| 45 | + - Replace `YOUR APP ID` with your App ID. |
| 46 | + - Replace `<#Temp Access Token#>` with the Access Token. |
35 | 47 |
|
36 |
| - ``` Swift |
| 48 | + ```swift |
37 | 49 | struct KeyCenter {
|
38 |
| - static let AppId: String = <#Your App Id#> |
39 |
| - |
40 |
| - // assign token to nil if you have not enabled app certificate |
41 |
| - static var Token: String? = <#Temp Access Token#> |
| 50 | + static let AppId: String = <#Your App Id#> |
| 51 | +
|
| 52 | + // assign token to nil if you have not enabled app certificate |
| 53 | + static var Token: String? = <#Temp Access Token#> |
42 | 54 | }
|
43 | 55 | ```
|
44 | 56 |
|
45 |
| -You are all set. Now connect your iPhone or iPad device and run the project. |
| 57 | + > See [Set up Authentication](https://docs.agora.io/en/Agora%20Platform/token) to learn how to get an App ID and access token. You can get a temporary access token to quickly try out this sample project. |
| 58 | + > |
| 59 | + > The Channel name you used to generate the token must be the same as the channel name you use to join a channel. |
| 60 | +
|
| 61 | + > To ensure communication security, Agora uses access tokens (dynamic keys) to authenticate users joining a channel. |
| 62 | + > |
| 63 | + > Temporary access tokens are for demonstration and testing purposes only and remain valid for 24 hours. In a production environment, you need to deploy your own server for generating access tokens. See [Generate a Token](https://docs.agora.io/en/Interactive%20Broadcast/token_server) for details. |
| 64 | +
|
| 65 | +4. Build and run the project in your iOS device. |
| 66 | +
|
| 67 | +You are all set! Feel free to play with this sample project and explore features of the Agora RTC SDK. |
| 68 | +
|
| 69 | +## Feedback |
| 70 | +
|
| 71 | +If you have any problems or suggestions regarding the sample projects, feel free to file an issue. |
| 72 | +
|
| 73 | +## Reference |
46 | 74 |
|
47 |
| -> To ensure communication security, Agora uses tokens (dynamic keys) to authenticate users joining a channel. |
48 |
| -> |
49 |
| -> Temporary tokens are for demonstration and testing purposes only and remain valid for 24 hours. In a production environment, you need to deploy your own server for generating tokens. See [Generate a Token](https://docs.agora.io/en/Interactive Broadcast/token_server)for details. |
| 75 | +- [RTC Objective-C SDK Product Overview](https://docs.agora.io/en/Interactive%20Broadcast/product_live?platform=iOS) |
| 76 | +- [RTC Objective-C SDK API Reference](https://docs.agora.io/en/Interactive%20Broadcast/API%20Reference/oc/docs/headers/Agora-Objective-C-API-Overview.html) |
50 | 77 |
|
51 |
| -## Contact Us |
| 78 | +## Related resources |
52 | 79 |
|
53 |
| -- For potential issues, take a look at our [FAQ](https://docs.agora.io/en/faq) first |
| 80 | +- Check our [FAQ](https://docs.agora.io/en/faq) to see if your issue has been recorded. |
54 | 81 | - Dive into [Agora SDK Samples](https://github.com/AgoraIO) to see more tutorials
|
55 | 82 | - Take a look at [Agora Use Case](https://github.com/AgoraIO-usecase) for more complicated real use case
|
56 | 83 | - Repositories managed by developer communities can be found at [Agora Community](https://github.com/AgoraIO-Community)
|
57 |
| -- You can find full API documentation at [Document Center](https://docs.agora.io/en/) |
58 |
| -- If you encounter problems during integration, you can ask question in [Stack Overflow](https://stackoverflow.com/questions/tagged/agora.io) |
59 |
| -- You can file bugs about this sample at [issue](https://github.com/AgoraIO/Basic-Video-Call/issues) |
| 84 | +- If you encounter problems during integration, feel free to ask questions in [Stack Overflow](https://stackoverflow.com/questions/tagged/agora.io) |
60 | 85 |
|
61 | 86 | ## License
|
62 | 87 |
|
63 |
| -The MIT License (MIT) |
| 88 | +The sample projects are under the MIT license. |
0 commit comments