Skip to content

Latest commit

 

History

History
 
 

macOS

API Example macOS

English | 中文

Overview

This repository contains sample projects using the Agora RTC Objective-C SDK for macOS.

api-examples-macos

Project structure

The project uses a single app to combine a variety of functionalities. Each function is loaded as a storyboard for you to play with.

Function Location
Custom audio capture CustomAudioSource.swift
Custom video renderer CustomVideoRender.swift
Raw audio and video frames (Objective-C with C++, uses AgoraMediaRawData.h ) RawMediaData.swift
Raw audio frames (Native Objective-C interface) RawAudioData.swift
Custom video capture (Push) CustomVideoSourcePush.swift
Custom video capture (mediaIO) CustomVideoSourceMediaIO.swift
Join multiple channels JoinMultiChannel.swift
Join an audio channel JoinChannelAudio.swift
Join a video channel JoinChannelVideo.swift
Play audio files and audio mixing AudioMixing.swift
Voice effects VoiceChanger.swift
RTMP streaming RTMPStreaming.swift
Audio/video stream SDK/custom encryption StreamEncryption.swift
Pre-call test PrecallTest.swift
Use multi-processing to send video streams from screen sharing and local camera ScreenShare.swift
Send data stream CreateDataStream.swift

Steps to run

  1. Navigate to the macOS folder and run following command to install project dependencies:

    $ pod install
  2. Open the generated APIExample.xcworkspace file with Xcode.

  3. Edit the KeyCenter.swift file.

    • Replace YOUR APP ID with your App ID.
    • Replace <#Temp Access Token#> with the Access Token.
    struct KeyCenter {
    static let AppId: String = <#Your App Id#>
    
    // assign token to nil if you have not enabled app certificate
    static var Token: String? = <#Temp Access Token#>
    }

    See Set up Authentication 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.

    The Channel name you used to generate the token must be the same as the channel name you use to join a channel.

    To ensure communication security, Agora uses access tokens (dynamic keys) to authenticate users joining a channel.

    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 for details.

  4. Build and run the project in your iOS device.

You are all set! Feel free to play with this sample project and explore features of the Agora RTC SDK.

Feedback

If you have any problems or suggestions regarding the sample projects, feel free to file an issue.

Reference

Related resources

  • 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

License

The sample projects are under the MIT license.