### Define Installation Directories Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/linux/CMakeLists.txt Defines the destination directories for data and libraries within the installation bundle. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Install Application Executable Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/CMakeLists.txt Installs the main application executable to the specified runtime destination. This component is marked as 'Runtime'. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Define Installation Paths Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/CMakeLists.txt Sets the destination paths for installing data files and libraries within the application bundle. These paths are relative to the installation prefix. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Installation Prefix Configuration Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/linux/CMakeLists.txt Sets the installation prefix to a bundle directory and ensures it's initialized to default if not already set. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() ``` -------------------------------- ### Install MSVCP140_CODECVT_IDS.dll if Exists Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/CMakeLists.txt Installs the msvcp140_codecvt_ids.dll from the system directory to the application bundle to avoid DLL Hell issues. ```cmake if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/msvcp140_codecvt_ids.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/msvcp140_codecvt_ids.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install MSVCP140_2.dll if Exists Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/CMakeLists.txt Installs the msvcp140_2.dll from the system directory to the application bundle to avoid DLL Hell issues. ```cmake if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/msvcp140_2.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/msvcp140_2.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install VCRUNTIME140_1.dll if Exists Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/CMakeLists.txt Installs the vcruntime140_1.dll from the system directory to the application bundle to avoid DLL Hell issues. ```cmake if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/vcruntime140_1.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/vcruntime140_1.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install MSVCP140_1.dll if Exists Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/CMakeLists.txt Installs the msvcp140_1.dll from the system directory to the application bundle to avoid DLL Hell issues. ```cmake if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/msvcp140_1.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/msvcp140_1.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/cxx/CMakeLists.txt Initializes the CMake project, sets the minimum version, project name, and C++ standard. This is a foundational setup for the build system. ```cmake cmake_minimum_required(VERSION 3.10.2) set(PROJECT_NAME "iris_tester") project(${PROJECT_NAME} LANGUAGES C CXX) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 17) ``` -------------------------------- ### Install Application Bundle Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/linux/CMakeLists.txt Configures the installation process to create a relocatable bundle. It cleans the build directory, installs the executable, Flutter ICU data, the Flutter library, bundled plugin libraries, and assets. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Setup PiP Controller Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/docs/integration/Picture-in-Picture.md Initializes the PiP controller with specified options. This must be called before other PiP lifecycle methods. ```dart // Setup PiP await _pipController.pipSetup(options); ``` -------------------------------- ### Install MSVCP140.dll if Exists Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/CMakeLists.txt Installs the msvcp140.dll from the system directory to the application bundle to avoid DLL Hell issues. ```cmake if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/msvcp140.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/msvcp140.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install VCRUNTIME140.dll if Exists Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/CMakeLists.txt Installs the vcruntime140.dll from the system directory to the application bundle to avoid DLL Hell issues. ```cmake set(SYSTEM_VCRUNTIME_DIR "C:/Windows/System32") if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/vcruntime140.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/vcruntime140.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install Flutter Library Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/CMakeLists.txt Installs the main Flutter library file to the root of the application bundle. This is also a runtime component. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Set Installation Directory for Runtime Components Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/example/windows/CMakeLists.txt Configures the installation prefix to be next to the executable for runtime components. This allows the application to run directly from the build directory, simplifying development with Visual Studio. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Start Screen Capture on Desktop (Windows/macOS) Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt Enables screen sharing on desktop platforms by first retrieving available screen and window sources. It then starts capturing either a specific display or window. ```dart SIZE thumbSize = const SIZE(width: 100, height: 100); SIZE iconSize = const SIZE(width: 50, height: 50); List sources = await _engine.getScreenCaptureSources( thumbSize: thumbSize, iconSize: iconSize, includeScreen: true, ); if (sources.isEmpty) return; ScreenCaptureSourceInfo selectedSource = sources.first; if (selectedSource.type == ScreenCaptureSourceType.screencapturesourcetypeScreen) { await _engine.startScreenCaptureByDisplayId( displayId: selectedSource.sourceId!, regionRect: const Rectangle(x: 0, y: 0, width: 0, height: 0), captureParams: const ScreenCaptureParameters( captureMouseCursor: true, frameRate: 30, ), ); } else { await _engine.startScreenCaptureByWindowId( windowId: selectedSource.sourceId!, regionRect: const Rectangle(x: 0, y: 0, width: 0, height: 0), captureParams: const ScreenCaptureParameters( captureMouseCursor: true, frameRate: 30, ), ); } _isScreenSharing = true; ``` -------------------------------- ### Configure Installation Directory for Bundle Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/windows/CMakeLists.txt Sets the installation directory for the application bundle to be adjacent to the executable, allowing in-place execution. ```cmake set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() ``` -------------------------------- ### Run Rendering Test on Web Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/README.md Execute the rendering test for the web platform. Requires ChromeDriver setup. Ensure you replace `` with your actual App ID. ```bash flutter drive --driver=test_driver/integration_test.dart \ --target=integration_test/agora_video_view_render_test.dart \ --dart-define=TEST_APP_ID="" \ -d web-server ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/CMakeLists.txt Installs any bundled plugin libraries to the application bundle's library directory. This is conditional on PLUGIN_BUNDLED_LIBRARIES being defined. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install AOT Library Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library. This is done only for Profile and Release configurations to include optimized code. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Set Up Ephemeral Directory and Configuration Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/example/windows/flutter/CMakeLists.txt Initializes the ephemeral build directory and includes generated configuration. This setup is crucial for managing build artifacts and configurations provided by the Flutter tool. ```cmake cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) ``` -------------------------------- ### Set Installation Directory for Bundle Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/CMakeLists.txt Defines the directory where support files will be copied next to the executable. This allows the application to run in place, simplifying Visual Studio builds. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() ``` -------------------------------- ### Install AOT Library Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library on Profile and Release builds for performance optimization. This is skipped for Debug builds. ```cmake # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Set Installation Directory for Bundled Libraries Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/CMakeLists.txt Defines the installation directory for library files within the application bundle, typically at the root of the bundle. ```cmake set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Set Installation Directory for Bundled Data Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/CMakeLists.txt Defines the installation directory for data files within the application bundle, typically under a 'data' subdirectory. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") ``` -------------------------------- ### Start PiP Playback Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/docs/integration/Picture-in-Picture.md Initiates Picture-in-Picture playback. On iOS, this action must be user-initiated to comply with App Store guidelines. Programmatic or automatic starts may lead to rejection. ```dart // Start PiP (iOS: Must be user-initiated) await _pipController.pipStart(); ``` -------------------------------- ### macOS Platform Configuration Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/cxx/CMakeLists.txt Configures the build for macOS. It sets library and framework directories, defines frameworks to link, and sets target properties including framework identifier, version, and link flags. This setup is for integrating the Agora SDK as a framework on macOS. ```cmake elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../macos/AgoraRtcWrapper.podspec") set(LIBS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../macos/" ) set(RTC_ENGINE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../macos/libs/AgoraRtcKit.framework/" ) target_include_directories(${LIBRARY_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../../macos/AgoraRtcWrapper.framework/Headers" "${CMAKE_CURRENT_SOURCE_DIR}/../../../macos/libs/AgoraRtcKit.framework/Headers" ) else() set(LIBS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../macos/Pods/AgoraIrisRTC_macOS" ) set(RTC_ENGINE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../macos/Pods/AgoraRtcEngine_macOS" ) endif() set(FRAMEWORKS "-framework AgoraRtcWrapper" ) set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "10.11") set_target_properties(${LIBRARY_NAME} properties FRAMEWORK TRUE FRAMEWORK_VERSION A MACOSX_FRAMEWORK_IDENTIFIER io.agora.iris.it CXX_VISIBILITY_PRESET hidden LINK_FLAGS "-Wl -F ${LIBS_DIR}" ) target_link_libraries(${LIBRARY_NAME} PUBLIC "${FRAMEWORKS}" ) ``` -------------------------------- ### Define Project Build Directory Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/windows/flutter/CMakeLists.txt Sets the project's build directory path. This is published to the parent scope for use in the install step. ```cmake set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) ``` -------------------------------- ### Start Screen Capture on Mobile (Android/iOS) Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt Initiates screen capture for mobile devices, allowing both audio and video to be shared. This method is suitable for platforms where direct screen capture APIs are available. ```dart Future startScreenShareMobile() async { await _engine.startScreenCapture( const ScreenCaptureParameters2( captureAudio: true, captureVideo: true, ), ); _isScreenSharing = true; } ``` -------------------------------- ### iOS Platform Configuration Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/cxx/CMakeLists.txt Configures the build for iOS. It sets the library directory, defines frameworks to link, and sets target properties including framework identifier, version, and link flags. This setup is for integrating the Agora SDK as a framework on iOS. ```cmake set(LIBS_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ) set(FRAMEWORKS "-framework AgoraRtcWrapper" ) set_target_properties(${LIBRARY_NAME} properties FRAMEWORK TRUE FRAMEWORK_VERSION A MACOSX_FRAMEWORK_IDENTIFIER io.agora.iris.it CXX_VISIBILITY_PRESET hidden LINK_FLAGS "-Wl -F ${LIBS_DIR} -rpath ${CMAKE_CURRENT_SOURCE_DIR}/../../ios/Pods/AgoraRtcEngine_iOS" ) target_link_libraries(${LIBRARY_NAME} PUBLIC "${FRAMEWORKS}" ) ``` -------------------------------- ### Set Minimum CMake Version and Project Name Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/CMakeLists.txt Specifies the minimum required CMake version and defines the project name. This is a standard CMake setup. ```cmake cmake_minimum_required(VERSION 3.14) project(fake_test_app LANGUAGES CXX) ``` -------------------------------- ### Custom command to assemble Flutter library and headers Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/linux/flutter/CMakeLists.txt This custom command uses the Flutter tool backend script to generate the Flutter library and its associated headers. The `_phony_` target is used to ensure the command runs every time, as there's no direct way to get a full input/output list from the Flutter tool. ```cmake add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### Initialize and Control Media Player Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt This snippet demonstrates initializing the RtcEngineEx, creating a MediaPlayerController, registering event observers, and opening a media file. It includes basic playback controls like play, pause, stop, and seeking using a slider. ```dart import 'package:agora_rtc_engine/agora_rtc_engine.dart'; import 'package:flutter/material.dart'; class MediaPlayerWidget extends StatefulWidget { @override _MediaPlayerWidgetState createState() => _MediaPlayerWidgetState(); } class _MediaPlayerWidgetState extends State { late RtcEngineEx _engine; late MediaPlayerController _mediaPlayerController; bool _isPlaying = false; int _duration = 0; int _position = 0; @override void initState() { super.initState(); _initMediaPlayer(); } Future _initMediaPlayer() async { _engine = createAgoraRtcEngineEx(); await _engine.initialize(RtcEngineContext(appId: 'your-app-id')); // Create media player controller _mediaPlayerController = MediaPlayerController( rtcEngine: _engine, canvas: const VideoCanvas(uid: 0), ); await _mediaPlayerController.initialize(); // Register player event observer _mediaPlayerController.registerPlayerSourceObserver( MediaPlayerSourceObserver( onPlayerSourceStateChanged: (state, ec) async { if (state == MediaPlayerState.playerStateOpenCompleted) { _duration = await _mediaPlayerController.getDuration(); setState(() {}); } else if (state == MediaPlayerState.playerStatePlaying) { setState(() => _isPlaying = true); } else if (state == MediaPlayerState.playerStatePaused || state == MediaPlayerState.playerStateStopped) { setState(() => _isPlaying = false); } }, onPositionChanged: (positionMs, timestampMs) { setState(() => _position = positionMs); }, ), ); // Open media file await _mediaPlayerController.open( url: 'https://example.com/video.mp4', startPos: 0, ); } @override Widget build(BuildContext context) { return Column( children: [ // Video display Expanded( child: AgoraVideoView(controller: _mediaPlayerController), ), // Progress slider Slider( value: _position.toDouble(), max: _duration.toDouble(), onChanged: (value) { _mediaPlayerController.seek(value.toInt()); }, ), // Controls Row( mainAxisAlignment: MainAxisAlignment.center, children: [ IconButton( icon: Icon(_isPlaying ? Icons.pause : Icons.play_arrow), onPressed: () { if (_isPlaying) { _mediaPlayerController.pause(); } else { _mediaPlayerController.play(); } }, ), IconButton( icon: Icon(Icons.stop), onPressed: () => _mediaPlayerController.stop(), ), ], ), ], ); } @override void dispose() { _mediaPlayerController.dispose(); _engine.release(); super.dispose(); } } ``` -------------------------------- ### Initialize Agora SDK and Enable Audio Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt Initializes the Agora RTC engine and enables audio. Ensure you replace 'your-app-id' with your actual App ID. ```dart import 'package:agora_rtc_engine/agora_rtc_engine.dart'; class VoiceEffectsExample { late RtcEngine _engine; Future initialize() async { _engine = createAgoraRtcEngine(); await _engine.initialize(RtcEngineContext(appId: 'your-app-id')); await _engine.enableAudio(); await _engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster); } ``` -------------------------------- ### Install AOT Library Conditionally Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/linux/CMakeLists.txt Installs the AOT library only on non-debug builds. Ensure CMAKE_BUILD_TYPE is not 'Debug' before running. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install ICU Data File Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/CMakeLists.txt Installs the ICU data file to the data directory within the application bundle. This is part of the runtime components. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Run Rendering Test on macOS/Windows Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/README.md Execute the rendering test for macOS and Windows platforms. Ensure you replace `` with your actual App ID. ```bash flutter test integration_test/agora_video_view_render_test.dart \ --dart-define=TEST_APP_ID="" ``` -------------------------------- ### Initialize RtcEngine and PiP Controller Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/docs/integration/Picture-in-Picture.md Initializes the Agora RTC engine and creates a Picture-in-Picture controller. Ensure RtcEngine is properly configured before initialization. ```dart import 'package:agora_rtc_engine/agora_rtc_engine.dart'; // Declare controllers late final RtcEngine _engine; late final AgoraPipController _pipController; // Create and initialize RtcEngine _engine = createAgoraRtcEngine(); await _engine.initialize(RtcEngineContext( // ... configuration )); // Create PiP controller _pipController = _engine.createPipController(); ``` -------------------------------- ### Run Rendering Test on Android/iOS Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/README.md Execute the rendering test for Android and iOS platforms. Ensure you replace `` with your actual App ID. ```bash flutter drive --driver=test_driver/integration_test.dart \ --target=integration_test/agora_video_view_render_test.dart \ --dart-define=TEST_APP_ID="" ``` -------------------------------- ### System-Level Dependencies Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/linux/CMakeLists.txt Finds and checks for the PkgConfig and GTK+ 3.0 modules, making them available for use. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) ``` -------------------------------- ### Define AOT Library Path Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/windows/flutter/CMakeLists.txt Sets the path to the Ahead-Of-Time (AOT) compiled library. This is published to the parent scope for the install step. ```cmake set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) ``` -------------------------------- ### Initialize Agora SDK and Join Channel Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/example/example.md Initializes the Agora RTC engine, requests necessary permissions, and joins a channel. Ensure you replace placeholder values for App ID, Token, and Channel Name. ```dart import 'dart:async'; import 'package:agora_rtc_engine/agora_rtc_engine.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler/permission_handler.dart'; const appId = "<-- Insert App Id -->"; const token = "<-- Insert Token -->"; const channel = "<-- Insert Channel Name -->"; void main() => runApp(const MaterialApp(home: MyApp())); class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override State createState() => _MyAppState(); } class _MyAppState extends State { int? _remoteUid; bool _localUserJoined = false; late RtcEngine _engine; @override void initState() { super.initState(); initAgora(); } Future initAgora() async { // retrieve permissions await [Permission.microphone, Permission.camera].request(); //create the engine _engine = createAgoraRtcEngine(); await _engine.initialize(const RtcEngineContext( appId: appId, channelProfile: ChannelProfileType.channelProfileLiveBroadcasting, )); _engine.registerEventHandler( RtcEngineEventHandler( onJoinChannelSuccess: (RtcConnection connection, int elapsed) { debugPrint("local user ${connection.localUid} joined"); setState(() { _localUserJoined = true; }); }, onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { debugPrint("remote user $remoteUid joined"); setState(() { _remoteUid = remoteUid; }); }, onUserOffline: (RtcConnection connection, int remoteUid, UserOfflineReasonType reason) { debugPrint("remote user $remoteUid left channel"); setState(() { _remoteUid = null; }); }, onTokenPrivilegeWillExpire: (RtcConnection connection, String token) { debugPrint( '[onTokenPrivilegeWillExpire] connection: ${connection.toJson()}, token: $token'); }, ), ); await _engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster); await _engine.enableVideo(); await _engine.startPreview(); await _engine.joinChannel( token: token, channelId: channel, uid: 0, options: const ChannelMediaOptions(), ); } @override void dispose() { super.dispose(); _dispose(); } Future _dispose() async { await _engine.leaveChannel(); await _engine.release(); } // Create UI with local view and remote view @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Agora Video Call'), ), body: Stack( children: [ Center( child: _remoteVideo(), ), Align( alignment: Alignment.topLeft, child: SizedBox( width: 100, height: 150, child: Center( child: _localUserJoined ? AgoraVideoView( controller: VideoViewController( rtcEngine: _engine, canvas: const VideoCanvas(uid: 0), ), ) : const CircularProgressIndicator(), ), ), ), ], ), ); } // Display remote user's video Widget _remoteVideo() { if (_remoteUid != null) { return AgoraVideoView( controller: VideoViewController.remote( rtcEngine: _engine, canvas: VideoCanvas(uid: _remoteUid), connection: const RtcConnection(channelId: channel), ), ); } else { return const Text( 'Please wait for remote user to join', textAlign: TextAlign.center, ); } } } ``` -------------------------------- ### Project Configuration Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/windows/CMakeLists.txt Sets the project name and configures the CXX language for the project. ```cmake set(PROJECT_NAME "agora_rtc_engine") project(${PROJECT_NAME} LANGUAGES CXX) ``` -------------------------------- ### Bundle System VCRUNTIME DLLs Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/windows/CMakeLists.txt Installs specific Visual C++ Runtime DLLs to the application bundle to prevent conflicts with system-wide versions. ```cmake set(SYSTEM_VCRUNTIME_DIR "C:/Windows/System32") if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/vcruntime140.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/vcruntime140.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/vcruntime140_1.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/vcruntime140_1.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/msvcp140.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/msvcp140.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/msvcp140_1.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/msvcp140_1.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/msvcp140_2.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/msvcp140_2.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() if(EXISTS "${SYSTEM_VCRUNTIME_DIR}/msvcp140_codecvt_ids.dll") install(FILES "${SYSTEM_VCRUNTIME_DIR}/msvcp140_codecvt_ids.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Initialize Flutter Web App with Agora SDK Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/web/index.html This JavaScript snippet is used for web deployment to load the Flutter engine and run the application. Ensure the `serviceWorkerVersion` is correctly set. ```javascript var serviceWorkerVersion = null; window.addEventListener('load', function(ev) { // Download main.dart.js _flutter.loader.loadEntrypoint({ serviceWorker: { serviceWorkerVersion: serviceWorkerVersion, } }).then(function(engineInitializer) { return engineInitializer.initializeEngine(); }).then(function(appRunner) { return appRunner.runApp(); }); }); ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/windows/CMakeLists.txt Applies standard build settings from the application-level CMakeLists.txt. This can be removed if full control over build settings is desired. ```cmake apply_standard_settings(${PLUGIN_NAME}) ``` -------------------------------- ### Join Communication Channel Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt Joins a channel to start real-time audio/video communication with other users in the same channel. The channel name and token are required for authentication. ```APIDOC ## joinChannel - Join a Communication Channel ### Description Joins a channel to start real-time audio/video communication with other users in the same channel. The channel name and token are required for authentication. ### Method `joinChannel` ### Endpoint N/A (Method call on `RtcEngine` instance) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Parameters are passed directly to the method) ### Request Example ```dart import 'package:agora_rtc_engine/agora_rtc_engine.dart'; final RtcEngine engine = createAgoraRtcEngine(); await engine.initialize(RtcEngineContext(appId: 'your-app-id')); // Enable video before joining await engine.enableVideo(); // Set client role (broadcaster can send and receive, audience can only receive) await engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster); // Join the channel await engine.joinChannel( token: 'your-token', // Use empty string for testing, token required in production channelId: 'test-channel', uid: 0, // 0 means SDK assigns a UID automatically options: ChannelMediaOptions( channelProfile: ChannelProfileType.channelProfileLiveBroadcasting, clientRoleType: ClientRoleType.clientRoleBroadcaster, publishCameraTrack: true, publishMicrophoneTrack: true, autoSubscribeVideo: true, autoSubscribeAudio: true, ), ); // Leave the channel when done await engine.leaveChannel(); ``` ### Response #### Success Response (200) Indicates successful joining of the channel. Specific return values depend on the SDK implementation, but typically this method is void or returns a status code. #### Response Example ```dart // No direct return value shown in example, success indicated by absence of errors and subsequent callbacks like onJoinChannelSuccess. ``` ``` -------------------------------- ### Set Flutter Library Paths Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/example/windows/flutter/CMakeLists.txt Configures the path to the Flutter Windows DLL and ICU data file. These are published to the parent scope for the install step. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) ``` -------------------------------- ### enableAudio / enableVideo - Enable Audio/Video Modules Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt These methods allow you to enable or disable the audio and video modules. It's recommended to call them before joining a channel to configure the media types for your call. ```APIDOC ## enableAudio / enableVideo - Enable Audio/Video Modules ### Description Enables or disables the audio and video modules. Call these methods before joining a channel to configure what media types to use. ### Methods - `enableAudio()`: Enables the audio module. - `disableAudio()`: Disables the audio module. - `enableVideo()`: Enables the video module. - `disableVideo()`: Disables the video module. ### Usage Examples #### Video Call Configuration ```dart import 'package:agora_rtc_engine/agora_rtc_engine.dart'; final RtcEngine engine = createAgoraRtcEngine(); await engine.initialize(RtcEngineContext(appId: 'your-app-id')); // For video call - enable both audio and video await engine.enableAudio(); await engine.enableVideo(); // Configure video encoder settings await engine.setVideoEncoderConfiguration(VideoEncoderConfiguration( dimensions: VideoDimensions(width: 640, height: 480), frameRate: 15, bitrate: 800, orientationMode: OrientationMode.orientationModeAdaptive, )); // Set audio profile and scenario await engine.setAudioProfile( profile: AudioProfileType.audioProfileDefault, scenario: AudioScenarioType.audioScenarioChatroom, ); ``` #### Audio-Only Call Configuration ```dart // For audio-only call await engine.enableAudio(); await engine.disableVideo(); ``` #### Mute/Disable Local Streams ```dart // Mute/unmute local audio/video await engine.muteLocalAudioStream(true); // Mute mic await engine.muteLocalVideoStream(true); // Disable camera await engine.enableLocalAudio(false); // Disable audio module await engine.enableLocalVideo(false); // Disable video module ``` ``` -------------------------------- ### Export Flutter library and ICU data Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/flutter/CMakeLists.txt Exports the Flutter library path and the ICU data file to the parent scope. This makes them available for the install step. ```cmake set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) ``` ```cmake set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) ``` ```cmake set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) ``` ```cmake set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) ``` -------------------------------- ### Define Include Directories and Link Libraries Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/windows/CMakeLists.txt Specifies interface include directories and links necessary libraries. Add any plugin-specific dependencies here. ```cmake target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) ``` -------------------------------- ### Configure Include Directories Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/windows/CMakeLists.txt Specifies interface and private include directories for the plugin, including SDK-specific paths. ```cmake target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include" PRIVATE "${IRIS_INCLUDE_DIR}" "${NATIVE_INCLUDE_DIR}" ) ``` -------------------------------- ### Define Flutter library and header paths Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/linux/flutter/CMakeLists.txt Sets variables for the Flutter library path and ICU data file. These are published to the parent scope for use in the installation step. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) ``` -------------------------------- ### Create and Use Data Streams in Flutter Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt Initializes the Agora SDK, creates a data stream with specified configurations (syncWithAudio, ordered), and handles incoming stream messages. Requires app ID and token for joining the channel. ```dart import 'dart:convert'; import 'dart:typed_data'; import 'package:agora_rtc_engine/agora_rtc_engine.dart'; class DataChannelExample { late RtcEngine _engine; int? _dataStreamId; Future initialize() async { _engine = createAgoraRtcEngine(); await _engine.initialize(RtcEngineContext(appId: 'your-app-id')); _engine.registerEventHandler(RtcEngineEventHandler( onJoinChannelSuccess: (connection, elapsed) async { // Create data stream after joining channel _dataStreamId = await _engine.createDataStream( const DataStreamConfig( syncWithAudio: false, // true to sync with audio timeline ordered: true, // true for ordered delivery ), ); print('Data stream created: $_dataStreamId'); }, onStreamMessage: (connection, remoteUid, streamId, data, length, sentTs) { // Receive message from remote user String message = utf8.decode(data); print('Message from $remoteUid: $message'); }, onStreamMessageError: (connection, remoteUid, streamId, code, missed, cached) { print('Stream message error: $code, missed: $missed'); }, )); await _engine.enableVideo(); } Future joinChannel() async { await _engine.joinChannel( token: 'your-token', channelId: 'data-channel', uid: 0, options: const ChannelMediaOptions( clientRoleType: ClientRoleType.clientRoleBroadcaster, ), ); } // Send text message Future sendTextMessage(String text) async { if (_dataStreamId == null) return; final Uint8List data = Uint8List.fromList(utf8.encode(text)); await _engine.sendStreamMessage( streamId: _dataStreamId!, data: data, length: data.length, ); } // Send JSON data Future sendJsonMessage(Map json) async { if (_dataStreamId == null) return; final String jsonString = jsonEncode(json); final Uint8List data = Uint8List.fromList(utf8.encode(jsonString)); await _engine.sendStreamMessage( streamId: _dataStreamId!, data: data, length: data.length, ); } } // Usage example: // await dataChannel.sendTextMessage('Hello everyone!'); // await dataChannel.sendJsonMessage({'type': 'reaction', 'emoji': '👍'}); ``` -------------------------------- ### Set Minimum CMake Version and Project Name Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/example/windows/CMakeLists.txt Specifies the minimum required CMake version and sets the project name. This is a standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 3.14) project(iris_tester_example LANGUAGES CXX) ``` -------------------------------- ### Define application wrapper sources Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/flutter/CMakeLists.txt Lists the C++ source files for the application wrapper. These are prepended with the wrapper root directory. ```cmake list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) ``` ```cmake list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") ``` -------------------------------- ### Configure Audio and Video Modules Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt Enable or disable audio and video modules before joining a channel. Configure video encoder settings, audio profiles, and scenarios. Mute or unmute local audio/video streams and enable/disable local audio/video modules as needed. ```dart import 'package:agora_rtc_engine/agora_rtc_engine.dart'; final RtcEngine engine = createAgoraRtcEngine(); await engine.initialize(RtcEngineContext(appId: 'your-app-id')); // For video call - enable both audio and video await engine.enableAudio(); await engine.enableVideo(); // Configure video encoder settings await engine.setVideoEncoderConfiguration(VideoEncoderConfiguration( dimensions: VideoDimensions(width: 640, height: 480), frameRate: 15, bitrate: 800, orientationMode: OrientationMode.orientationModeAdaptive, )); // Set audio profile and scenario await engine.setAudioProfile( profile: AudioProfileType.audioProfileDefault, scenario: AudioScenarioType.audioScenarioChatroom, ); // For audio-only call await engine.enableAudio(); await engine.disableVideo(); // Mute/unmute local audio/video await engine.muteLocalAudioStream(true); // Mute mic await engine.muteLocalVideoStream(true); // Disable camera await engine.enableLocalAudio(false); // Disable audio module await engine.enableLocalVideo(false); // Disable video module ``` -------------------------------- ### Update Screenshots on Web Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/rendering_test/README.md Update golden screenshots for the web platform by setting the `UPDATE_GOLDEN` environment variable. Requires ChromeDriver setup. Ensure you replace `` with your actual App ID. ```bash export UPDATE_GOLDEN="true" flutter drive --driver=test_driver/integration_test.dart \ --target=integration_test/agora_video_view_render_test.dart \ --dart-define=TEST_APP_ID="" \ -d web-server ``` -------------------------------- ### Set Flutter library and ICU data for parent scope Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/integration_test_app/windows/flutter/CMakeLists.txt Exports the Flutter library path and the ICU data file path to the parent CMake scope. This makes them available for the install step. ```cmake set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) ``` -------------------------------- ### Include Download SDK Script Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/windows/CMakeLists.txt Includes a CMake script responsible for downloading the SDK. ```cmake include(cmake/DownloadSDK.cmake) ``` -------------------------------- ### Print SDK Directory Information Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/windows/CMakeLists.txt Prints the include and library directories for the SDK. Useful for debugging. ```cmake message("IRIS_INCLUDE_DIR: ${IRIS_INCLUDE_DIR}") message("IRIS_LIB_DIR: ${IRIS_LIB_DIR}") message("NATIVE_INCLUDE_DIR: ${NATIVE_INCLUDE_DIR}") message("NATIVE_LIB_DIR: ${NATIVE_LIB_DIR}") ``` -------------------------------- ### Initialize Agora RTC Engine and Register Event Handlers Source: https://context7.com/agoraio-extensions/agora-flutter-sdk/llms.txt Create an RTC engine instance, initialize it with your App ID and channel profile, and register event handlers to receive callbacks for various events like errors, channel joining, and user status changes. Call this before any other API. Clean up with `engine.release()` when done. ```dart import 'package:agora_rtc_engine/agora_rtc_engine.dart'; // Create the RTC engine instance final RtcEngine engine = createAgoraRtcEngine(); // Initialize with your App ID await engine.initialize(RtcEngineContext( appId: 'your-agora-app-id', channelProfile: ChannelProfileType.channelProfileLiveBroadcasting, )); // Register event handler to receive callbacks engine.registerEventHandler(RtcEngineEventHandler( onError: (ErrorCodeType err, String msg) { print('Error: $err, Message: $msg'); }, onJoinChannelSuccess: (RtcConnection connection, int elapsed) { print('Joined channel: ${connection.channelId}'); }, onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { print('Remote user joined: $remoteUid'); }, onUserOffline: (RtcConnection connection, int remoteUid, UserOfflineReasonType reason) { print('Remote user offline: $remoteUid'); }, onLeaveChannel: (RtcConnection connection, RtcStats stats) { print('Left channel'); }, )); // Clean up when done await engine.release(); ``` -------------------------------- ### Find and check PkgConfig modules for GTK, GLIB, and GIO Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/linux/flutter/CMakeLists.txt This section uses PkgConfig to find and check for the required GTK, GLIB, and GIO modules. The `REQUIRED` keyword ensures that the build fails if these modules are not found. `IMPORTED_TARGET` makes the found modules available as imported targets. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) ``` -------------------------------- ### Windows Platform Configuration Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/iris_tester/cxx/CMakeLists.txt Configures library linking for Windows. It specifies the path to the AgoraRtcWrapper.lib file and links it to the target library. This assumes a specific directory structure for the Windows SDK. ```cmake else() set(IRIS_SDK_DOWNLOAD_NAME "iris_3.7.0.3_RTC_Windows_20220719_0357") set(LIBS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../windows/third_party/iris/${IRIS_SDK_DOWNLOAD_NAME}/x64/Release/AgoraRtcWrapper.lib" ) target_link_libraries(${LIBRARY_NAME} PUBLIC ${LIBS_DIR} ) endif() ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/runner/CMakeLists.txt Applies a standard set of build settings to the target. This can be customized for applications requiring different build configurations. ```cmake # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Define plugin wrapper sources Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/flutter/CMakeLists.txt Lists the C++ source files for the plugin wrapper. These are prepended with the wrapper root directory. ```cmake list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) ``` ```cmake list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") ``` -------------------------------- ### Create static application wrapper library Source: https://github.com/agoraio-extensions/agora-flutter-sdk/blob/main/test_shard/fake_test_app/windows/flutter/CMakeLists.txt Creates a STATIC library target 'flutter_wrapper_app' using core and application wrapper sources. It applies standard settings and configures includes. ```cmake add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) ``` ```cmake apply_standard_settings(flutter_wrapper_app) ``` ```cmake target_link_libraries(flutter_wrapper_app PUBLIC flutter) ``` ```cmake target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) ``` ```cmake add_dependencies(flutter_wrapper_app flutter_assemble) ```