AgoraIO-Extensions / AgoraIO-Extensions/Agora-Flutter-SDK

muteLocalAudioStream(true) stops my video streaming

Aperta
#2,544 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Dart
Stelle
795
Fork
448
Merge medio
12h 19m
PR unite (30g)
14

Descrizione

### Version of the agora_rtc_engine

6.5.3

### Platforms affected

- [x] Android
- [ ] iOS
- [ ] macOS
- [ ] Windows
- [x] Web

### Steps to reproduce

1. Web user enter in new chat
2. App user join in same chat
3. App user calls engine?.muteLocalAudioStream(true)

### Expected results

app user's mic should be muted.

### Actual results

Mic get muted, but also web user report the video of app user stops.
only returning when app user calls
engine?.enableLocalVideo(false);
engine?.enableLocalVideo(true);

if just call enable video true, dont work.

### Code sample

Code sample

```dart
Future setResolution() async {
final (width, height) = await rc.getVideoDimensions();
engine?.setVideoEncoderConfiguration(
VideoEncoderConfiguration(
dimensions: VideoDimensions(width: width, height: height),
// frameRate: VideoFrameRate.videoFrameRateFps15,
// bitrate: 0,
orientationMode: .orientationModeFixedPortrait,
),
);
}

Future initAgora() async {
if (cubit.credentials == null) return;
final agoraAppId = cubit.credentials!.appId;

await [Permission.microphone, Permission.camera].request();

engine = createAgoraRtcEngine();
if (engine == null) return;

await engine!.initialize(
RtcEngineContext(
appId: agoraAppId,
channelProfile: .channelProfileCommunication,
audioScenario: .audioScenarioMeeting,
),
);

engine!.registerEventHandler(
RtcEngineEventHandler(
onJoinChannelSuccess: (_, _) {
cubit.setLocalUserJoined(true);
cubit.logUserJoin(widget.schedule.id);
},
onRejoinChannelSuccess: (_, _) => cubit.setLocalUserJoined(true),
onUserJoined: (_, remoteUid, _) => cubit.setRemoteUid(remoteUid),
onUserOffline: (_, _, _) => cubit.setRemoteUid(null),
onUserEnableLocalVideo: (_, _, enabled) =>
cubit.setPartnerVideoEnabled(enabled),
onUserMuteAudio: (_, _, muted) => cubit.setPartnerAudioEnabled(!muted),
onTokenPrivilegeWillExpire: (connection, token) {},
),
);

await engine!.setClientRole(role: ClientRoleType.clientRoleBroadcaster);
await engine!.enableVideo();
await engine!.startPreview();

final token = cubit.credentials!.token;
await engine!.joinChannel(
token: token,
channelId: cubit.credentials!.channelName,
uid: 0,
options: ChannelMediaOptions(),
);
setResolution();
}

@override
void initState() {
super.initState();
cubit = VideoCallCubit(locator());
_validateAndInitialize();
}

Future _validateAndInitialize() async {
final isValid = await cubit.checkScheduleStatus(widget.schedule.id);

if (!isValid) {
if (mounted) {
await showDialog(
context: context,
barrierDismissible: false,
builder: (context) => AlertDialog(
title: const Text('Atenção'),
content: const Text(
'Não foi possível acessar a chamada. '
'Verifique se o agendamento está confirmado e dentro do horário permitido.',
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Voltar'),
),
],
),
);
if (mounted) {
Navigator.of(context).pop();
}
}
return;
}

if (widget.schedule.callCredential != null) {
cubit.setCredentials(widget.schedule.callCredential!);
initAgora();
} else {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Credenciais de chamada não encontradas.'),
),
);
}
}
}

// void _toggleSound() {
// cubit.toggleSound();
// engine?.muteAllRemoteAudioStreams(!cubit.state.soundEnabled);
// }

void _toggleMic() {
cubit.toggleMic();
engine?.muteLocalAudioStream(cubit.state.micEnabled);
}

void _toggleVideo() {
cubit.toggleVideo();
engine?.enableLocalVideo(cubit.state.videoEnabled);
}
```

### Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

### Logs

Logs

```console
[Paste your logs here]
```

### Flutter Doctor output

Doctor output

```console

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.38.5, on macOS 26.2 25C56 darwin-arm64, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.2)
[✓] Chrome - develop for the web
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
➜ celebre git:(master) fvm flutter doctor -v
[✓] Flutter (Channel stable, 3.38.5, on macOS 26.2 25C56 darwin-arm64, locale en-BR) [240ms]
• Flutter version 3.38.5 on channel stable at /Users/mariovitor/fvm/versions/3.38.5
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f6ff1529fd (7 weeks ago), 2025-12-11 11:50:07 -0500
• Engine revision 1527ae0ec5
• Dart version 3.10.4
• DevTools version 2.51.1
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file,
enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [998ms]
• Android SDK at /Users/mariovitor/Library/Android/sdk
• Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
• Platform android-36, build-tools 36.0.0
• ANDROID_HOME = /Users/mariovitor/Library/Android/sdk
• Java binary at: /Users/mariovitor/.jenv/versions/corretto64-17.0.14/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment Corretto-17.0.14.7.1 (build 17.0.14+7-LTS)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.2) [752ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17C52
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web [5ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (4 available) [6.0s]
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 16 (API 36) (emulator)
• iPhone de Mario Vitor (wireless) (mobile) • 00008030-001E446A3EA2202E • ios • iOS 26.2 23C55
• macOS (desktop) • macos • darwin-arm64 • macOS 26.2 25C56 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 144.0.7559.97

[✓] Network resources [283ms]
• All expected network resources are available.

• No issues found!
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.