Skip to content

Commit 3c7aadd

Browse files
author
Xia Ning
committed
1. remove rtmp injection in all platforms
2. adapt iPad 3. add rtmp streaming best practice for iOS
1 parent c79f4a9 commit 3c7aadd

24 files changed

Lines changed: 153 additions & 1712 deletions

File tree

Android/APIExample/app/src/main/java/io/agora/api/example/ExampleActivity.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import io.agora.api.example.examples.advanced.SetAudioProfile;
3535
import io.agora.api.example.examples.advanced.MultiProcess;
3636
import io.agora.api.example.examples.advanced.VideoQuickSwitch;
37-
import io.agora.api.example.examples.advanced.RTMPInjection;
3837
import io.agora.api.example.examples.advanced.RTMPStreaming;
3938
import io.agora.api.example.examples.advanced.StreamEncrypt;
4039
import io.agora.api.example.examples.advanced.SwitchCameraScreenShare;
@@ -112,9 +111,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
112111
case R.id.action_mainFragment_to_GeoFencing:
113112
fragment = new GeoFencing();
114113
break;
115-
case R.id.action_mainFragment_to_RTMPInjection:
116-
fragment = new RTMPInjection();
117-
break;
118114
case R.id.action_mainFragment_to_RTMPStreaming:
119115
fragment = new RTMPStreaming();
120116
break;

Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/RTMPInjection.java

Lines changed: 0 additions & 554 deletions
This file was deleted.

Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/RTMPStreaming.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -552,18 +552,6 @@ public void onRtmpStreamingStateChanged(String url, int state, int errCode) {
552552
transCodeSwitch.setEnabled(true);
553553
publishing = false;
554554
});
555-
switch (errCode){
556-
case ERR_FAILED:
557-
case ERR_TIMEDOUT:
558-
case ERR_PUBLISH_STREAM_INTERNAL_SERVER_ERROR:
559-
engine.removePublishStreamUrl(url);
560-
break;
561-
case ERR_PUBLISH_STREAM_NOT_FOUND:
562-
if(retried < MAX_RETRY_TIMES){
563-
engine.addPublishStreamUrl(et_url.getText().toString(), transCodeSwitch.isChecked());
564-
}
565-
break;
566-
}
567555
} else if (state == Constants.RTMP_STREAM_PUBLISH_STATE_IDLE) {
568556
/**Push stream not started or ended, make changes to the UI.*/
569557
publishing = true;
@@ -604,6 +592,21 @@ public void onStreamPublished(String url, int error) {
604592
retried = 0;
605593
retryTask.cancel(true);
606594
}
595+
else{
596+
switch (error){
597+
case ERR_FAILED:
598+
case ERR_TIMEDOUT:
599+
case ERR_PUBLISH_STREAM_INTERNAL_SERVER_ERROR:
600+
engine.removePublishStreamUrl(url);
601+
break;
602+
case ERR_PUBLISH_STREAM_NOT_FOUND:
603+
if(retried < MAX_RETRY_TIMES){
604+
engine.addPublishStreamUrl(et_url.getText().toString(), transCodeSwitch.isChecked());
605+
retried++;
606+
}
607+
break;
608+
}
609+
}
607610
}
608611

609612
/**Occurs when a remote user (Communication)/host (Live Broadcast) joins the channel.

Android/APIExample/app/src/main/res/layout/fragment_rtmp_injection.xml

Lines changed: 0 additions & 42 deletions
This file was deleted.

iOS/APIExample.xcodeproj/project.pbxproj

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@
3737
033A9EFF252D61E200BC26E1 /* CustomVideoSourceMediaIO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033A9EF7252D61E200BC26E1 /* CustomVideoSourceMediaIO.swift */; };
3838
033A9F00252D61E200BC26E1 /* CustomAudioSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033A9EF9252D61E200BC26E1 /* CustomAudioSource.swift */; };
3939
033A9F07252D61FC00BC26E1 /* RawMediaData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033A9F02252D61FB00BC26E1 /* RawMediaData.swift */; };
40-
033A9F08252D61FC00BC26E1 /* RTMPInjection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033A9F04252D61FB00BC26E1 /* RTMPInjection.swift */; };
4140
033A9F09252D61FC00BC26E1 /* RTMPStreaming.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033A9F06252D61FB00BC26E1 /* RTMPStreaming.swift */; };
4241
033A9F23252D70E400BC26E1 /* JoinChannelVideo.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 033A9F25252D70E400BC26E1 /* JoinChannelVideo.storyboard */; };
4342
033A9F2A252D737900BC26E1 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 033A9F2C252D737900BC26E1 /* Localizable.strings */; };
4443
033A9F30252D860100BC26E1 /* JoinChannelAudio.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 033A9F32252D860100BC26E1 /* JoinChannelAudio.storyboard */; };
4544
033A9F35252D896100BC26E1 /* RawMediaData.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 033A9F37252D896100BC26E1 /* RawMediaData.storyboard */; };
46-
033A9F3A252D89A600BC26E1 /* RTMPInjection.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 033A9F3C252D89A600BC26E1 /* RTMPInjection.storyboard */; };
4745
033A9F3F252D89BC00BC26E1 /* RTMPStreaming.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 033A9F41252D89BC00BC26E1 /* RTMPStreaming.storyboard */; };
4846
033A9F48252D89D000BC26E1 /* CustomAudioRender.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 033A9F4A252D89D000BC26E1 /* CustomAudioRender.storyboard */; };
4947
033A9F4D252D89DB00BC26E1 /* CustomAudioSource.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 033A9F4F252D89DB00BC26E1 /* CustomAudioSource.storyboard */; };
@@ -180,7 +178,6 @@
180178
033A9EF7252D61E200BC26E1 /* CustomVideoSourceMediaIO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomVideoSourceMediaIO.swift; sourceTree = "<group>"; };
181179
033A9EF9252D61E200BC26E1 /* CustomAudioSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomAudioSource.swift; sourceTree = "<group>"; };
182180
033A9F02252D61FB00BC26E1 /* RawMediaData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawMediaData.swift; sourceTree = "<group>"; };
183-
033A9F04252D61FB00BC26E1 /* RTMPInjection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RTMPInjection.swift; sourceTree = "<group>"; };
184181
033A9F06252D61FB00BC26E1 /* RTMPStreaming.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RTMPStreaming.swift; sourceTree = "<group>"; };
185182
033A9F22252D70C400BC26E1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
186183
033A9F24252D70E400BC26E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/JoinChannelVideo.storyboard; sourceTree = "<group>"; };
@@ -190,8 +187,6 @@
190187
033A9F34252D860900BC26E1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/JoinChannelAudio.strings"; sourceTree = "<group>"; };
191188
033A9F36252D896100BC26E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/RawMediaData.storyboard; sourceTree = "<group>"; };
192189
033A9F39252D896A00BC26E1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/RawMediaData.strings"; sourceTree = "<group>"; };
193-
033A9F3B252D89A600BC26E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/RTMPInjection.storyboard; sourceTree = "<group>"; };
194-
033A9F3E252D89AC00BC26E1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/RTMPInjection.strings"; sourceTree = "<group>"; };
195190
033A9F40252D89BC00BC26E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/RTMPStreaming.storyboard; sourceTree = "<group>"; };
196191
033A9F43252D89C200BC26E1 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/RTMPStreaming.strings"; sourceTree = "<group>"; };
197192
033A9F44252D89C800BC26E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/JoinMultiChannel.storyboard; sourceTree = "<group>"; };
@@ -522,15 +517,6 @@
522517
path = RawMediaData;
523518
sourceTree = "<group>";
524519
};
525-
033A9F03252D61FB00BC26E1 /* RTMPInjection */ = {
526-
isa = PBXGroup;
527-
children = (
528-
033A9F04252D61FB00BC26E1 /* RTMPInjection.swift */,
529-
033A9F3C252D89A600BC26E1 /* RTMPInjection.storyboard */,
530-
);
531-
path = RTMPInjection;
532-
sourceTree = "<group>";
533-
};
534520
033A9F05252D61FB00BC26E1 /* RTMPStreaming */ = {
535521
isa = PBXGroup;
536522
children = (
@@ -827,7 +813,6 @@
827813
03FB5B2F25642E7C00F04ED0 /* LiveStreaming */,
828814
0364C1F52551AD6D00C6C0AE /* ARKit */,
829815
033A9F01252D61FB00BC26E1 /* RawMediaData */,
830-
033A9F03252D61FB00BC26E1 /* RTMPInjection */,
831816
033A9F05252D61FB00BC26E1 /* RTMPStreaming */,
832817
033A9EE8252D5F5E00BC26E1 /* JoinMultiChannel */,
833818
033A9EED252D61E200BC26E1 /* CustomAudioRender */,
@@ -975,7 +960,6 @@
975960
03B12DAC251127DC00E55818 /* VideoViewMetal.xib in Resources */,
976961
033A9F89252D8B6C00BC26E1 /* PrecallTest.storyboard in Resources */,
977962
033A9F61252D8B0A00BC26E1 /* VideoMetadata.storyboard in Resources */,
978-
033A9F3A252D89A600BC26E1 /* RTMPInjection.storyboard in Resources */,
979963
033A9F3F252D89BC00BC26E1 /* RTMPStreaming.storyboard in Resources */,
980964
033A9F2A252D737900BC26E1 /* Localizable.strings in Resources */,
981965
033A9F7F252D8B5900BC26E1 /* AudioMixing.storyboard in Resources */,
@@ -1142,7 +1126,6 @@
11421126
578AA65C259A05B200D7CAD9 /* CreateDataStream.swift in Sources */,
11431127
03D13BD02448758900B599B3 /* AppDelegate.swift in Sources */,
11441128
0385768225224A88003C369A /* JoinChannelVideo.swift in Sources */,
1145-
033A9F08252D61FC00BC26E1 /* RTMPInjection.swift in Sources */,
11461129
A7847F922458062900469187 /* StatisticsInfo.swift in Sources */,
11471130
0339BE72251EF075007D4FDD /* MediaPlayer.swift in Sources */,
11481131
0364C2032551B19800C6C0AE /* ARVideoRenderer.swift in Sources */,
@@ -1201,15 +1184,6 @@
12011184
name = RawMediaData.storyboard;
12021185
sourceTree = "<group>";
12031186
};
1204-
033A9F3C252D89A600BC26E1 /* RTMPInjection.storyboard */ = {
1205-
isa = PBXVariantGroup;
1206-
children = (
1207-
033A9F3B252D89A600BC26E1 /* Base */,
1208-
033A9F3E252D89AC00BC26E1 /* zh-Hans */,
1209-
);
1210-
name = RTMPInjection.storyboard;
1211-
sourceTree = "<group>";
1212-
};
12131187
033A9F41252D89BC00BC26E1 /* RTMPStreaming.storyboard */ = {
12141188
isa = PBXVariantGroup;
12151189
children = (
@@ -1432,9 +1406,10 @@
14321406
baseConfigurationReference = FAAC2AEE355D103B9E8527B5 /* Pods-Agora-ScreenShare-Extension.debug.xcconfig */;
14331407
buildSettings = {
14341408
CLANG_ENABLE_MODULES = YES;
1435-
CODE_SIGN_IDENTITY = "Apple Development: Qianze Zhang (3C9KJFP729)";
1409+
CODE_SIGN_IDENTITY = "iPhone Developer";
14361410
CODE_SIGN_STYLE = Manual;
1437-
DEVELOPMENT_TEAM = GM72UGLGZW;
1411+
CURRENT_PROJECT_VERSION = 2;
1412+
DEVELOPMENT_TEAM = 5459N9W32M;
14381413
FRAMEWORK_SEARCH_PATHS = (
14391414
"$(inherited)",
14401415
"$(PROJECT_DIR)/APIExample",
@@ -1450,7 +1425,8 @@
14501425
"$(inherited)",
14511426
"$(PROJECT_DIR)/Agora-ScreenShare-Extension",
14521427
);
1453-
PRODUCT_BUNDLE_IDENTIFIER = "io.agora.api.example.Agora-ScreenShare-Extension";
1428+
MARKETING_VERSION = 1.0.1;
1429+
PRODUCT_BUNDLE_IDENTIFIER = io.agora.api.example.collection.screensharing;
14541430
PRODUCT_NAME = "$(TARGET_NAME)";
14551431
PROVISIONING_PROFILE_SPECIFIER = App;
14561432
SKIP_INSTALL = YES;
@@ -1466,9 +1442,10 @@
14661442
baseConfigurationReference = 92EACE913B50B28F1588FE03 /* Pods-Agora-ScreenShare-Extension.release.xcconfig */;
14671443
buildSettings = {
14681444
CLANG_ENABLE_MODULES = YES;
1469-
CODE_SIGN_IDENTITY = "Apple Development: Qianze Zhang (3C9KJFP729)";
1445+
CODE_SIGN_IDENTITY = "iPhone Developer";
14701446
CODE_SIGN_STYLE = Manual;
1471-
DEVELOPMENT_TEAM = GM72UGLGZW;
1447+
CURRENT_PROJECT_VERSION = 2;
1448+
DEVELOPMENT_TEAM = 5459N9W32M;
14721449
FRAMEWORK_SEARCH_PATHS = (
14731450
"$(inherited)",
14741451
"$(PROJECT_DIR)/APIExample",
@@ -1484,7 +1461,8 @@
14841461
"$(inherited)",
14851462
"$(PROJECT_DIR)/Agora-ScreenShare-Extension",
14861463
);
1487-
PRODUCT_BUNDLE_IDENTIFIER = "io.agora.api.example.Agora-ScreenShare-Extension";
1464+
MARKETING_VERSION = 1.0.1;
1465+
PRODUCT_BUNDLE_IDENTIFIER = io.agora.api.example.collection.screensharing;
14881466
PRODUCT_NAME = "$(TARGET_NAME)";
14891467
PROVISIONING_PROFILE_SPECIFIER = App;
14901468
SKIP_INSTALL = YES;
@@ -1617,9 +1595,10 @@
16171595
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
16181596
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
16191597
CLANG_ENABLE_MODULES = YES;
1620-
CODE_SIGN_IDENTITY = "Apple Development: Qianze Zhang (3C9KJFP729)";
1598+
CODE_SIGN_IDENTITY = "iPhone Developer";
16211599
CODE_SIGN_STYLE = Manual;
1622-
DEVELOPMENT_TEAM = GM72UGLGZW;
1600+
CURRENT_PROJECT_VERSION = 2;
1601+
DEVELOPMENT_TEAM = 5459N9W32M;
16231602
FRAMEWORK_SEARCH_PATHS = (
16241603
"$(inherited)",
16251604
"$(PROJECT_DIR)/APIExample",
@@ -1630,7 +1609,8 @@
16301609
"$(inherited)",
16311610
"@executable_path/Frameworks",
16321611
);
1633-
PRODUCT_BUNDLE_IDENTIFIER = io.agora.api.example;
1612+
MARKETING_VERSION = 1.0.1;
1613+
PRODUCT_BUNDLE_IDENTIFIER = io.agora.api.example.collection;
16341614
PRODUCT_NAME = "$(TARGET_NAME)";
16351615
PROVISIONING_PROFILE_SPECIFIER = App;
16361616
SWIFT_OBJC_BRIDGING_HEADER = "APIExample/APIExample-Bridging-Header.h";
@@ -1647,9 +1627,10 @@
16471627
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
16481628
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
16491629
CLANG_ENABLE_MODULES = YES;
1650-
CODE_SIGN_IDENTITY = "Apple Development: Qianze Zhang (3C9KJFP729)";
1630+
CODE_SIGN_IDENTITY = "iPhone Developer";
16511631
CODE_SIGN_STYLE = Manual;
1652-
DEVELOPMENT_TEAM = GM72UGLGZW;
1632+
CURRENT_PROJECT_VERSION = 2;
1633+
DEVELOPMENT_TEAM = 5459N9W32M;
16531634
FRAMEWORK_SEARCH_PATHS = (
16541635
"$(inherited)",
16551636
"$(PROJECT_DIR)/APIExample",
@@ -1660,7 +1641,8 @@
16601641
"$(inherited)",
16611642
"@executable_path/Frameworks",
16621643
);
1663-
PRODUCT_BUNDLE_IDENTIFIER = io.agora.api.example;
1644+
MARKETING_VERSION = 1.0.1;
1645+
PRODUCT_BUNDLE_IDENTIFIER = io.agora.api.example.collection;
16641646
PRODUCT_NAME = "$(TARGET_NAME)";
16651647
PROVISIONING_PROFILE_SPECIFIER = App;
16661648
SWIFT_OBJC_BRIDGING_HEADER = "APIExample/APIExample-Bridging-Header.h";

iOS/APIExample/Common/Settings/SettingsCells.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class SettingsSelectCell : SettingsBaseCell
113113
}
114114

115115
@IBAction func onSelect(_ sender:UIButton) {
116-
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
116+
let alert = UIAlertController(title: nil, message: nil, preferredStyle: UIDevice.current.userInterfaceIdiom == .pad ? UIAlertController.Style.alert : UIAlertController.Style.actionSheet)
117117
guard let param = configs as? SettingsSelectParam else {return}
118118
for option in param.settingItem.options {
119119
alert.addAction(getSelectAction(option))

iOS/APIExample/Examples/Advanced/AudioMixing/AudioMixing.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class AudioMixingEntry : UIViewController
5757
}
5858

5959
@IBAction func setAudioProfile(){
60-
let alert = UIAlertController(title: "Set Audio Profile".localized, message: nil, preferredStyle: .actionSheet)
60+
let alert = UIAlertController(title: "Set Audio Profile".localized, message: nil, preferredStyle: UIDevice.current.userInterfaceIdiom == .pad ? UIAlertController.Style.alert : UIAlertController.Style.actionSheet)
6161
for profile in AgoraAudioProfile.allValues(){
6262
alert.addAction(getAudioProfileAction(profile))
6363
}
@@ -66,7 +66,7 @@ class AudioMixingEntry : UIViewController
6666
}
6767

6868
@IBAction func setAudioScenario(){
69-
let alert = UIAlertController(title: "Set Audio Scenario".localized, message: nil, preferredStyle: .actionSheet)
69+
let alert = UIAlertController(title: "Set Audio Scenario".localized, message: nil, preferredStyle: UIDevice.current.userInterfaceIdiom == .pad ? UIAlertController.Style.alert : UIAlertController.Style.actionSheet)
7070
for scenario in AgoraAudioScenario.allValues(){
7171
alert.addAction(getAudioScenarioAction(scenario))
7272
}

iOS/APIExample/Examples/Advanced/LiveStreaming/LiveStreaming.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LiveStreamingEntry : UIViewController
3434
channelTextField.resignFirstResponder()
3535

3636
//display role picker
37-
let alert = UIAlertController(title: "Pick Role".localized, message: nil, preferredStyle: .actionSheet)
37+
let alert = UIAlertController(title: "Pick Role".localized, message: nil, preferredStyle: UIDevice.current.userInterfaceIdiom == .pad ? UIAlertController.Style.alert : UIAlertController.Style.actionSheet)
3838
alert.addAction(getRoleAction(.broadcaster))
3939
alert.addAction(getRoleAction(.audience))
4040
alert.addCancelAction()

0 commit comments

Comments
 (0)