Compares TRTC scene configuration templates against inspection results, generates a structured diff report, and guides the AI Agent or user to adjust source code accordingly.
This skill implements TRTC SDK configuration inspection analysis and modification suggestion generation:
Note: The scripts themselves do not modify any user code. They only generate analysis reports and modification suggestions. Actual code changes are performed by the AI Agent using standard code editing tools (e.g., replace_in_file), and the user can review each modification step.
Trigger this skill when the user makes requests like:
Confirm the following information with the user (if not fully provided):
ParameterDescriptionRequiredScene Config TemplateURL or local path to scene config ExcelRequiredInspection ResultURL or local path to inspection result ExcelRequired (if absent, only output target config)Code Download LinkURL to project code zip/tar.gz or local directory pathRequired
Users may provide input in various ways:
Use the download script to fetch remote files:
bash
python3 SKILL_BASE_DIR/scripts/download_files.py \
--config-url "Scene config Excel URL" \
--inspect-url "Inspection result Excel URL" \
--code-url "Code archive URL" \
--output-dir "SKILL_BASE_DIR/workspace"
This script will:
workspace/config.xlsxworkspace/inspect.xlsxworkspace/code/If the user provides a local file path, skip the download for that file and use the local path directly.
Run the diff script to generate a difference report:
bash
python3 SKILL_BASE_DIR/scripts/diff_config.py "inspection_result_excel_path" "scene_config_excel_path"
The JSON report output contains:
diffs — Config items where current value differs from target value (code modification needed)matches — Config items that already match (no modification needed)unable_to_compare — Items that cannot be automatically compared (manual review needed)If only the scene config template is available (no inspection result), parse the template directly:
bash
python3 SKILL_BASE_DIR/scripts/parse_excel.py "scene_config_excel_path" --type config
Based on the diffs array in the diff report, the AI Agent uses code editing tools to find corresponding API calls in the code and modify parameter values. Below are the mappings between config items and code APIs:
Find enterRoom calls, modify the second parameter.
Config ValueAndroid Code ConstantiOS Code ConstantLive``TRTCCloudDef.TRTC_APP_SCENE_LIVE``TRTCAppSceneLIVE``VideoCall``TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL``TRTCAppSceneVideoCall``AudioCall``TRTCCloudDef.TRTC_APP_SCENE_AUDIOCALL``TRTCAppSceneAudioCall``VoiceChatRoom``TRTCCloudDef.TRTC_APP_SCENE_VOICE_CHATROOM``TRTCAppSceneVoiceChatRoom
Find startLocalAudio calls.
Config ValueAndroid Code ConstantiOS Code ConstantMUSIC``TRTCCloudDef.TRTC_AUDIO_QUALITY_MUSIC``TRTCAudioQualityMusic``DEFAULT``TRTCCloudDef.TRTC_AUDIO_QUALITY_DEFAULT``TRTCAudioQualityDefault``SPEECH``TRTCCloudDef.TRTC_AUDIO_QUALITY_SPEECH``TRTCAudioQualitySpeech
Find setSystemVolumeType calls.
Config ValueAndroid Code ConstantiOS Code Constantmedia``TRTCCloudDef.TRTCSystemVolumeTypeMedia``TRTCSystemVolumeTypeMedia``voip``TRTCCloudDef.TRTCSystemVolumeTypeVOIP``TRTCSystemVolumeTypeVOIP``auto``TRTCCloudDef.TRTCSystemVolumeTypeAuto``TRTCSystemVolumeTypeAuto
Find setVideoEncoderParam calls and TRTCVideoEncParam objects.
CRITICAL — Video encoder params must be compared item by item; do not miss any sub-parameter:
In the scene config Excel, video encoder params (resolution, FPS, bitrate) are split into multiple rows. The diff script outputs independent sub-parameter comparisons. All video encoder sub-parameter diffs must be checked and applied, including:
videoResolutionvideoFps ( frequently missed!)videoBitrateParameterField NameDescriptionResolutionvideoResolutione.g., TRTC_VIDEO_RESOLUTION_1280_720 (720p)FPSvideoFpsInteger, e.g., 15 or 25BitratevideoBitrateInteger (kbps), e.g., 1800Min BitrateminVideoBitrateInteger (kbps)Resolution ModevideoResolutionMode``PORTRAIT or LANDSCAPEAdaptive ResolutionenableAdjustResBoolean
Resolution constant mapping:
TRTC_VIDEO_RESOLUTION_960_540TRTC_VIDEO_RESOLUTION_1280_720TRTC_VIDEO_RESOLUTION_1920_1080Recommended bitrates:
Find setAudioCaptureVolume and setAudioPlayoutVolume calls.
Find callExperimentalAPI calls with JSON string parameters. The Excel code_example column provides the specific JSON structure.
When the AI Agent modifies code, TRTC API calls must follow this order:
TRTCCloud.sharedInstance() — Create instancesetListener() — Set callback listenersetSystemVolumeType() — Set volume type (before enterRoom)callExperimentalAPI() — Experimental settings (before enterRoom)setVideoEncoderParam() — Set video encoder paramsstartLocalPreview() — Start local camera previewstartLocalAudio() — Start local audio captureenterRoom() — Enter roomAfter completing all modifications, output a summary table:
Config ItemBeforeAfterStatusRoom Entry ModeVideoCallLiveModifiedAudio QualityDEFAULTMUSICModifiedSystem Volume TypeVOIPMediaModifiedVideo Resolution640x4801280x720ModifiedVideo FPS15fps25fpsModifiedVideo Bitrate900kbps1800kbpsModified
For items marked as "optional", inform the user and let them decide whether to apply.
openpyxl (auto-installed if missing)requests (auto-installed if missing)ScriptPurposescripts/download_files.pyDownload scene config, inspection result, and code archive from URLs and extractscripts/parse_excel.pyParse a single Excel file (scene config or inspection result) and output structured JSONscripts/diff_config.pyCompare inspection result against scene config template and output diff reportscripts/run_inspector.pyEnd-to-end inspector entry point: download -> parse -> diff -> analyze code -> generate modification plan
download_files.py::download_and_extract(config_url, inspect_url, code_url, output_dir) — Download and extract all resource filesparse_excel.py::parse_config_excel(filepath) — Parse scene config Excelparse_excel.py::parse_inspect_excel(filepath) — Parse inspection result Exceldiff_config.py::diff_configs(inspect_data, config_data) — Compare and output diffscode_example column provides reference implementations; adapt to the project's actual code styleopenpyxl (Excel parsing) and requests (HTTP download), both standard PyPI packages