Fake call audio level

This commit is contained in:
2025-10-19 19:34:22 +08:00
parent 844efcda1a
commit 0622498f4e
4 changed files with 164 additions and 18 deletions

View File

@@ -49,20 +49,12 @@ sealed class CallParticipantLive with _$CallParticipantLive {
}) = _CallParticipantLive;
bool get isSpeaking {
// Simple speaking detection based on audio level analysis
// This is a basic implementation - in a real app you'd want more sophisticated VAD
final stream = remoteParticipant.remoteStream;
if (stream == null) return false;
// Check if any audio tracks are enabled and have recent activity
final audioTracks = stream.getAudioTracks();
if (audioTracks.isEmpty) return false;
// For now, just return true if audio is enabled (simplified)
// In a real implementation, you'd analyze audio levels using WebRTC stats
return remoteParticipant.isAudioEnabled;
// Use the actual audio level from WebRTC monitoring
return remoteParticipant.audioLevel > 0.1; // Threshold for speaking
}
double get audioLevel => remoteParticipant.audioLevel;
bool get isMuted => !remoteParticipant.isAudioEnabled;
bool get isScreenSharing => remoteParticipant.isVideoEnabled; // Simplified
bool get isScreenSharingWithAudio => false; // TODO: Implement screen sharing
@@ -88,6 +80,7 @@ class CallNotifier extends _$CallNotifier {
String? _roomId;
String? get roomId => _roomId;
WebRTCManager? get webrtcManager => _webrtcManager;
@override
CallState build() {