please select
RTC Engine
  • Overview
  • Web
    • Run Sample Demo
    • Integration
    • Basic Features
      • Screen Sharing
      • Live Streaming
      • Media Device
      • Audio Volume
      • Set Encoding Profile
      • Detect Network Quality
      • Detect Capabilities
    • Advance Features
      • Enable AI Denoiser
      • Enable Audio Mixer
      • Enable Watermark
      • Enable Virtual Background
      • Enable Beauty and Effects
      • Data Messages
      • Custom Capturing and Rendering
    • API List
    • Released Notes
    • Supported Platforms
    • Web FAQs
      • Optimize Multi-Person Video Calls
      • Handle Autoplay Restriction
      • Handle Firewall Restriction
      • Others
  • Android
    • Run Sample Code
    • Integration
      • 1.Importing the SDK
      • 2.Entering a Room
      • 3.Subscribing to Audio/Video Streams
      • 4.Publish Audio/Video Streams
      • 5.Exiting a Room
      • 6.Sensing Network Quality
      • 7.Enabling Screen Sharing
      • 8.Setting Video Quality
      • 9.Rotating Videos
    • Testing Newwork Quality
    • Custom Capturing and Rendering
    • Custom Audio Capturing and Playback
    • Client APIs
      • Overview
      • TRTCCloud
      • TRTCStatistics
      • TRTCCloudListener
      • TXAudioEffectManager
      • TXBeautyManager
      • TXDeviceManager
      • Type Definition
      • Deprecated Interface
      • Error Codes
    • Solution
      • Real-Time Chorus (TUIKaraoke)
        • Quick Integration
        • Implementation Steps
        • Song Synchronization
        • Lyric Synchronization
        • Vocal Synchronization
        • Mixing Stream Solution
        • TRTCKaraoke APIs
        • FAQs
    • Release Notes
  • iOS
    • Run Sample Code
    • Integration
      • 1.Importing the SDK
      • 2.Entering a Room
      • 3.Subscribing to Audio/Video Streams
      • 4.Publish Audio/Video Streams
      • 5.Exiting a Room
      • 6.Sensing Network Quality
      • 7.Enabling Screen Sharing
      • 8.Setting Video Quality
      • 9.Rotating Videos
    • Testing Network Quality
    • Custom Capturing and Rendering
    • Custom Audio Capturing and Playback
    • Client APIs
      • Overview
      • TRTCCloud
      • TRTCCloudDelegate
      • TRTCStatistics
      • TXAudioEffectManager
      • TXBeautyManager
      • TXDeviceManager
      • Type Definition
      • Deprecated Interface
      • ErrorCode
    • Solution
      • Quick Integration
      • Implementation Steps
      • Song Synchronization
      • Lyric Synchronization
      • Vocal Synchronization
      • Mixing Stream Solution
      • TRTCKaraoke APIs
      • FAQs
    • Release Notes
  • macOS
    • Run Sample Code
    • Integration
      • 1.Importing the SDK
      • 2.Entering a Room
      • 3.Subscribing to Audio/Video Streams
      • 4.Publish Audio/Video Streams
      • 5.Exiting a Room
      • 6.Sensing Network Quality
      • 7.Enabling Screen Sharing
      • 8.Sharing Computer Audio
      • 9.Setting Video Quality
      • 10.Rotating Videos
    • Testing Hardware Devices
    • Testing Network Quality
    • Custom Capturing and Rendering
    • Custom Audio Capturing and Playback
    • Client APIs
      • Overview
      • TRTCCloud
      • TRTCCloudDelegate
      • TRTCStatistics
      • TXAudioEffectManager
      • TXBeautyManager
      • TXDeviceManager
      • Type Definition
      • Deprecated Interface
      • ErrorCode
      • Release Notes
    • Release Notes
  • Windows
    • Run Sample Code
    • Integration
      • 1.Importing the SDK
      • 2.Entering a Room
      • 3.Subscribing to Audio/Video Streams
      • 4.Publish Audio/Video Streams
      • 5.Exiting a Room
      • 6.Sensing Network Quality
      • 7.Enabling Screen Sharing
      • 8.Setting Video Quality
      • 9.Rotating Videos
    • Testing Hardware Devices
    • Testing Network Quality
    • Custom Capturing and Rendering
    • Custom Audio Capturing and Playback
    • Client APIs
      • Overview
      • ITRTCCloud
      • ITRTCStatistics
      • TRTCCloudCallback
      • ITXAudioEffectManager
      • ITXDeviceManager
      • Type Definition
      • Deprecated Interface
      • Error Codes
    • Release Notes
  • Electron
    • Integration
      • 1.API Examples
      • 2.Importing the SDK
      • 3.Entering a Room
      • 4.Subscribing to Audio/Video Streams
      • 5.Publish Audio/Video Streams
      • 6.Exiting a Room
      • 7.Sensing Network Quality
      • 8.Enabling Screen Sharing
      • 9.Sharing Computer Audio
      • 10.Setting Video Quality
      • 11.Rotating Videos
    • Client APIs
      • Overview
      • Error Codes
  • Flutter
    • Integration
      • 1.API Examples
      • 2.Importing the SDK
      • 3.Entering a Room
      • 4.Subscribing to Audio/Video Streams
      • 5.Publish Audio/Video Streams
      • 6.Exiting a Room
      • 7.Sensing Network Quality
      • 8.Enabling Screen Sharing
      • 9.Sharing Computer Audio
      • 10.Setting Video Quality
      • 11.Rotating Videos
    • Client APIs
      • Overview
      • Error Codes
  • Unity
    • Integration
      • 1.API Examples
      • 2Importing the SDK
    • Client APIs
      • Overview
      • Error Codes
  • Qt
    • Integration
      • 1.Importing the SDK
  • Overview
    • Overview
  • Concepts
  • Features
  • Performance Statistics
  • Pricing
    • Free Minutes
    • RTC-Engine Monthly Packages
    • Billing Explanation for Subscription Package Duration
    • Pay-as-you-go
      • Billing of Audio and Video Duration
      • Billing of On-Cloud Recording and Recording Delivery
      • Billing of MixTranscoding and Relay to CDN
  • FAQs
    • FAQs for Beginners
    • Migration Guide
      • Twilio Video to Tencent RTC
      • Billing
      • Features
      • UserSig
      • Firewall Restrictions
      • How to Downsize Installation Package
      • TRTCCalling for Web
      • Audio and Video Quality
      • Others
RTC Engine

1.Importing the SDK

This document describes how to quickly integrate the TRTC macOS SDK into your project.



Environment Requirements

Xcode 9.0 or later
A Mac computer with OS X 10.10 or later
A valid developer signature for your project

Step 1. Import the SDK

You can use CocoaPods to automatically load the SDK or download and import it manually into your project.

Method 1. Use CocoaPods

1. Install CocoaPods. Enter the following command in a terminal window (you need to install Ruby on your Mac first):
sudo gem install cocoapods
2. Create a Podfile. Go to the directory of your project and enter the following command to create a Podfile in the directory.
pod init
3. Edit the Podfile. There are two ways to edit the Podfile:
Method 1: Use the pod path of the LiteAV SDK
platform :osx, '10.10'

target 'Your Target' do
pod 'TXLiteAVSDK_TRTC_Mac', :podspec => 'https://liteav.sdk.qcloud.com/pod/liteavsdkspec/TXLiteAVSDK_TRTC_Mac.podspec'
end
Method 2: Use CocoaPod's official source, which allows version selection
platform :osx, '10.10'
source 'https://github.com/CocoaPods/Specs.git'

target 'Your Target' do
pod 'TXLiteAVSDK_TRTC_Mac'
end
4. Install and update the SDK.
Enter the following command in a terminal window to install the SDK.
pod install
Or, run this command to update the local repository:
pod update
An XCWORKSPACE project file integrated with LiteAVSDK will be generated. Double-click to open the file.

Method 2. Manually integrate

1. Download the TRTC macOS SDK.
2. Open your Xcode project and import into it the framework downloaded in step 1.
3. Select the target you want to run and click Build Phases.



4. Expand Link Binary With Libraries and click the + icon at the bottom to add dependent libraries.



5. Add the downloaded SDK framework and its required dependencies in sequence: TXFFmpeg.xcframework, TXSoundTouch.xcframework, libc++.tbd, Accelerate.framework, SystemConfiguration.framework, MetalKit.framework.If it is successful, you will see the following:




Step 2. Configure app permissions

To use the audio/video features of the SDK, you need to grant it mic and camera permissions. Add the two items below to Info.plist of your application. Their content is what users see in the mic and camera access pop-up windows.
Privacy - Microphone Usage Description. Include a statement specifying why mic access is needed
Privacy - Camera Usage Description. Include a statement specifying why camera access is needed As shown below:



If App Sandbox or Hardened Runtime is enabled for your application, select Network, Camera, and Audio Input.
For App Sandbox:



For Hardened Runtime:




Step 3. Using the SDK in your project

After completing the first step of importing and the second step of granting device permissions, you can use the APIs provided by the SDK in your project.

Using Objective-C or Swift APIs

There are two ways to use the SDK in Objective-C or Swift:
Import the module: Import the SDK module in the files that will use the SDK APIs.
@import TXLiteAVSDK_TRTC_Mac;
Import the header file: Import the header file in the files that will use the SDK APIs.
#import TXLiteAVSDK_TRTC_Mac/TRTCCloud.h

Using C++ APIs (optional)

1. Import the header file: If you want to use C++ APIs to develop your macOS application, import the header file in the TXLiteAVSDK_TRTC_Mac.framework/Headers/cpp_interface directory.
#include TXLiteAVSDK_TRTC_Mac/cpp_interface/ITRTCCloud.h
2. Use the namespace: The cross-platform C++ APIs and types are all defined in the TRTC namespace, which you can use directly. This method can simplify your code and is recommended.
using namespace trtc;
Note:
For more information on how to use C++ APIs, see Overview.