From 86145df1cdb3902b0c0ecef9c6d52ea224e322e9 Mon Sep 17 00:00:00 2001 From: xianing Date: Wed, 17 Nov 2021 10:40:40 +0800 Subject: [PATCH 1/7] add echotest and screenshare by displayid feature for windows --- windows/APIExample/APIExample/APIExample.rc | 8 ++- .../ProcessScreenShare.vcxproj | 2 +- .../PreCallTest/CAgoraPreCallTestDlg.cpp | 39 ++++++++++++ .../PreCallTest/CAgoraPreCallTestDlg.h | 6 ++ .../ScreenShare/AgoraScreenCapture.cpp | 62 +++++++++++++------ windows/APIExample/APIExample/Language.h | 3 + windows/APIExample/APIExample/en.ini | 3 + windows/APIExample/APIExample/resource.h | 6 +- windows/APIExample/APIExample/stdafx.cpp | 6 ++ windows/APIExample/APIExample/zh-cn.ini | 3 + 10 files changed, 113 insertions(+), 25 deletions(-) diff --git a/windows/APIExample/APIExample/APIExample.rc b/windows/APIExample/APIExample/APIExample.rc index 0d5ffc281..84419dc2b 100644 --- a/windows/APIExample/APIExample/APIExample.rc +++ b/windows/APIExample/APIExample/APIExample.rc @@ -475,9 +475,11 @@ BEGIN CONTROL "",IDC_SLIDER_INPUT_VOL,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,106,39,226,15 CONTROL "",IDC_SLIDER_OUTPUT_VOL,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,106,74,224,15 PUSHBUTTON "Set AudioProfile",IDC_BUTTON_AUDIO_OUTPUT_TEST,337,60,60,14 - LTEXT "camera",IDC_STATIC_CAMERA,66,101,34,8 - COMBOBOX IDC_COMBO_VIDEO,110,99,218,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Set AudioProfile",IDC_BUTTON_CAMERA,337,98,60,14 + LTEXT "camera",IDC_STATIC_CAMERA,66,93,34,8 + COMBOBOX IDC_COMBO_VIDEO,110,91,218,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Set AudioProfile",IDC_BUTTON_CAMERA,337,90,60,14 + PUSHBUTTON "Start Audio Call Loop Test",IDC_BUTTON_ECHO_TEST1,110,111,94,14 + PUSHBUTTON "Start Audio and Video Call Loop Test",IDC_BUTTON_ECHO_TEST2,273,110,124,14 END IDD_DIALOG_VOLUME DIALOGEX 0, 0, 632, 400 diff --git a/windows/APIExample/APIExample/Advanced/MultiVideoSource/ProcessScreenShare/ProcessScreenShare.vcxproj b/windows/APIExample/APIExample/Advanced/MultiVideoSource/ProcessScreenShare/ProcessScreenShare.vcxproj index 6f5c3ceb8..4cb80f7d5 100644 --- a/windows/APIExample/APIExample/Advanced/MultiVideoSource/ProcessScreenShare/ProcessScreenShare.vcxproj +++ b/windows/APIExample/APIExample/Advanced/MultiVideoSource/ProcessScreenShare/ProcessScreenShare.vcxproj @@ -14,7 +14,7 @@ {2B345C3C-4BEA-4DA3-B754-43F9AD219D4A} ProcessScreenShare MFCProj - 8.1 + 10.0.17763.0 diff --git a/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.cpp b/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.cpp index ab90f4843..cddd68aa2 100644 --- a/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.cpp @@ -32,6 +32,8 @@ void CAgoraPreCallTestDlg::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_BUTTON_AUDIO_INPUT_TEST, m_btnAudioInputTest); DDX_Control(pDX, IDC_BUTTON_AUDIO_OUTPUT_TEST, m_btnAudioOutputTest); DDX_Control(pDX, IDC_BUTTON_CAMERA, m_btnVideoTest); + DDX_Control(pDX, IDC_BUTTON_ECHO_TEST1, m_btnEchoTest1); + DDX_Control(pDX, IDC_BUTTON_ECHO_TEST2, m_btnEchoTest2); DDX_Control(pDX, IDC_STATIC_VIDEO, m_staVideoArea); DDX_Control(pDX, IDC_LIST_INFO_BROADCASTING, m_lstInfo); DDX_Control(pDX, IDC_STATIC_DETAIL, m_staDetails); @@ -50,6 +52,8 @@ BEGIN_MESSAGE_MAP(CAgoraPreCallTestDlg, CDialogEx) ON_MESSAGE(WM_MSGID(EID_LASTMILE_QUAILTY), &CAgoraPreCallTestDlg::OnEIDLastmileQuality) ON_MESSAGE(WM_MSGID(EID_AUDIO_VOLUME_INDICATION), &CAgoraPreCallTestDlg::OnEIDAudioVolumeIndication) ON_WM_PAINT() + ON_BN_CLICKED(IDC_BUTTON_ECHO_TEST1, &CAgoraPreCallTestDlg::OnEchoTest1) + ON_BN_CLICKED(IDC_BUTTON_ECHO_TEST2, &CAgoraPreCallTestDlg::OnEchoTest2) END_MESSAGE_MAP() //init ctrl text. @@ -63,6 +67,8 @@ void CAgoraPreCallTestDlg::InitCtrlText() m_btnAudioInputTest.SetWindowText(PerCallTestCtrlStartTest); m_btnAudioOutputTest.SetWindowText(PerCallTestCtrlStartTest); m_btnVideoTest.SetWindowText(PerCallTestCtrlStartTest); + m_btnEchoTest2.SetWindowText(PerCallTestCtrlStartEchoTest); + m_btnEchoTest1.SetWindowText(PerCallTestCtrlStartEchoTest1); } //Initialize the Agora SDK @@ -131,6 +137,7 @@ void CAgoraPreCallTestDlg::ResumeStatus() m_cameraTest = false; m_audioInputTest = false; m_audioOutputTest = false; + m_echoTest = false; } @@ -380,3 +387,35 @@ void CAgoraPreCallTestDlg::OnPaint() //draw quality bitmap m_imgNetQuality.Draw(&dc, m_netQuality, CPoint(16, 40), ILD_NORMAL); } + + +void CAgoraPreCallTestDlg::OnEchoTest1() +{ + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("Start Audio Call Loop Test.")); + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("You will hear your voice after 10 secs")); + m_rtcEngine->startEchoTest(10); +} + + +void CAgoraPreCallTestDlg::OnEchoTest2() +{ + if (!m_echoTest) + { + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("Start Audio and Video Call Loop Test.")); + EchoTestConfiguration config; + config.channelId = "randomChannel"; + config.enableAudio = true; + config.enableVideo = true; + config.view = m_VideoTest.GetVideoSafeHwnd(); + m_rtcEngine->startEchoTest(config); + m_echoTest = true; + m_btnEchoTest2.SetWindowText(PerCallTestCtrlStopEchoTest); + } + else + { + m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("Stop Audio and Video Call Loop Test.")); + m_rtcEngine->stopEchoTest(); + m_echoTest = false; + m_btnEchoTest2.SetWindowText(PerCallTestCtrlStartEchoTest); + } +} diff --git a/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.h b/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.h index e9d45a1b9..90b1a6446 100644 --- a/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.h +++ b/windows/APIExample/APIExample/Advanced/PreCallTest/CAgoraPreCallTestDlg.h @@ -99,6 +99,7 @@ class CAgoraPreCallTestDlg : public CDialogEx bool m_audioInputTest; bool m_audioOutputTest; bool m_cameraTest; + bool m_echoTest; protected: virtual void DoDataExchange(CDataExchange* pDX); @@ -131,7 +132,12 @@ class CAgoraPreCallTestDlg : public CDialogEx CButton m_btnAudioInputTest; CButton m_btnAudioOutputTest; CButton m_btnVideoTest; + CButton m_btnEchoTest1; + CButton m_btnEchoTest2; CStatic m_staVideoArea; CListBox m_lstInfo; CStatic m_staDetails; + afx_msg void OnBnClickedButtonCamera2(); + afx_msg void OnEchoTest1(); + afx_msg void OnEchoTest2(); }; diff --git a/windows/APIExample/APIExample/Advanced/ScreenShare/AgoraScreenCapture.cpp b/windows/APIExample/APIExample/Advanced/ScreenShare/AgoraScreenCapture.cpp index 47187396c..e9dfdf1c6 100644 --- a/windows/APIExample/APIExample/Advanced/ScreenShare/AgoraScreenCapture.cpp +++ b/windows/APIExample/APIExample/Advanced/ScreenShare/AgoraScreenCapture.cpp @@ -334,25 +334,40 @@ BOOL CAgoraScreenCapture::OnInitDialog() void CAgoraScreenCapture::InitMonitorInfos() { - m_monitors.EnumMonitor(); - - std::vector infos = m_monitors.GetMonitors(); - CString str = _T(""); - for (size_t i = 0; i < infos.size(); i++) { - RECT rcMonitor = infos[i].monitorInfo.rcMonitor; - CString strInfo; - strInfo.Format(_T("Screen%d: rect = {%d, %d, %d, %d} ") - , i + 1, rcMonitor.left, rcMonitor.top, rcMonitor.right, rcMonitor.bottom); - if (rcMonitor.left < 0 || rcMonitor.top < 0) {//negative coordinate is not supported + if (!m_rtcEngine || !m_initialize) + return; + CString str = _T(""); + m_monitors.EnumMonitor(); + /* + + std::vector infos = m_monitors.GetMonitors(); + for (size_t i = 0; i < infos.size(); i++) { + RECT rcMonitor = infos[i].monitorInfo.rcMonitor; + CString strInfo; + strInfo.Format(_T("Screen%d: rect = {%d, %d, %d, %d} ") + , i + 1, rcMonitor.left, rcMonitor.top, rcMonitor.right, rcMonitor.bottom); + if (rcMonitor.left < 0 || rcMonitor.top < 0) {//negative coordinate is not supported strInfo += _T("not support negative cordinate;"); str += strInfo; continue; } - str += strInfo; - m_cmbScreenRegion.InsertString(i, utf82cs(infos[i].monitorName)); - } - - m_cmbScreenRegion.InsertString(infos.size(), _T("Select Window Hwnd Rect Area")); + str += strInfo; + m_cmbScreenRegion.InsertString(i, utf82cs(infos[i].monitorName)); + } + */ + SIZE size; + size.cx = 100; + size.cy = 100; + IScreenCaptureSourceList* infos = m_rtcEngine->getScreenCaptureSources(size, size, true); + int count = 0; + for (size_t i = 0; i < infos->getCount(); i++) { + ScreenCaptureSourceInfo info = infos->getSourceInfo(i); + if (info.type == ScreenCaptureSourceType_Screen) { + m_cmbScreenRegion.InsertString(i, utf82cs(info.sourceName)); + count++; + } + } + m_cmbScreenRegion.InsertString(count, _T("Select Window Hwnd Rect Area")); m_staScreenInfo.SetWindowText(str); m_cmbScreenRegion.SetCurSel(0); } @@ -440,6 +455,7 @@ void CAgoraScreenCapture::OnShowWindow(BOOL bShow, UINT nStatus) if (bShow) { RenderLocalVideo(); ReFreshWnd(); + InitMonitorInfos(); } else { ResumeStatus(); @@ -840,12 +856,20 @@ void CAgoraScreenCapture::OnBnClickedButtonStartShareScreen() { m_screenShare = !m_screenShare; if (m_screenShare) { + agora::rtc::Rectangle regionRect = { 0,0,0,0 }, screenRegion = { 0,0,0,0 }; int sel = m_cmbScreenRegion.GetCurSel(); - agora::rtc::Rectangle regionRect = { 0,0,0,0 }, screenRegion = {0,0,0,0}; if (sel < m_monitors.GetMonitorCount()) - {//share screen rect area - regionRect = m_monitors.GetMonitorRectangle(sel); - screenRegion = m_monitors.GetScreenRect(); + {//share screen by display id + SIZE size; + size.cx = 100; + size.cy = 100; + IScreenCaptureSourceList* infos = m_rtcEngine->getScreenCaptureSources(size, size, true); + ScreenCaptureSourceInfo info = infos->getSourceInfo(sel); + ScreenCaptureParameters capParam; + m_rtcEngine->startScreenCaptureByDisplayId((int)info.sourceId, regionRect, capParam); + m_btnShareScreen.SetWindowText(screenShareCtrlStopShare); + m_btnStartCap.EnableWindow(FALSE); + return; } else { // get selected window HWND diff --git a/windows/APIExample/APIExample/Language.h b/windows/APIExample/APIExample/Language.h index f9fdca064..2707688fe 100644 --- a/windows/APIExample/APIExample/Language.h +++ b/windows/APIExample/APIExample/Language.h @@ -250,6 +250,9 @@ extern wchar_t PerCallTestCtrlAudioVol[INFO_LEN]; extern wchar_t PerCallTestCtrlCamera[INFO_LEN]; extern wchar_t PerCallTestCtrlStartTest[INFO_LEN]; extern wchar_t PerCallTestCtrlStopTest[INFO_LEN]; +extern wchar_t PerCallTestCtrlStartEchoTest[INFO_LEN]; +extern wchar_t PerCallTestCtrlStartEchoTest1[INFO_LEN]; +extern wchar_t PerCallTestCtrlStopEchoTest[INFO_LEN]; //audio volume extern wchar_t AudioVolumeCtrlCapVol[INFO_LEN]; diff --git a/windows/APIExample/APIExample/en.ini b/windows/APIExample/APIExample/en.ini index 2a9be9d3e..48c08eb75 100644 --- a/windows/APIExample/APIExample/en.ini +++ b/windows/APIExample/APIExample/en.ini @@ -205,6 +205,9 @@ PerCallTest.Ctrl.AudioVol=Audio Vol PerCallTest.Ctrl.Camera=Camera PerCallTest.Ctrl.StartTest=Start Test PerCallTest.Ctrl.StopTest=Stop Test +PerCallTest.Ctrl.StartEchoTest=Start audio and video call loop Test +PerCallTest.Ctrl.StopEchoTest=Stop audio and video call loop Test +PerCallTest.Ctrl.StartEchoTest1=Start audio call loop Test AudioVolume.Ctrl.AudioCapVol=AudioCapVol AudioVolume.Ctrl.AudioCapSigVol=AudioCapSigVol diff --git a/windows/APIExample/APIExample/resource.h b/windows/APIExample/APIExample/resource.h index 6116a82bd..09cc9c968 100644 --- a/windows/APIExample/APIExample/resource.h +++ b/windows/APIExample/APIExample/resource.h @@ -242,6 +242,7 @@ #define IDC_STATIC_PLAYBACK_VOL 1125 #define IDC_STATIC_PLAYBACK_VOL_SIGNAL 1126 #define IDC_STATIC_SPEAKER_INFO 1127 +#define IDC_BUTTON_ECHO_TEST1 1128 #define IDC_STATIC_TXBYTES_RXBTYES 1130 #define IDC_STATIC_TXBYTES_RXBYTES_VAL 1131 #define IDC_STATIC_BITRATE_ALL_VAL 1132 @@ -298,7 +299,8 @@ #define IDC_COMBO_COLOR 1177 #define IDC_BUTTON_IMAGE 1178 #define IDC_EDIT1 1179 -#define IDC_EDIT_IMAGE_PATH 1179 +#define IDC_EDIT_IMAGE_PATH 1180 +#define IDC_BUTTON_ECHO_TEST2 1181 // Next default values for new objects // @@ -306,7 +308,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 139 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1180 +#define _APS_NEXT_CONTROL_VALUE 1182 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/windows/APIExample/APIExample/stdafx.cpp b/windows/APIExample/APIExample/stdafx.cpp index 93dc928be..2bd134fbd 100644 --- a/windows/APIExample/APIExample/stdafx.cpp +++ b/windows/APIExample/APIExample/stdafx.cpp @@ -221,6 +221,9 @@ wchar_t PerCallTestCtrlAudioVol[INFO_LEN] = { 0 }; wchar_t PerCallTestCtrlCamera[INFO_LEN] = { 0 }; wchar_t PerCallTestCtrlStartTest[INFO_LEN] = { 0 }; wchar_t PerCallTestCtrlStopTest[INFO_LEN] = { 0 }; +wchar_t PerCallTestCtrlStartEchoTest[INFO_LEN] = { 0 }; +wchar_t PerCallTestCtrlStartEchoTest1[INFO_LEN] = { 0 }; +wchar_t PerCallTestCtrlStopEchoTest[INFO_LEN] = { 0 }; //audio volume wchar_t AudioVolumeCtrlCapVol[INFO_LEN] = { 0 }; @@ -592,6 +595,9 @@ void InitKeyInfomation() _tcscpy_s(PerCallTestCtrlCamera, INFO_LEN, Str(_T("PerCallTest.Ctrl.Camera"))); _tcscpy_s(PerCallTestCtrlStartTest, INFO_LEN, Str(_T("PerCallTest.Ctrl.StartTest"))); _tcscpy_s(PerCallTestCtrlStopTest, INFO_LEN, Str(_T("PerCallTest.Ctrl.StopTest"))); + _tcscpy_s(PerCallTestCtrlStartEchoTest, INFO_LEN, Str(_T("PerCallTest.Ctrl.StartEchoTest"))); + _tcscpy_s(PerCallTestCtrlStartEchoTest1, INFO_LEN, Str(_T("PerCallTest.Ctrl.StartEchoTest1"))); + _tcscpy_s(PerCallTestCtrlStopEchoTest, INFO_LEN, Str(_T("PerCallTest.Ctrl.StopEchoTest"))); _tcscpy_s(AudioVolumeCtrlCapVol, INFO_LEN, Str(_T("AudioVolume.Ctrl.AudioCapVol"))); _tcscpy_s(AudioVolumeCtrlCapSigVol, INFO_LEN, Str(_T("AudioVolume.Ctrl.AudioCapSigVol"))); diff --git a/windows/APIExample/APIExample/zh-cn.ini b/windows/APIExample/APIExample/zh-cn.ini index 3cd09561b..c198e3295 100644 --- a/windows/APIExample/APIExample/zh-cn.ini +++ b/windows/APIExample/APIExample/zh-cn.ini @@ -219,6 +219,9 @@ PerCallTest.Ctrl.AudioVol= PerCallTest.Ctrl.Camera=摄像头 PerCallTest.Ctrl.StartTest=开始测试 PerCallTest.Ctrl.StopTest=停止测试 +PerCallTest.Ctrl.StartEchoTest=开始音视频通话回路测试 +PerCallTest.Ctrl.StopEchoTest=停止音视频通话回路测试 +PerCallTest.Ctrl.StartEchoTest1=开始音频通话回路测试 AudioVolume.Ctrl.AudioCapVol=音频录制音量 From 80b8a649d113dcf0582f5e26183c365b2611b6f3 Mon Sep 17 00:00:00 2001 From: xianing Date: Wed, 17 Nov 2021 12:57:57 +0800 Subject: [PATCH 2/7] add echotest feature for ios --- .../Base.lproj/PrecallTest.storyboard | 41 ++++++++++++++----- .../Advanced/PrecallTest/PrecallTest.swift | 25 ++++++++++- .../zh-Hans.lproj/PrecallTest.strings | 8 +++- .../zh-Hans.lproj/Localizable.strings | 4 ++ 4 files changed, 65 insertions(+), 13 deletions(-) diff --git a/iOS/APIExample/Examples/Advanced/PrecallTest/Base.lproj/PrecallTest.storyboard b/iOS/APIExample/Examples/Advanced/PrecallTest/Base.lproj/PrecallTest.storyboard index a5bcfd576..cc66cb6ed 100644 --- a/iOS/APIExample/Examples/Advanced/PrecallTest/Base.lproj/PrecallTest.storyboard +++ b/iOS/APIExample/Examples/Advanced/PrecallTest/Base.lproj/PrecallTest.storyboard @@ -1,9 +1,9 @@ - + - + @@ -18,42 +18,49 @@ - + + + + + @@ -146,11 +160,15 @@ + + + + @@ -159,11 +177,12 @@ + - + diff --git a/iOS/APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift b/iOS/APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift index 28f4fe135..e51198640 100644 --- a/iOS/APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift +++ b/iOS/APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift @@ -13,7 +13,9 @@ class PrecallTestEntry : UIViewController { var agoraKit: AgoraRtcEngineKit! var timer:Timer? + var echoTesting:Bool = false @IBOutlet weak var lastmileBtn: UIButton! + @IBOutlet weak var echoTestBtn: UIButton! @IBOutlet weak var lastmileResultLabel: UILabel! @IBOutlet weak var lastmileProbResultLabel: UILabel! @IBOutlet weak var lastmileActivityView: UIActivityIndicatorView! @@ -21,6 +23,7 @@ class PrecallTestEntry : UIViewController @IBOutlet weak var echoTestPopover: UIView! @IBOutlet weak var echoValidateCountDownLabel: UILabel! @IBOutlet weak var echoValidatePopover: UIView! + @IBOutlet weak var preview: UIView! override func viewDidLoad() { super.viewDidLoad() @@ -56,7 +59,7 @@ class PrecallTestEntry : UIViewController } @IBAction func doEchoTest(sender: UIButton) { - agoraKit.startEchoTest(withInterval: 10) + agoraKit.startEchoTest(withInterval: 10, successBlock: nil) showPopover(isValidate: false, seconds: 10) {[unowned self] in self.showPopover(isValidate: true, seconds: 10) {[unowned self] in self.agoraKit.stopEchoTest() @@ -64,6 +67,26 @@ class PrecallTestEntry : UIViewController } } + @IBAction func doEchoVideoTest(sender: UIButton) { + if(echoTesting){ + agoraKit.stopEchoTest() + echoTestBtn.title = "Start Video/Audio Test".localized + echoTesting = false + } + else{ + let config = AgoraEchoTestConfiguration() + echoTestBtn.title = "Stop Video/Audio Test".localized + config.channelId = "randomChannel" + config.view = self.preview + config.enableAudio = true + config.enableVideo = true + agoraKit.startEchoTest(withConfig: config) + echoTesting = true + } + } + + + // show popover and hide after seconds func showPopover(isValidate:Bool, seconds:Int, callback:@escaping (() -> Void)) { var count = seconds diff --git a/iOS/APIExample/Examples/Advanced/PrecallTest/zh-Hans.lproj/PrecallTest.strings b/iOS/APIExample/Examples/Advanced/PrecallTest/zh-Hans.lproj/PrecallTest.strings index 44c425bc8..3ca5ec8e3 100644 --- a/iOS/APIExample/Examples/Advanced/PrecallTest/zh-Hans.lproj/PrecallTest.strings +++ b/iOS/APIExample/Examples/Advanced/PrecallTest/zh-Hans.lproj/PrecallTest.strings @@ -18,7 +18,13 @@ "e83-fp-COE.text" = "闊抽缃戠粶鍥炶矾娴嬭瘯"; /* Class = "UIButton"; normalTitle = "Start"; ObjectID = "eol-rm-UUy"; */ -"eol-rm-UUy.normalTitle" = "寮濮"; +"eol-rm-UUy.normalTitle" = "寮濮嬮煶棰戞祴璇"; /* Class = "UILabel"; text = "Please say something.."; ObjectID = "tFL-Md-flt"; */ "tFL-Md-flt.text" = "灏濊瘯璇翠竴浜涜瘽.."; + +/* Class = "UIButton"; normalTitle = "Start Video/Audio Test"; ObjectID = "LsR-bv-XiY"; */ +"LsR-bv-XiY.normalTitle" = "寮濮嬮煶瑙嗛娴嬭瘯"; + +/* Class = "UIButton"; normalTitle = "Start Audio Test"; ObjectID = "eol-rm-UUy"; */ +"eol-rm-UUy.normalTitle" = "寮濮嬮煶棰戞祴璇"; diff --git a/iOS/APIExample/zh-Hans.lproj/Localizable.strings b/iOS/APIExample/zh-Hans.lproj/Localizable.strings index 865c99d91..53e35c092 100644 --- a/iOS/APIExample/zh-Hans.lproj/Localizable.strings +++ b/iOS/APIExample/zh-Hans.lproj/Localizable.strings @@ -117,3 +117,7 @@ "Sweet" = "鐢滅編"; "Solid" = "绋抽噸"; "Bass" = "閲嶄綆闊"; +"Start Audio Test" = "寮濮嬮煶棰戞祴璇"; +"Stop Audio Test" = "鍋滄闊抽娴嬭瘯"; +"Start Video/Audio Test" = "寮濮嬮煶瑙嗛娴嬭瘯"; +"Stop Video/Audio Test" = "鍋滄闊宠棰戞祴璇"; From ba309ab9c5644ba4f43f7519880290a43cb1c72a Mon Sep 17 00:00:00 2001 From: xianing Date: Wed, 17 Nov 2021 14:18:15 +0800 Subject: [PATCH 3/7] add echotest, getscreenshare sources feature for macos --- .../Base.lproj/PrecallTest.storyboard | 26 ++++++++++++++++--- .../Advanced/PrecallTest/PrecallTest.swift | 21 +++++++++++++++ .../Advanced/ScreenShare/ScreenShare.swift | 7 +++-- macOS/APIExample/Localizable.strings | 2 ++ 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/macOS/APIExample/Examples/Advanced/PrecallTest/Base.lproj/PrecallTest.storyboard b/macOS/APIExample/Examples/Advanced/PrecallTest/Base.lproj/PrecallTest.storyboard index 5362eeae2..42084d28c 100644 --- a/macOS/APIExample/Examples/Advanced/PrecallTest/Base.lproj/PrecallTest.storyboard +++ b/macOS/APIExample/Examples/Advanced/PrecallTest/Base.lproj/PrecallTest.storyboard @@ -1,8 +1,8 @@ - + - + @@ -108,7 +108,7 @@ + @@ -234,6 +248,7 @@ + @@ -255,6 +270,7 @@ + @@ -264,6 +280,7 @@ + @@ -276,6 +293,7 @@ + diff --git a/macOS/APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift b/macOS/APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift index af62e24b7..1dd491038 100644 --- a/macOS/APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift +++ b/macOS/APIExample/Examples/Advanced/PrecallTest/PrecallTest.swift @@ -12,6 +12,7 @@ import AGEVideoLayout class PrecallTest: BaseViewController { var videos: [VideoView] = [] var timer:Timer? + var echoTesting:Bool = false @IBOutlet weak var cameraPicker: NSPopUpButton! @IBOutlet weak var micPicker: NSPopUpButton! @@ -25,6 +26,7 @@ class PrecallTest: BaseViewController { @IBOutlet weak var startLoopbackTestBtn: NSButton! @IBOutlet weak var stopLoopbackTestBtn: NSButton! @IBOutlet weak var startLastmileTestBtn: NSButton! + @IBOutlet weak var echoTestBtn: NSButton! @IBOutlet weak var lastmileResultLabel: NSTextField! @IBOutlet weak var lastmileProbResultLabel: NSTextField! @IBOutlet weak var lastmileActivityView: NSProgressIndicator! @@ -105,6 +107,7 @@ class PrecallTest: BaseViewController { super.viewDidLoad() layoutVideos() + echoTestBtn.title = "Start Video/Audio Test".localized // set up agora instance when view loaded let config = AgoraRtcEngineConfig() @@ -218,6 +221,24 @@ class PrecallTest: BaseViewController { } } + @IBAction func doEchoVideoTest(sender: NSButton) { + if(echoTesting){ + agoraKit.stopEchoTest() + echoTestBtn.title = "Start Video/Audio Test".localized + echoTesting = false + } + else{ + let config = AgoraEchoTestConfiguration() + echoTestBtn.title = "Stop Video/Audio Test".localized + config.channelId = "randomChannel" + config.view = videos[0] + config.enableAudio = true + config.enableVideo = true + agoraKit.startEchoTest(withConfig: config) + echoTesting = true + } + } + // show popover and hide after seconds func showPopover(isValidate:Bool, seconds:Int, callback:@escaping (() -> Void)) { var count = seconds diff --git a/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift b/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift index d702b2fa8..feaa4ca29 100644 --- a/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift +++ b/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift @@ -170,9 +170,12 @@ class ScreenShare: BaseViewController { } } func initSelectScreenPicker() { - screenlist = windowManager.items.filter({$0.type == .screen}) + let size = NSSize(width: 100, height: 100) + let screens = agoraKit.getScreenCaptureSources(withThumbSize: size, iconSize: size, includeScreen: true) + screens.map { sources in + selectScreenPicker.picker.addItems(withTitles: sources.filter{ $0.type == .screen }.map {"\($0.sourceName)(\($0.sourceId))"}) + } selectScreenPicker.label.stringValue = "Screen Share".localized - selectScreenPicker.picker.addItems(withTitles: screenlist.map {"\($0.name ?? "Unknown")(\($0.id))"}) } var isScreenSharing: Bool = false { didSet { diff --git a/macOS/APIExample/Localizable.strings b/macOS/APIExample/Localizable.strings index b4b11dfc8..b52135e82 100644 --- a/macOS/APIExample/Localizable.strings +++ b/macOS/APIExample/Localizable.strings @@ -162,3 +162,5 @@ "Image Background" = "鍥剧墖鑳屾櫙"; "Virtual Background" = "铏氭嫙鑳屾櫙"; "Blur Background" = "鑳屾櫙铏氬寲"; +"Start Video/Audio Echo Test" = "寮濮嬮煶瑙嗛鍥炶矾娴嬭瘯"; +"Stop Video/Audio Echo Test" = "鍋滄闊宠棰戝洖璺祴璇"; From 7dacdd7e0a80a488470ea1af16c7fefc3f3f57f3 Mon Sep 17 00:00:00 2001 From: xianing Date: Wed, 17 Nov 2021 18:17:18 +0800 Subject: [PATCH 4/7] add echotest feature for android --- .../examples/advanced/PreCallTest.java | 66 +++++++++++++------ .../main/res/layout/fragment_precall_test.xml | 24 +++++-- .../app/src/main/res/values-zh/strings.xml | 6 ++ .../app/src/main/res/values/strings.xml | 6 ++ 4 files changed, 78 insertions(+), 24 deletions(-) diff --git a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java index af92d1098..e1e438d36 100644 --- a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java +++ b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java @@ -7,9 +7,11 @@ import android.os.Message; import android.util.Log; import android.view.LayoutInflater; +import android.view.SurfaceView; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.FrameLayout; import android.widget.TextView; import android.widget.Toast; @@ -28,6 +30,7 @@ import io.agora.rtc.IRtcEngineEventHandler; import io.agora.rtc.RtcEngine; import io.agora.rtc.internal.LastmileProbeConfig; +import io.agora.rtc.models.EchoTestConfiguration; import static io.agora.api.example.common.model.Examples.ADVANCED; @@ -43,13 +46,15 @@ public class PreCallTest extends BaseFragment implements View.OnClickListener { private RtcEngine engine; private int myUid; - private Button btn_lastmile, btn_echo; + private Button btn_lastmile, btn_echo, btn_echoVideo; + private FrameLayout preview; private StatisticsInfo statisticsInfo; private TextView lastmileQuality, lastmileResult; private static final Integer MAX_COUNT_DOWN = 8; private int num; private Timer timer; private TimerTask task; + private boolean echoTesting = false; @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -81,8 +86,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) { * The SDK uses this class to report to the app on SDK runtime events.*/ String appId = getString(R.string.agora_app_id); engine = RtcEngine.create(getContext().getApplicationContext(), appId, iRtcEngineEventHandler); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); getActivity().onBackPressed(); } @@ -94,26 +98,27 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat statisticsInfo = new StatisticsInfo(); btn_echo = view.findViewById(R.id.btn_echo); btn_echo.setOnClickListener(this); + btn_echoVideo = view.findViewById(R.id.btn_echoVideoTest); + btn_echoVideo.setOnClickListener(this); btn_lastmile = view.findViewById(R.id.btn_lastmile); btn_lastmile.setOnClickListener(this); lastmileQuality = view.findViewById(R.id.lastmile_quality); lastmileResult = view.findViewById(R.id.lastmile_result); - task = new TimerTask(){ + preview = view.findViewById(R.id.echoTestView); + task = new TimerTask() { public void run() { num++; - if(num >= MAX_COUNT_DOWN * 2){ + if (num >= MAX_COUNT_DOWN * 2) { handler.post(() -> { btn_echo.setEnabled(true); - btn_echo.setText("Start"); + btn_echo.setText(getString(R.string.start_echo_audio_test)); }); engine.stopEchoTest(); timer.cancel(); task.cancel(); - } - else if(num >= MAX_COUNT_DOWN) { + } else if (num >= MAX_COUNT_DOWN) { handler.post(() -> btn_echo.setText("PLaying with " + (MAX_COUNT_DOWN * 2 - num) + "Seconds")); - } - else{ + } else { handler.post(() -> btn_echo.setText("Recording with " + (MAX_COUNT_DOWN - num) + "Seconds")); } } @@ -122,12 +127,12 @@ else if(num >= MAX_COUNT_DOWN) { @Override public void onClick(View v) { - if (v.getId() == R.id.btn_lastmile) - { + if (v.getId() == R.id.btn_lastmile) { // Configure a LastmileProbeConfig instance. - LastmileProbeConfig config = new LastmileProbeConfig(){}; + LastmileProbeConfig config = new LastmileProbeConfig() { + }; // Probe the uplink network quality. - config.probeUplink = true; + config.probeUplink = true; // Probe the downlink network quality. config.probeDownlink = true; // The expected uplink bitrate (bps). The value range is [100000, 5000000]. @@ -138,14 +143,35 @@ public void onClick(View v) { engine.startLastmileProbeTest(config); btn_lastmile.setEnabled(false); btn_lastmile.setText("Testing ..."); - } - else if (v.getId() == R.id.btn_echo){ + } else if (v.getId() == R.id.btn_echo) { num = 0; engine.startEchoTest(MAX_COUNT_DOWN); btn_echo.setEnabled(false); btn_echo.setText("Recording on Microphone ..."); timer = new Timer(true); timer.schedule(task, 1000, 1000); + } else if (v.getId() == R.id.btn_echoVideoTest) { + if (!echoTesting) { + SurfaceView surfaceView = RtcEngine.CreateRendererView(getContext()); + // Add to the local container + preview.addView(surfaceView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + EchoTestConfiguration config = new EchoTestConfiguration(); + config.enableAudio = true; + config.enableVideo = true; + config.channelId = "randomChannel"; + config.view = surfaceView; + engine.startEchoTest(config); + echoTesting = true; + btn_echoVideo.setText(getText(R.string.stop_echo_video_audio_test)); + } else { + engine.stopEchoTest(); + if(preview.getChildCount() > 0) + { + preview.removeAllViews(); + } + echoTesting = false; + btn_echoVideo.setText(getText(R.string.start_echo_video_audio_test)); + } } } @@ -263,7 +289,7 @@ public void onUserOffline(int uid, int reason) { * @param quality */ @Override - public void onLastmileQuality(int quality){ + public void onLastmileQuality(int quality) { statisticsInfo.setLastMileQuality(quality); updateLastMileResult(); } @@ -281,17 +307,17 @@ public void onLastmileProbeResult(LastmileProbeResult lastmileProbeResult) { updateLastMileResult(); handler.post(() -> { btn_lastmile.setEnabled(true); - btn_lastmile.setText("Start"); + btn_lastmile.setText(getString(R.string.start)); }); } }; private void updateLastMileResult() { handler.post(() -> { - if(statisticsInfo.getLastMileQuality() != null){ + if (statisticsInfo.getLastMileQuality() != null) { lastmileQuality.setText("Quality: " + statisticsInfo.getLastMileQuality()); } - if(statisticsInfo.getLastMileResult() != null){ + if (statisticsInfo.getLastMileResult() != null) { lastmileResult.setText(statisticsInfo.getLastMileResult()); } }); diff --git a/Android/APIExample/app/src/main/res/layout/fragment_precall_test.xml b/Android/APIExample/app/src/main/res/layout/fragment_precall_test.xml index 7c688fe61..e11b2289b 100755 --- a/Android/APIExample/app/src/main/res/layout/fragment_precall_test.xml +++ b/Android/APIExample/app/src/main/res/layout/fragment_precall_test.xml @@ -23,7 +23,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" - android:text="Lastmile Network Pretest" /> + android:text="@string/lastmile_network_pretest" /> + android:text="@string/start" /> + android:text="@string/echo_pretest" /> + android:text="@string/start_echo_audio_test" /> + + + + diff --git a/Android/APIExample/app/src/main/res/values-zh/strings.xml b/Android/APIExample/app/src/main/res/values-zh/strings.xml index 10ad6ca50..f2ac1eff4 100644 --- a/Android/APIExample/app/src/main/res/values-zh/strings.xml +++ b/Android/APIExample/app/src/main/res/values-zh/strings.xml @@ -154,4 +154,10 @@ 闊宠建鍒囨崲(%d) 涓婁竴涓 涓嬩竴涓 + 寮濮嬮煶瑙嗛娴嬭瘯 + 寮濮嬮煶棰戞祴璇 + 鍋滄闊宠棰戞祴璇 + 鍋滄闊抽娴嬭瘯 + 缃戠粶鍥炶矾娴嬭瘯 + 缃戠粶寤惰繜娴嬭瘯 \ No newline at end of file diff --git a/Android/APIExample/app/src/main/res/values/strings.xml b/Android/APIExample/app/src/main/res/values/strings.xml index c2c5f1b2d..e7a31d8dc 100644 --- a/Android/APIExample/app/src/main/res/values/strings.xml +++ b/Android/APIExample/app/src/main/res/values/strings.xml @@ -158,4 +158,10 @@ change track(%d) LAST NEXT + Start Echo Video/Audio Test + Start Echo Audio Test + Stop Echo Video/Audio Test + Stop Echo Audio Test + Echo Test + Lastmile Network Pretest From 5836d3c3bde3e27986aa3e1ed3e6ba89a7b5f06a Mon Sep 17 00:00:00 2001 From: xianing Date: Thu, 18 Nov 2021 18:33:00 +0800 Subject: [PATCH 5/7] fix bugs --- .../examples/advanced/PreCallTest.java | 42 ++++++++++--------- .../Advanced/ScreenShare/ScreenShare.swift | 15 +++---- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java index e1e438d36..79cd3d2a6 100644 --- a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java +++ b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java @@ -105,24 +105,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat lastmileQuality = view.findViewById(R.id.lastmile_quality); lastmileResult = view.findViewById(R.id.lastmile_result); preview = view.findViewById(R.id.echoTestView); - task = new TimerTask() { - public void run() { - num++; - if (num >= MAX_COUNT_DOWN * 2) { - handler.post(() -> { - btn_echo.setEnabled(true); - btn_echo.setText(getString(R.string.start_echo_audio_test)); - }); - engine.stopEchoTest(); - timer.cancel(); - task.cancel(); - } else if (num >= MAX_COUNT_DOWN) { - handler.post(() -> btn_echo.setText("PLaying with " + (MAX_COUNT_DOWN * 2 - num) + "Seconds")); - } else { - handler.post(() -> btn_echo.setText("Recording with " + (MAX_COUNT_DOWN - num) + "Seconds")); - } - } - }; } @Override @@ -148,7 +130,8 @@ public void onClick(View v) { engine.startEchoTest(MAX_COUNT_DOWN); btn_echo.setEnabled(false); btn_echo.setText("Recording on Microphone ..."); - timer = new Timer(true); + timer = new Timer(false); + task = new TimerProcess(); timer.schedule(task, 1000, 1000); } else if (v.getId() == R.id.btn_echoVideoTest) { if (!echoTesting) { @@ -323,4 +306,23 @@ private void updateLastMileResult() { }); } -} + class TimerProcess extends TimerTask { + @Override + public void run() { + num++; + if (num >= MAX_COUNT_DOWN * 2) { + handler.post(() -> { + btn_echo.setEnabled(true); + btn_echo.setText(getString(R.string.start_echo_audio_test)); + }); + engine.stopEchoTest(); + task.cancel(); + } else if (num >= MAX_COUNT_DOWN) { + handler.post(() -> btn_echo.setText("PLaying with " + (MAX_COUNT_DOWN * 2 - num) + "Seconds")); + } else { + handler.post(() -> btn_echo.setText("Recording with " + (MAX_COUNT_DOWN - num) + "Seconds")); + } + } + } + +} \ No newline at end of file diff --git a/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift b/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift index feaa4ca29..810bbe0c9 100644 --- a/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift +++ b/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift @@ -156,23 +156,24 @@ class ScreenShare: BaseViewController { } var windowManager: WindowList = WindowList() - var windowlist:[Window] = [], screenlist:[Window] = [] + var windowlist:[Window] = [] + var screenList:[AgoraScreenCaptureSourceInfo]? /** --- Screen Picker --- */ @IBOutlet weak var selectScreenPicker: Picker! - var selectedScreen: Window? { + var selectedScreen: AgoraScreenCaptureSourceInfo? { let index = self.selectScreenPicker.indexOfSelectedItem - if index >= 0 && index < screenlist.count { - return screenlist[index] + if index >= 0 { + return screenList?[index] } else { return nil } } func initSelectScreenPicker() { let size = NSSize(width: 100, height: 100) - let screens = agoraKit.getScreenCaptureSources(withThumbSize: size, iconSize: size, includeScreen: true) - screens.map { sources in + screenList = agoraKit.getScreenCaptureSources(withThumbSize: size, iconSize: size, includeScreen: true) + screenList.map { sources in selectScreenPicker.picker.addItems(withTitles: sources.filter{ $0.type == .screen }.map {"\($0.sourceName)(\($0.sourceId))"}) } selectScreenPicker.label.stringValue = "Screen Share".localized @@ -202,7 +203,7 @@ class ScreenShare: BaseViewController { let params = AgoraScreenCaptureParameters() params.frameRate = fps params.dimensions = resolution.size() - let result = agoraKit.startScreenCapture(byDisplayId: UInt(screen.id), rectangle: .zero, parameters: params) + let result = agoraKit.startScreenCapture(byDisplayId: UInt(screen.sourceId), rectangle: .zero, parameters: params) if result != 0 { // Usually happens with invalid parameters // Error code description can be found at: From da55c54cbfbb5d0448f489ce8a3115e6d873cc52 Mon Sep 17 00:00:00 2001 From: xianing Date: Mon, 29 Nov 2021 11:09:31 +0800 Subject: [PATCH 6/7] relase 3.5.2 --- .../customaudio/AudioRecordService.java | 5 +- Android/APIExample/lib-component/build.gradle | 2 +- iOS/Podfile | 4 +- macOS/APIExample/Base.lproj/Main.storyboard | 14 +++--- .../APIExample/Base.lproj/Settings.storyboard | 50 +++---------------- .../Advanced/AudioMixing/AudioMixing.swift | 3 -- .../ChannelMediaRelay/ChannelMediaRelay.swift | 4 -- .../CreateDataStream/CreateDataStream.swift | 4 -- .../CustomAudioRender/CustomAudioRender.swift | 4 -- .../CustomAudioSource/CustomAudioSource.swift | 4 -- .../CustomVideoRender/CustomVideoRender.swift | 4 -- .../CustomVideoSourceMediaIO.swift | 3 -- .../CustomVideoSourcePush.swift | 4 -- .../JoinMultiChannel/JoinMultiChannel.swift | 4 -- .../RTMPStreaming/RTMPStreaming.swift | 3 -- .../Advanced/RawAudioData/RawAudioData.swift | 3 -- .../Advanced/RawMediaData/RawMediaData.swift | 3 -- .../Advanced/ScreenShare/ScreenShare.swift | 3 -- .../StreamEncryption/StreamEncryption.swift | 3 -- .../Advanced/VoiceChanger/VoiceChanger.swift | 3 -- .../JoinChannelAudio/JoinChannelAudio.swift | 3 -- .../JoinChannelVideo/JoinChannelVideo.swift | 4 -- macOS/Podfile | 2 +- 23 files changed, 18 insertions(+), 118 deletions(-) diff --git a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/customaudio/AudioRecordService.java b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/customaudio/AudioRecordService.java index afd1cf895..3940b0c78 100644 --- a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/customaudio/AudioRecordService.java +++ b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/customaudio/AudioRecordService.java @@ -27,10 +27,7 @@ public class AudioRecordService extends Service { /** * Since v3.5.1 - * 鏍规嵁瀹為檯闇姹傦紝浣犲彲浠ュ皢澶栭儴闊抽甯ф帹閫佸埌闊抽閲囬泦鍚庛佺紪鐮佸墠鎴栨湰鍦版挱鏀惧墠鐨勪綅缃 - * 浣犲彲浠ュ娆¤皟鐢ㄨ鏂规硶锛屽皢涓涓煶棰戝抚鎺ㄩ佸埌澶氫釜浣嶇疆鎴栬呭皢澶氫釜闊抽甯ф帹閫佸埌涓嶅悓浣嶇疆銆 - * 渚嬪锛屽湪 KTV 鍦烘櫙涓紝浣犲彲浠ュ皢姝屽0鎺ㄩ佸埌闊抽閲囬泦鍚庣殑浣嶇疆锛岃姝屽0缁忚繃 SDK 闊抽妯″潡鐨勫鐞嗭紝 - * 浠庤岃幏鍙栦紭璐ㄧ殑闊抽浣撻獙锛涘皢浼村鎺ㄩ佸埌闊抽缂栫爜鍓嶇殑浣嶇疆锛岃浼村涓嶅彈 SDK 闊抽妯″潡鐨勫奖鍝嶃 + * https://docs.agora.io/en/Interactive%20Broadcast/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html?platform=Android#acc77cfbe4ddfcf36d722a89af6729ce5 * * {@link io.agora.rtc.Constants.AudioExternalSourcePos} * AUDIO_EXTERNAL_PLAYOUT_SOURCE(0) diff --git a/Android/APIExample/lib-component/build.gradle b/Android/APIExample/lib-component/build.gradle index 3c0cd6cc7..c393e8a5a 100644 --- a/Android/APIExample/lib-component/build.gradle +++ b/Android/APIExample/lib-component/build.gradle @@ -30,7 +30,7 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' - api 'io.agora.rtc:full-sdk:3.5.1' + api 'io.agora.rtc:full-sdk:3.5.2' api 'io.agora:player:1.3.0' } diff --git a/iOS/Podfile b/iOS/Podfile index e36010a92..c84f0105b 100644 --- a/iOS/Podfile +++ b/iOS/Podfile @@ -6,12 +6,12 @@ target 'APIExample' do use_frameworks! pod 'Floaty', '~> 4.2.0' pod 'AGEVideoLayout', '~> 1.0.2' - pod 'AgoraRtcEngine_iOS', '3.5.1' + pod 'AgoraRtcEngine_iOS', '3.5.2' pod 'AgoraMediaPlayer_iOS', '1.2.2' end target 'Agora-ScreenShare-Extension' do use_frameworks! - pod 'AgoraRtcEngine_iOS', '3.5.1' + pod 'AgoraRtcEngine_iOS', '3.5.2' end diff --git a/macOS/APIExample/Base.lproj/Main.storyboard b/macOS/APIExample/Base.lproj/Main.storyboard index e69217dad..2b90ebcd9 100644 --- a/macOS/APIExample/Base.lproj/Main.storyboard +++ b/macOS/APIExample/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -732,19 +732,19 @@ - - + + - + - + - + diff --git a/macOS/APIExample/Base.lproj/Settings.storyboard b/macOS/APIExample/Base.lproj/Settings.storyboard index 8c65db1a7..95e7a47d2 100644 --- a/macOS/APIExample/Base.lproj/Settings.storyboard +++ b/macOS/APIExample/Base.lproj/Settings.storyboard @@ -1,8 +1,8 @@ - + - + @@ -33,18 +33,7 @@ - - - - - - - - - - - - + @@ -52,14 +41,6 @@ - - - - - - - - @@ -109,20 +90,8 @@ - - - - - - - - - - - - @@ -130,27 +99,22 @@ - - - - - + - - + - + @@ -158,8 +122,6 @@ - - diff --git a/macOS/APIExample/Examples/Advanced/AudioMixing/AudioMixing.swift b/macOS/APIExample/Examples/Advanced/AudioMixing/AudioMixing.swift index 3e61b710c..b1551d603 100644 --- a/macOS/APIExample/Examples/Advanced/AudioMixing/AudioMixing.swift +++ b/macOS/APIExample/Examples/Advanced/AudioMixing/AudioMixing.swift @@ -380,9 +380,6 @@ class AudioMixing: BaseViewController { return } agoraKit.setDevice(.audioRecording, deviceId: micId) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // disable video module in audio scene agoraKit.disableVideo() agoraKit.setAudioProfile(profile, scenario: scenario) diff --git a/macOS/APIExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelay.swift b/macOS/APIExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelay.swift index 444707725..7e7db74ba 100644 --- a/macOS/APIExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelay.swift +++ b/macOS/APIExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelay.swift @@ -132,10 +132,6 @@ class ChannelMediaRelay: BaseViewController { // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) - // set up local video to render your local camera preview let localVideo = videos[0] let videoCanvas = AgoraRtcVideoCanvas() diff --git a/macOS/APIExample/Examples/Advanced/CreateDataStream/CreateDataStream.swift b/macOS/APIExample/Examples/Advanced/CreateDataStream/CreateDataStream.swift index 5ec89c32e..b5279a74c 100644 --- a/macOS/APIExample/Examples/Advanced/CreateDataStream/CreateDataStream.swift +++ b/macOS/APIExample/Examples/Advanced/CreateDataStream/CreateDataStream.swift @@ -160,10 +160,6 @@ class CreateDataStream: BaseViewController { // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) - // set up local video to render your local camera preview let localVideo = videos[0] let videoCanvas = AgoraRtcVideoCanvas() diff --git a/macOS/APIExample/Examples/Advanced/CustomAudioRender/CustomAudioRender.swift b/macOS/APIExample/Examples/Advanced/CustomAudioRender/CustomAudioRender.swift index b9c4bee34..5479f782c 100644 --- a/macOS/APIExample/Examples/Advanced/CustomAudioRender/CustomAudioRender.swift +++ b/macOS/APIExample/Examples/Advanced/CustomAudioRender/CustomAudioRender.swift @@ -156,10 +156,6 @@ class CustomAudioRender: BaseViewController { // disable video module in audio scene agoraKit.disableVideo() - // set proxy configuration -// let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value -// agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) - // set live broadcaster mode agoraKit.setChannelProfile(.liveBroadcasting) // set myself as broadcaster to stream audio diff --git a/macOS/APIExample/Examples/Advanced/CustomAudioSource/CustomAudioSource.swift b/macOS/APIExample/Examples/Advanced/CustomAudioSource/CustomAudioSource.swift index c847e8dca..02c4cdf8a 100644 --- a/macOS/APIExample/Examples/Advanced/CustomAudioSource/CustomAudioSource.swift +++ b/macOS/APIExample/Examples/Advanced/CustomAudioSource/CustomAudioSource.swift @@ -155,10 +155,6 @@ class CustomAudioSource: BaseViewController { // disable video module in audio scene agoraKit.disableVideo() - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) - // set live broadcaster mode agoraKit.setChannelProfile(.liveBroadcasting) // set myself as broadcaster to stream audio diff --git a/macOS/APIExample/Examples/Advanced/CustomVideoRender/CustomVideoRender.swift b/macOS/APIExample/Examples/Advanced/CustomVideoRender/CustomVideoRender.swift index dea5a97ba..b8da0638e 100644 --- a/macOS/APIExample/Examples/Advanced/CustomVideoRender/CustomVideoRender.swift +++ b/macOS/APIExample/Examples/Advanced/CustomVideoRender/CustomVideoRender.swift @@ -193,10 +193,6 @@ class CustomVideoRender: BaseViewController { // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) - // setup my own camera as custom video source agoraKit.setVideoSource(customCamera) // enable video module and set up video encoding configs diff --git a/macOS/APIExample/Examples/Advanced/CustomVideoSourceMediaIO/CustomVideoSourceMediaIO.swift b/macOS/APIExample/Examples/Advanced/CustomVideoSourceMediaIO/CustomVideoSourceMediaIO.swift index 7a58cb4e4..b6237babb 100644 --- a/macOS/APIExample/Examples/Advanced/CustomVideoSourceMediaIO/CustomVideoSourceMediaIO.swift +++ b/macOS/APIExample/Examples/Advanced/CustomVideoSourceMediaIO/CustomVideoSourceMediaIO.swift @@ -212,9 +212,6 @@ class CustomVideoSourceMediaIO: BaseViewController { } // set live broadcaster mode agoraKit.setChannelProfile(.liveBroadcasting) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) // setup my own camera as custom video source diff --git a/macOS/APIExample/Examples/Advanced/CustomVideoSourcePush/CustomVideoSourcePush.swift b/macOS/APIExample/Examples/Advanced/CustomVideoSourcePush/CustomVideoSourcePush.swift index 72b445282..8ad75a9f4 100644 --- a/macOS/APIExample/Examples/Advanced/CustomVideoSourcePush/CustomVideoSourcePush.swift +++ b/macOS/APIExample/Examples/Advanced/CustomVideoSourcePush/CustomVideoSourcePush.swift @@ -199,10 +199,6 @@ class CustomVideoSourcePush: BaseViewController { // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) - // setup my own camera as custom video source customCamera = AgoraCameraSourcePush(delegate: self, videoView: localPreview!) agoraKit.setExternalVideoSource(true, useTexture: true, pushMode: true) diff --git a/macOS/APIExample/Examples/Advanced/JoinMultiChannel/JoinMultiChannel.swift b/macOS/APIExample/Examples/Advanced/JoinMultiChannel/JoinMultiChannel.swift index c566626de..fc966250b 100644 --- a/macOS/APIExample/Examples/Advanced/JoinMultiChannel/JoinMultiChannel.swift +++ b/macOS/APIExample/Examples/Advanced/JoinMultiChannel/JoinMultiChannel.swift @@ -216,10 +216,6 @@ class JoinMultipleChannel: BaseViewController { agoraKit = AgoraRtcEngineKit.sharedEngine(with: config, delegate: self) // this is mandatory to get camera list agoraKit.enableVideo() - - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) initChannelField1() initJoinChannel1Button() diff --git a/macOS/APIExample/Examples/Advanced/RTMPStreaming/RTMPStreaming.swift b/macOS/APIExample/Examples/Advanced/RTMPStreaming/RTMPStreaming.swift index 981d87cac..a814b1383 100644 --- a/macOS/APIExample/Examples/Advanced/RTMPStreaming/RTMPStreaming.swift +++ b/macOS/APIExample/Examples/Advanced/RTMPStreaming/RTMPStreaming.swift @@ -163,9 +163,6 @@ class RTMPStreaming: BaseViewController { agoraKit.setChannelProfile(.liveBroadcasting) // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // enable video module and set up video encoding configs agoraKit.setVideoEncoderConfiguration( AgoraVideoEncoderConfiguration( diff --git a/macOS/APIExample/Examples/Advanced/RawAudioData/RawAudioData.swift b/macOS/APIExample/Examples/Advanced/RawAudioData/RawAudioData.swift index 3cb0713d7..f72bb4016 100644 --- a/macOS/APIExample/Examples/Advanced/RawAudioData/RawAudioData.swift +++ b/macOS/APIExample/Examples/Advanced/RawAudioData/RawAudioData.swift @@ -156,9 +156,6 @@ class RawAudioData: BaseViewController { agoraKit.disableVideo() // set live broadcaster mode agoraKit.setChannelProfile(.liveBroadcasting) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // set myself as broadcaster to stream audio agoraKit.setClientRole(.broadcaster) diff --git a/macOS/APIExample/Examples/Advanced/RawMediaData/RawMediaData.swift b/macOS/APIExample/Examples/Advanced/RawMediaData/RawMediaData.swift index c7f6f4af3..259dde31c 100644 --- a/macOS/APIExample/Examples/Advanced/RawMediaData/RawMediaData.swift +++ b/macOS/APIExample/Examples/Advanced/RawMediaData/RawMediaData.swift @@ -226,9 +226,6 @@ class RawMediaData: BaseViewController { } // set live broadcaster mode agoraKit.setChannelProfile(.liveBroadcasting) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) // enable video module and set up video encoding configs diff --git a/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift b/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift index 810bbe0c9..644a30842 100644 --- a/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift +++ b/macOS/APIExample/Examples/Advanced/ScreenShare/ScreenShare.swift @@ -378,9 +378,6 @@ class ScreenShare: BaseViewController { agoraKit.setChannelProfile(.liveBroadcasting) // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // enable video module and set up video encoding configs agoraKit.setVideoEncoderConfiguration( AgoraVideoEncoderConfiguration( diff --git a/macOS/APIExample/Examples/Advanced/StreamEncryption/StreamEncryption.swift b/macOS/APIExample/Examples/Advanced/StreamEncryption/StreamEncryption.swift index 86a2ed75a..6f1b56645 100644 --- a/macOS/APIExample/Examples/Advanced/StreamEncryption/StreamEncryption.swift +++ b/macOS/APIExample/Examples/Advanced/StreamEncryption/StreamEncryption.swift @@ -224,9 +224,6 @@ class StreamEncryption: BaseViewController { agoraKit.setChannelProfile(.liveBroadcasting) // set myself as broadcaster to stream video/audio agoraKit.setClientRole(.broadcaster) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // enable video module and set up video encoding configs agoraKit.setVideoEncoderConfiguration( AgoraVideoEncoderConfiguration( diff --git a/macOS/APIExample/Examples/Advanced/VoiceChanger/VoiceChanger.swift b/macOS/APIExample/Examples/Advanced/VoiceChanger/VoiceChanger.swift index 6c8782556..30e3896aa 100644 --- a/macOS/APIExample/Examples/Advanced/VoiceChanger/VoiceChanger.swift +++ b/macOS/APIExample/Examples/Advanced/VoiceChanger/VoiceChanger.swift @@ -508,9 +508,6 @@ class VoiceChanger: BaseViewController { agoraKit.setDevice(.audioRecording, deviceId: micId) // disable video module in audio scene agoraKit.disableVideo() - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // Before calling the method, you need to set the profile // parameter of setAudioProfile to AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) // or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5), and to set diff --git a/macOS/APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift b/macOS/APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift index 12952eeaf..10613f478 100644 --- a/macOS/APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift +++ b/macOS/APIExample/Examples/Basic/JoinChannelAudio/JoinChannelAudio.swift @@ -327,9 +327,6 @@ class JoinChannelAudioMain: BaseViewController { agoraKit.enableAudio() agoraKit.setAudioProfile(profile, scenario: scenario) - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) // set live broadcaster mode agoraKit.setChannelProfile(.liveBroadcasting) diff --git a/macOS/APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift b/macOS/APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift index b46c73c86..3ed6c67be 100644 --- a/macOS/APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift +++ b/macOS/APIExample/Examples/Basic/JoinChannelVideo/JoinChannelVideo.swift @@ -353,10 +353,6 @@ class JoinChannelVideoMain: BaseViewController { return } - // set proxy configuration - let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value - agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy) - agoraKit.setDevice(.videoCapture, deviceId: cameraId) agoraKit.setDevice(.audioRecording, deviceId: micId) // set live broadcaster mode diff --git a/macOS/Podfile b/macOS/Podfile index 93dd22c70..4b8def9bb 100644 --- a/macOS/Podfile +++ b/macOS/Podfile @@ -7,7 +7,7 @@ target 'APIExample' do # Pods for APIExample pod 'AGEVideoLayout', '~> 1.0.2' - pod 'AgoraRtcEngine_macOS', '3.5.1' + pod 'AgoraRtcEngine_macOS', '3.5.2' target 'APIExampleTests' do inherit! :search_paths From 6cabbaa52e857d1990b7e7fc1e182b0336168f83 Mon Sep 17 00:00:00 2001 From: xianing Date: Mon, 29 Nov 2021 19:19:05 +0800 Subject: [PATCH 7/7] optimize pre-call test timer task logic --- .../examples/advanced/PreCallTest.java | 74 ++++++++++++++----- .../app/src/main/res/values-zh/strings.xml | 3 + .../app/src/main/res/values/strings.xml | 3 + 3 files changed, 62 insertions(+), 18 deletions(-) diff --git a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java index 79cd3d2a6..825ac1ee1 100644 --- a/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java +++ b/Android/APIExample/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java @@ -4,6 +4,7 @@ import android.content.Context; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.util.Log; import android.view.LayoutInflater; @@ -52,14 +53,12 @@ public class PreCallTest extends BaseFragment implements View.OnClickListener { private TextView lastmileQuality, lastmileResult; private static final Integer MAX_COUNT_DOWN = 8; private int num; - private Timer timer; - private TimerTask task; private boolean echoTesting = false; + private Thread countDownThread; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - handler = new Handler(); } @Nullable @@ -129,10 +128,9 @@ public void onClick(View v) { num = 0; engine.startEchoTest(MAX_COUNT_DOWN); btn_echo.setEnabled(false); - btn_echo.setText("Recording on Microphone ..."); - timer = new Timer(false); - task = new TimerProcess(); - timer.schedule(task, 1000, 1000); + btn_echo.setText(R.string.recording_start); + countDownThread = new Thread(new CountDownTask()); + countDownThread.start(); } else if (v.getId() == R.id.btn_echoVideoTest) { if (!echoTesting) { SurfaceView surfaceView = RtcEngine.CreateRendererView(getContext()); @@ -148,8 +146,7 @@ public void onClick(View v) { btn_echoVideo.setText(getText(R.string.stop_echo_video_audio_test)); } else { engine.stopEchoTest(); - if(preview.getChildCount() > 0) - { + if (preview.getChildCount() > 0) { preview.removeAllViews(); } echoTesting = false; @@ -306,22 +303,63 @@ private void updateLastMileResult() { }); } - class TimerProcess extends TimerTask { - @Override - public void run() { - num++; - if (num >= MAX_COUNT_DOWN * 2) { + + @Override + public void onDestroy() { + /**leaveChannel and Destroy the RtcEngine instance*/ + if (engine != null) { + /**After joining a channel, the user must call the leaveChannel method to end the + * call before joining another channel. This method returns 0 if the user leaves the + * channel and releases all resources related to the call. This method call is + * asynchronous, and the user has not exited the channel when the method call returns. + * Once the user leaves the channel, the SDK triggers the onLeaveChannel callback. + * A successful leaveChannel method call triggers the following callbacks: + * 1:The local client: onLeaveChannel. + * 2:The remote client: onUserOffline, if the user leaving the channel is in the + * Communication channel, or is a BROADCASTER in the Live Broadcast profile. + * @returns 0: Success. + * < 0: Failure. + * PS: + * 1:If you call the destroy method immediately after calling the leaveChannel + * method, the leaveChannel process interrupts, and the SDK does not trigger + * the onLeaveChannel callback. + * 2:If you call the leaveChannel method during CDN live streaming, the SDK + * triggers the removeInjectStreamUrl method.*/ + engine.leaveChannel(); + } + handler.post(RtcEngine::destroy); + engine = null; + super.onDestroy(); + } + + class CountDownTask implements Runnable { + + private void updateCountDown() { + if (num > MAX_COUNT_DOWN * 2) + return; + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (num == MAX_COUNT_DOWN * 2) { handler.post(() -> { - btn_echo.setEnabled(true); btn_echo.setText(getString(R.string.start_echo_audio_test)); + btn_echo.setEnabled(true); }); engine.stopEchoTest(); - task.cancel(); } else if (num >= MAX_COUNT_DOWN) { - handler.post(() -> btn_echo.setText("PLaying with " + (MAX_COUNT_DOWN * 2 - num) + "Seconds")); + handler.post(() -> btn_echo.setText(getString(R.string.echo_playing_countdown) + " " + (MAX_COUNT_DOWN * 2 - num + 1))); } else { - handler.post(() -> btn_echo.setText("Recording with " + (MAX_COUNT_DOWN - num) + "Seconds")); + handler.post(() -> btn_echo.setText(getString(R.string.echo_record_countdown) + " " + (MAX_COUNT_DOWN - num + 1))); } + num++; + updateCountDown(); + } + + @Override + public void run() { + updateCountDown(); } } diff --git a/Android/APIExample/app/src/main/res/values-zh/strings.xml b/Android/APIExample/app/src/main/res/values-zh/strings.xml index f2ac1eff4..658e0d772 100644 --- a/Android/APIExample/app/src/main/res/values-zh/strings.xml +++ b/Android/APIExample/app/src/main/res/values-zh/strings.xml @@ -160,4 +160,7 @@ 鍋滄闊抽娴嬭瘯 缃戠粶鍥炶矾娴嬭瘯 缃戠粶寤惰繜娴嬭瘯 + 褰曞埗鍊掕鏃 + 鎾斁鍊掕鏃 + 寮濮嬮害鍏嬮褰曞埗 \ No newline at end of file diff --git a/Android/APIExample/app/src/main/res/values/strings.xml b/Android/APIExample/app/src/main/res/values/strings.xml index e7a31d8dc..3f82e0f55 100644 --- a/Android/APIExample/app/src/main/res/values/strings.xml +++ b/Android/APIExample/app/src/main/res/values/strings.xml @@ -164,4 +164,7 @@ Stop Echo Audio Test Echo Test Lastmile Network Pretest + Recording Countdown + Playing Countdown + Recording on Microphone