接入声网四路视频

This commit is contained in:
2026-11-21 14:52:13 +08:00
parent 04fffd2267
commit 739d588a16
26 changed files with 1637 additions and 15 deletions

View File

@@ -30,7 +30,7 @@ class DioClient {
);
dio.interceptors.add(
LogInterceptor(
_ApiLogInterceptor(
requestBody: true,
responseBody: true,
requestHeader: true,
@@ -96,3 +96,38 @@ class DioClient {
return dio;
}
}
class _ApiLogInterceptor extends LogInterceptor {
_ApiLogInterceptor({
super.requestBody,
super.responseBody,
super.requestHeader,
});
bool _hasAgoraResponseLog(RequestOptions options) {
final path = options.uri.path;
return path.endsWith(HttpApiConsts.hostAgoraTokenPath) ||
path.endsWith(HttpApiConsts.hostStartVideoStreamPath);
}
@override
void onResponse(
Response<dynamic> response,
ResponseInterceptorHandler handler,
) {
if (_hasAgoraResponseLog(response.requestOptions)) {
handler.next(response);
return;
}
super.onResponse(response, handler);
}
@override
void onError(DioException error, ErrorInterceptorHandler handler) {
if (_hasAgoraResponseLog(error.requestOptions)) {
handler.next(error);
return;
}
super.onError(error, handler);
}
}