Skip to content

Commit

Permalink
feat: upgrade native sdk 4.2.0 (#1071)
Browse files Browse the repository at this point in the history
* ++

* ++

* ++

* ++

* [AUTO] Update doc 620

* feat: upgrade native sdk dependencies 20230523

* feat: upgrade native sdk dependencies 20230525

* ++

* ++

* feat: upgrade native sdk dependencies 20230525 (#1106)

Co-authored-by: LichKing-2234 <LichKing-2234@users.noreply.github.com>

---------

Co-authored-by: jinyuagora <jinyuagora@users.noreply.github.com>
Co-authored-by: littleGnAl <littleGnAl@users.noreply.github.com>
Co-authored-by: LichKing-2234 <LichKing-2234@users.noreply.github.com>
  • Loading branch information
4 people authored May 26, 2023
1 parent 47595f9 commit 1c2813a
Show file tree
Hide file tree
Showing 143 changed files with 6,910 additions and 7,544 deletions.
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ dependencies {
if (isDev(project)) {
implementation fileTree(dir: "libs", include: ["*.jar"])
} else {
api 'io.agora.rtc:iris-rtc:4.1.0-rc.2'
api 'io.agora.rtc:full-sdk:4.1.0-1'
implementation 'io.agora.rtc:full-screen-sharing:4.1.0-1'
api 'io.agora.rtc:iris-rtc:4.2.0-build.3'
api 'io.agora.rtc:full-sdk:4.2.0'
api 'io.agora.rtc:full-screen-sharing:4.2.0'
}
}

static boolean isDev(Project project) {
def devFile = project.file('.plugin_dev')
return devFile.exists()
}
}
2 changes: 1 addition & 1 deletion ci/run_flutter_windows_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for filename in integration_test/*.dart; do
if [[ "$filename" == *.generated.dart ]]; then
continue
fi
flutter test $filename -d windows
flutter test $filename -d windows --verbose
done

popd
Expand Down
16 changes: 7 additions & 9 deletions example/lib/examples/advanced/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ final advanced = [
{'name': 'Advanced'},
{'name': 'AudioMixing', 'widget': const AudioMixing()},
{'name': 'ChannelMediaRelay', 'widget': const ChannelMediaRelay()},
// if (!kIsWeb && (Platform.isAndroid || Platform.isIOS))
// {'name': 'CustomCaptureAudio', 'widget': const CustomCaptureAudio()},
if (kIsWeb || !(Platform.isAndroid || Platform.isIOS))
{'name': 'DeviceManager', 'widget': const DeviceManager()},
{'name': 'JoinMultipleChannel', 'widget': const JoinMultipleChannel()},
Expand Down Expand Up @@ -69,15 +67,14 @@ final advanced = [
if (kIsWeb || !(Platform.isAndroid || Platform.isIOS))
{'name': 'SendMultiCameraStream', 'widget': const SendMultiCameraStream()},
{'name': 'StartRhythmPlayer', 'widget': const StartRhythmPlayer()},
if (kIsWeb || !(Platform.isAndroid || Platform.isIOS))
{
'name': 'StartLocalVideoTranscoder',
'widget': const StartLocalVideoTranscoder()
},
{
'name': 'StartLocalVideoTranscoder',
'widget': const StartLocalVideoTranscoder()
},
{'name': 'ProcessVideoRawData', 'widget': const ProcessVideoRawData()},
{'name': 'ProcessAudioRawData', 'widget': const ProcessAudioRawData()},
{'name': 'AudioSpectrum', 'widget': const AudioSpectrum()},
{'name': 'MediaRecorder', 'widget': const MediaRecorder()},
{'name': 'MediaRecorder', 'widget': const MediaRecorderExample()},
{'name': 'PushVideoFrame', 'widget': const PushVideoFrame()},
// {'name': 'PushAudioFrame', 'widget': const PushAudioFrame()},
{'name': 'PushEncodedVideoFrame', 'widget': const PushEncodedVideoFrame()},
Expand All @@ -87,5 +84,6 @@ final advanced = [
},
if (kIsWeb || !(Platform.isAndroid || Platform.isIOS))
{'name': 'PreCallTest', 'widget': const PreCallTest()},
{'name': 'MusicPlayer', 'widget': const MusicPlayerExample()},
if (Platform.isAndroid || Platform.isIOS)
{'name': 'MusicPlayer', 'widget': const MusicPlayerExample()},
];
4 changes: 3 additions & 1 deletion example/lib/examples/advanced/media_player/media_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class _State extends State<MediaPlayer> {
late final RtcEngineEx _engine;
bool _isReadyPreview = false;

late final MediaPlayerController _mediaPlayerController;
late MediaPlayerController _mediaPlayerController;

late final TextEditingController _textEditingController;

Expand Down Expand Up @@ -65,6 +65,8 @@ class _State extends State<MediaPlayer> {

Future<void> _initEngine() async {
_engine = createAgoraRtcEngineEx();
_mediaPlayerController = MediaPlayerController(
rtcEngine: _engine, canvas: const VideoCanvas(uid: 0));
await _engine.initialize(RtcEngineContext(
appId: config.appId,
channelProfile: ChannelProfileType.channelProfileLiveBroadcasting,
Expand Down
46 changes: 24 additions & 22 deletions example/lib/examples/advanced/media_recorder/media_recorder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:agora_rtc_engine_example/config/agora.config.dart' as config;

/// MediaRecorder Example
class MediaRecorder extends StatefulWidget {
class MediaRecorderExample extends StatefulWidget {
/// @nodoc
const MediaRecorder({Key? key}) : super(key: key);
const MediaRecorderExample({Key? key}) : super(key: key);

@override
State<StatefulWidget> createState() => _State();
}

class _State extends State<MediaRecorder> {
class _State extends State<MediaRecorderExample> {
late final RtcEngine _engine;

bool isJoined = false, switchCamera = true, switchRender = true;
Expand All @@ -28,6 +28,7 @@ class _State extends State<MediaRecorder> {
bool _isStartedMediaRecording = false;
String _recordingFileStoragePath = '';
bool _isReadyPreview = false;
MediaRecorder? _mediaRecorder;

@override
void initState() {
Expand All @@ -43,7 +44,9 @@ class _State extends State<MediaRecorder> {
}

Future<void> _dispose() async {
await _engine.getMediaRecorder().release();
if (_mediaRecorder != null) {
await _engine.destroyMediaRecorder(_mediaRecorder!);
}
await _engine.release();
}

Expand All @@ -52,7 +55,6 @@ class _State extends State<MediaRecorder> {
await _engine.initialize(RtcEngineContext(
appId: config.appId,
));
await _engine.setLogFilter(LogFilterType.logFilterError);

_engine.registerEventHandler(RtcEngineEventHandler(
onError: (ErrorCodeType err, String msg) {
Expand Down Expand Up @@ -116,35 +118,35 @@ class _State extends State<MediaRecorder> {
}

Future<void> _startMediaRecording() async {
await _engine.getMediaRecorder().setMediaRecorderObserver(
connection: RtcConnection(channelId: _controller.text, localUid: 0),
callback: MediaRecorderObserver(
onRecorderStateChanged:
(RecorderState state, RecorderErrorCode error) {
logSink.log('onRecorderStateChanged state: $state, error: $error');
},
onRecorderInfoUpdated: (RecorderInfo info) {
logSink.log('onRecorderInfoUpdated info: ${info.toJson()}');
},
));
_mediaRecorder ??= await _engine.createMediaRecorder(
RecorderStreamInfo(channelId: _controller.text, uid: 0));

await _mediaRecorder?.setMediaRecorderObserver(MediaRecorderObserver(
onRecorderStateChanged: (String channelId, int uid, RecorderState state,
RecorderErrorCode error) {
logSink.log(
'onRecorderStateChanged channelId: $channelId, uid: $uid state: $state, error: $error');
},
onRecorderInfoUpdated: (String channelId, int uid, RecorderInfo info) {
logSink.log(
'onRecorderInfoUpdated channelId: $channelId, uid: $uid, info: ${info.toJson()}');
},
));

Directory appDocDir = Platform.isAndroid
? (await getExternalStorageDirectory())!
: await getApplicationDocumentsDirectory();
String p = path.join(appDocDir.path, 'example.mp4');
await _engine.getMediaRecorder().startRecording(
connection: RtcConnection(channelId: _controller.text, localUid: 0),
config: MediaRecorderConfiguration(storagePath: p));
await _mediaRecorder
?.startRecording(MediaRecorderConfiguration(storagePath: p));
setState(() {
_recordingFileStoragePath = 'Recording file storage path: $p';
_isStartedMediaRecording = true;
});
}

Future<void> _stopMediaRecording() async {
await _engine
.getMediaRecorder()
.stopRecording(RtcConnection(channelId: _controller.text, localUid: 0));
await _mediaRecorder?.stopRecording();
setState(() {
_recordingFileStoragePath = '';
_isStartedMediaRecording = false;
Expand Down
81 changes: 44 additions & 37 deletions example/lib/examples/advanced/music_player/music_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,47 +282,54 @@ class _MusicPlayerExampleState extends State<MusicPlayerExample> {
));

_musicContentCenter.registerEventHandler(MusicContentCenterEventHandler(
onMusicChartsResult: (requestId, status, result) {
logSink.log(
'[onMusicChartsResult], requestId: $requestId, status: $status, result: ${result.toString()}');
if (status == MusicContentCenterStatusCode.kMusicContentCenterStatusOk) {
if (_currentRequestId == requestId) {
onMusicChartsResult: (String requestId, List<MusicChartInfo> result,
MusicContentCenterStatusCode errorCode) {
logSink.log(
'[onMusicChartsResult], requestId: $requestId, errorCode: $errorCode, result: ${result.toString()}');
if (errorCode ==
MusicContentCenterStatusCode.kMusicContentCenterStatusOk) {
if (_currentRequestId == requestId) {
setState(() {
_musicChartInfos = result;
});
}
}
},
onMusicCollectionResult: (String requestId, MusicCollection result,
MusicContentCenterStatusCode errorCode) {
logSink.log(
'[onMusicCollectionResult], requestId: $requestId, errorCode: $errorCode, result: ${result.toString()}');

if (_musicCollectionRequestId == requestId) {
setState(() {
_musicCollection = result;
});
} else if (_searchMusicRequestId == requestId) {
setState(() {
_musicChartInfos = result;
_searchedMusicCollection = result;
});
}
}
}, onMusicCollectionResult: (String requestId,
MusicContentCenterStatusCode status, MusicCollection result) {
logSink.log(
'[onMusicCollectionResult], requestId: $requestId, status: $status, result: ${result.toString()}');

if (_musicCollectionRequestId == requestId) {
setState(() {
_musicCollection = result;
});
} else if (_searchMusicRequestId == requestId) {
setState(() {
_searchedMusicCollection = result;
});
}
}, onPreLoadEvent: (int songCode, int percent, PreloadStatusCode status,
String msg, String lyricUrl) {
logSink.log(
'[onPreLoadEvent], songCode: $songCode, percent: $percent status: $status, msg: $msg, lyricUrl: $lyricUrl');
if (_selectedMusic.songCode == songCode &&
status == PreloadStatusCode.kPreloadStatusCompleted) {
_preloadCompleted?.complete();
_preloadCompleted = null;
}
}, onLyricResult: (String requestId, String lyricUrl) {
if (_getLyricRequestId == requestId) {
_getLyricCompleted?.complete(lyricUrl);
_getLyricCompleted = null;
}
}));
},
onPreLoadEvent: (int songCode, int percent, String lyricUrl,
PreloadStatusCode status, MusicContentCenterStatusCode errorCode) {
logSink.log(
'[onPreLoadEvent], songCode: $songCode, percent: $percent status: $status, errorCode: $errorCode, lyricUrl: $lyricUrl');
if (_selectedMusic.songCode == songCode &&
status == PreloadStatusCode.kPreloadStatusCompleted) {
_preloadCompleted?.complete();
_preloadCompleted = null;
}
},
onLyricResult: (String requestId, String lyricUrl,
MusicContentCenterStatusCode errorCode) {
if (_getLyricRequestId == requestId) {
_getLyricCompleted?.complete(lyricUrl);
_getLyricCompleted = null;
}
},
));

_musicPlayer = await _musicContentCenter.createMusicPlayer();
_musicPlayer = (await _musicContentCenter.createMusicPlayer())!;

_mediaPlayerSourceObserver = MediaPlayerSourceObserver(
onPlayerSourceStateChanged:
Expand Down
3 changes: 2 additions & 1 deletion example/lib/examples/advanced/precall_test/precall_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ class _State extends State<PreCallTest> {
_isStartEchoTest = !_isStartEchoTest;

if (_isStartEchoTest) {
await _engine.startEchoTest();
await _engine.startEchoTest(
const EchoTestConfiguration(intervalInSeconds: 10));
} else {
await _engine.stopEchoTest();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ class _RtmpStreamingState extends State<RtmpStreaming> {
_remoteUid = 0;
});
},
onLeaveChannel: (RtcConnection connection, RtcStats stats) {
onLeaveChannel: (RtcConnection connection, RtcStats stats) async {
logSink.log(
'[onLeaveChannel] connection: ${connection.toJson()} stats: ${stats.toJson()}');

if (_isStreaming && _rtmpUrlController.text.isNotEmpty) {
await _engine.stopRtmpStream(_rtmpUrlController.text);
_isStreaming = false;
}

setState(() {
isJoined = false;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ class _State extends State<SendMultiCameraStream> {
}

Future<void> _dispose() async {
// await _localVideoController.dispose();
await _engine.stopPrimaryCameraCapture();
await _engine.stopSecondaryCameraCapture();
await _engine.leaveChannel();
await _leaveChannel();
await _engine.release();
}

Expand Down Expand Up @@ -101,14 +98,16 @@ class _State extends State<SendMultiCameraStream> {
await _engine.enableVideo();
await _engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster);

await _engine.startPrimaryCameraCapture(CameraCapturerConfiguration(
deviceId: _videoDeviceInfos[0].deviceId,
format: VideoFormat(
width: 640,
height: 320,
fps: FrameRate.frameRateFps10.value(),
),
));
await _engine.startCameraCapture(
sourceType: VideoSourceType.videoSourceCameraPrimary,
config: CameraCapturerConfiguration(
deviceId: _videoDeviceInfos[0].deviceId,
format: VideoFormat(
width: 640,
height: 320,
fps: FrameRate.frameRateFps10.value(),
),
));

await _engine.startPreview();

Expand Down Expand Up @@ -140,11 +139,10 @@ class _State extends State<SendMultiCameraStream> {
}
}

void _leaveChannel() async {
await _engine.stopSecondaryCameraCapture();
await _engine.stopPrimaryCameraCapture();
Future<void> _leaveChannel() async {
await _engine.stopCameraCapture(VideoSourceType.videoSourceCameraPrimary);
await _engine.stopCameraCapture(VideoSourceType.videoSourceCameraSecondary);
await _engine.leaveChannel();
// setState(() {});
}

@override
Expand Down Expand Up @@ -228,17 +226,20 @@ class _State extends State<SendMultiCameraStream> {
!_isStartSecondaryCameraDevice;

if (_isStartSecondaryCameraDevice) {
_engine.startSecondaryCameraCapture(
CameraCapturerConfiguration(
deviceId: _videoDeviceInfos[1].deviceId,
format: VideoFormat(
width: 640,
height: 320,
fps: FrameRate.frameRateFps10.value(),
),
));
_engine.startCameraCapture(
sourceType:
VideoSourceType.videoSourceCameraSecondary,
config: CameraCapturerConfiguration(
deviceId: _videoDeviceInfos[1].deviceId,
format: VideoFormat(
width: 640,
height: 320,
fps: FrameRate.frameRateFps10.value(),
),
));
} else {
_engine.stopSecondaryCameraCapture();
_engine.stopCameraCapture(
VideoSourceType.videoSourceCameraSecondary);
}

setState(() {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ class _State extends State<SetBeautyEffect> with KeepRemoteVideoViewsMixin {

await _engine.enableVideo();

await _engine.enableExtension(
provider: "agora_video_filters_clear_vision",
extension: "clear_vision");

await _engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster);

await _engine.startPreview();
Expand Down
Loading

0 comments on commit 1c2813a

Please sign in to comment.