Skip to content

Commit b592577

Browse files
committed
fix: audio source fixed
1 parent ab74cc4 commit b592577

4 files changed

Lines changed: 47 additions & 21 deletions

File tree

iOS/APIExample-Audio/APIExample-Audio.xcodeproj/project.pbxproj

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 51;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -982,12 +982,10 @@
982982
CLANG_ENABLE_MODULES = YES;
983983
CODE_SIGN_ENTITLEMENTS = "";
984984
CODE_SIGN_IDENTITY = "Apple Development";
985-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
986-
CODE_SIGN_STYLE = Manual;
985+
CODE_SIGN_STYLE = Automatic;
987986
CURRENT_PROJECT_VERSION = 2;
988987
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
989-
DEVELOPMENT_TEAM = "";
990-
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = JDPG69R49Z;
988+
DEVELOPMENT_TEAM = YS397FG5PA;
991989
ENABLE_BITCODE = NO;
992990
FRAMEWORK_SEARCH_PATHS = (
993991
"$(inherited)",
@@ -1038,7 +1036,6 @@
10381036
PRODUCT_BUNDLE_IDENTIFIER = io.agora.api.examples.audio;
10391037
PRODUCT_NAME = "$(TARGET_NAME)";
10401038
PROVISIONING_PROFILE_SPECIFIER = "";
1041-
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = AgoraLab2020;
10421039
SWIFT_OBJC_BRIDGING_HEADER = "APIExample-Audio/APIExample-Bridging-Header.h";
10431040
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
10441041
SWIFT_VERSION = 5.0;
@@ -1056,11 +1053,9 @@
10561053
CLANG_ENABLE_MODULES = YES;
10571054
CODE_SIGN_ENTITLEMENTS = "";
10581055
CODE_SIGN_IDENTITY = "Apple Development";
1059-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1060-
CODE_SIGN_STYLE = Manual;
1056+
CODE_SIGN_STYLE = Automatic;
10611057
CURRENT_PROJECT_VERSION = 2;
1062-
DEVELOPMENT_TEAM = "";
1063-
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = JDPG69R49Z;
1058+
DEVELOPMENT_TEAM = YS397FG5PA;
10641059
ENABLE_BITCODE = NO;
10651060
FRAMEWORK_SEARCH_PATHS = (
10661061
"$(inherited)",
@@ -1111,7 +1106,6 @@
11111106
PRODUCT_BUNDLE_IDENTIFIER = io.agora.api.examples.audio;
11121107
PRODUCT_NAME = "$(TARGET_NAME)";
11131108
PROVISIONING_PROFILE_SPECIFIER = "";
1114-
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = AgoraLab2020;
11151109
SWIFT_OBJC_BRIDGING_HEADER = "APIExample-Audio/APIExample-Bridging-Header.h";
11161110
SWIFT_VERSION = 5.0;
11171111
TARGETED_DEVICE_FAMILY = "1,2";

iOS/APIExample/APIExample/Examples/Advanced/CustomPcmAudioSource/Base.lproj/CustomPcmAudioSource.storyboard

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_1" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
88
<capability name="System colors in document resources" minToolsVersion="11.0"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -18,7 +18,7 @@
1818
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1919
<subviews>
2020
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lC2-dZ-ofF">
21-
<rect key="frame" x="20" y="293.5" width="374" height="138"/>
21+
<rect key="frame" x="20" y="295" width="374" height="138"/>
2222
<subviews>
2323
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter channel name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="SdL-FU-6ht" userLabel="channelName">
2424
<rect key="frame" x="37.5" y="20" width="299" height="34"/>
@@ -70,7 +70,7 @@
7070
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
7171
<subviews>
7272
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="a0t-ZI-lHz" userLabel="pcm">
73-
<rect key="frame" x="0.0" y="632" width="414" height="48"/>
73+
<rect key="frame" x="0.0" y="633" width="414" height="48"/>
7474
<subviews>
7575
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Push PCM" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dbo-LJ-5lv">
7676
<rect key="frame" x="20" y="16" width="62.5" height="16"/>
@@ -90,19 +90,41 @@
9090
<constraint firstItem="dV6-q6-Gqm" firstAttribute="centerY" secondItem="a0t-ZI-lHz" secondAttribute="centerY" id="1ke-Ze-5Yg"/>
9191
<constraint firstAttribute="trailing" secondItem="dV6-q6-Gqm" secondAttribute="trailing" constant="20" id="BwJ-mH-gcE"/>
9292
<constraint firstItem="dV6-q6-Gqm" firstAttribute="centerY" secondItem="Dbo-LJ-5lv" secondAttribute="centerY" id="Tce-t9-8sl"/>
93+
<constraint firstItem="dV6-q6-Gqm" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Dbo-LJ-5lv" secondAttribute="trailing" constant="8" symbolic="YES" id="bdQ-Sc-Zh4"/>
9394
<constraint firstAttribute="height" constant="48" id="gMu-3X-Ejl"/>
9495
<constraint firstItem="Dbo-LJ-5lv" firstAttribute="leading" secondItem="a0t-ZI-lHz" secondAttribute="leading" constant="20" id="ykF-lp-vEa"/>
9596
</constraints>
9697
</view>
9798
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6aN-r3-OBp" userLabel="mic">
98-
<rect key="frame" x="0.0" y="680" width="414" height="48"/>
99+
<rect key="frame" x="0.0" y="681" width="414" height="48"/>
100+
<subviews>
101+
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="2th-LX-ugB">
102+
<rect key="frame" x="345" y="8" width="51" height="32"/>
103+
<connections>
104+
<action selector="pushMicrophone:" destination="wEj-TK-x0n" eventType="valueChanged" id="SQ0-gC-2Cf"/>
105+
</connections>
106+
</switch>
107+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Push Microphone" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3Sp-t2-4ZJ" userLabel="Push Microphone">
108+
<rect key="frame" x="19" y="15" width="106" height="18"/>
109+
<fontDescription key="fontDescription" type="system" pointSize="13"/>
110+
<nil key="textColor"/>
111+
<nil key="highlightedColor"/>
112+
</label>
113+
</subviews>
99114
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
100115
<constraints>
101116
<constraint firstAttribute="height" constant="48" id="2K6-1p-G5S"/>
117+
<constraint firstAttribute="trailing" secondItem="2th-LX-ugB" secondAttribute="trailing" constant="20" id="4ah-Fm-UGP"/>
118+
<constraint firstItem="3Sp-t2-4ZJ" firstAttribute="centerY" secondItem="2th-LX-ugB" secondAttribute="centerY" id="FNf-GW-5sM"/>
119+
<constraint firstItem="3Sp-t2-4ZJ" firstAttribute="top" secondItem="6aN-r3-OBp" secondAttribute="top" constant="15" id="N4p-jC-NET"/>
120+
<constraint firstItem="2th-LX-ugB" firstAttribute="top" secondItem="6aN-r3-OBp" secondAttribute="topMargin" id="NFK-L9-gNC"/>
121+
<constraint firstItem="2th-LX-ugB" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3Sp-t2-4ZJ" secondAttribute="trailing" constant="8" symbolic="YES" id="Zi2-Tk-iuF"/>
122+
<constraint firstItem="2th-LX-ugB" firstAttribute="centerY" secondItem="6aN-r3-OBp" secondAttribute="centerY" id="ePY-DC-OMx"/>
123+
<constraint firstItem="3Sp-t2-4ZJ" firstAttribute="leading" secondItem="6aN-r3-OBp" secondAttribute="leading" constant="19" id="r6z-OE-ha4"/>
102124
</constraints>
103125
</view>
104126
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dyj-wd-Iae" customClass="AGEVideoContainer" customModule="AGEVideoLayout">
105-
<rect key="frame" x="0.0" y="44" width="414" height="540"/>
127+
<rect key="frame" x="0.0" y="48" width="414" height="537"/>
106128
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
107129
</view>
108130
</subviews>
@@ -123,6 +145,7 @@
123145
</view>
124146
<connections>
125147
<outlet property="container" destination="Dyj-wd-Iae" id="YY7-wi-33p"/>
148+
<outlet property="pushMicrophoneSwitch" destination="2th-LX-ugB" id="T0r-uv-ZMs"/>
126149
<outlet property="pushPcmSwitch" destination="dV6-q6-Gqm" id="9b8-1h-vN4"/>
127150
</connections>
128151
</viewController>

iOS/APIExample/APIExample/Examples/Advanced/CustomPcmAudioSource/CustomPcmAudioSource.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ class CustomPcmAudioSourceMain: BaseViewController {
4141
var audioViews: [UInt: VideoView] = [:]
4242
@IBOutlet weak var playAudioView: UIView!
4343
@IBOutlet weak var pushPcmSwitch: UISwitch!
44+
@IBOutlet weak var pushMicrophoneSwitch: UISwitch!
4445
private var trackId: Int32 = 0
4546

4647
// indicate if current instance has joined channel
4748
var isJoined: Bool = false {
4849
didSet {
4950
pushPcmSwitch.isEnabled = isJoined
51+
pushMicrophoneSwitch.isEnabled = pushPcmSwitch.isEnabled
5052
}
5153
}
5254

@@ -96,9 +98,6 @@ class CustomPcmAudioSourceMain: BaseViewController {
9698
let option = AgoraRtcChannelMediaOptions()
9799
option.publishCameraTrack = false
98100
option.publishMicrophoneTrack = false
99-
option.publishCustomAudioTrack = GlobalSettings.shared.getUserRole() == .broadcaster
100-
option.publishCustomAudioTrackId = Int(trackId)
101-
option.clientRoleType = GlobalSettings.shared.getUserRole()
102101
NetworkManager.shared.generateToken(channelName: channelName, success: { token in
103102
let result = self.agoraKit.joinChannel(byToken: token, channelId: channelName, uid: 0, mediaOptions: option)
104103
if result != 0 {
@@ -135,6 +134,13 @@ class CustomPcmAudioSourceMain: BaseViewController {
135134
}
136135
let mediaOption = AgoraRtcChannelMediaOptions()
137136
mediaOption.publishCustomAudioTrack = sender.isOn
137+
mediaOption.publishCustomAudioTrackId = Int(trackId)
138+
agoraKit.updateChannel(with: mediaOption)
139+
}
140+
141+
@IBAction func pushMicrophone(_ sender: UISwitch) {
142+
let mediaOption = AgoraRtcChannelMediaOptions()
143+
mediaOption.publishMicrophoneTrack = sender.isOn
138144
agoraKit.updateChannel(with: mediaOption)
139145
}
140146
}

iOS/APIExample/APIExample/Examples/Advanced/CustomPcmAudioSource/zh-Hans.lproj/CustomPcmAudioSource.strings

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"Cwr-m3-kGh.text" = "麦克风";
77

88
/* Class = "UILabel"; text = "Push PCM"; ObjectID = "Dbo-LJ-5lv"; */
9-
"Dbo-LJ-5lv.text" = "播放 PCM";
9+
"Dbo-LJ-5lv.text" = "发布本地音频";
10+
11+
/* Class = "UILabel"; text = "Push Microphone"; ObjectID = "3Sp-t2-4ZJ"; */
12+
"3Sp-t2-4ZJ.text" = "发布麦克风";
1013

1114
/* Class = "UITextField"; placeholder = "Enter channel name"; ObjectID = "SdL-FU-6ht"; */
1215
"SdL-FU-6ht.placeholder" = "输入频道名";

0 commit comments

Comments
 (0)