fix: voip code breaking from 0.28
have not tested it but should mostly be fine, rewrite should get in someday anyway :p
This commit is contained in:
parent
57f0962921
commit
4095560412
10 changed files with 124 additions and 115 deletions
|
|
@ -1269,25 +1269,12 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
);
|
||||
if (callType == null) return;
|
||||
|
||||
final success = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () =>
|
||||
Matrix.of(context).voipPlugin!.voip.requestTurnServerCredentials(),
|
||||
);
|
||||
if (success.result != null) {
|
||||
final voipPlugin = Matrix.of(context).voipPlugin;
|
||||
try {
|
||||
await voipPlugin!.voip.inviteToCall(room.id, callType);
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(e.toLocalizedString(context))),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.unavailable,
|
||||
okLabel: L10n.of(context)!.next,
|
||||
final voipPlugin = Matrix.of(context).voipPlugin;
|
||||
try {
|
||||
await voipPlugin!.voip.inviteToCall(room, callType);
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(e.toLocalizedString(context))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
icon: Icons.send_outlined,
|
||||
),
|
||||
if (spaceChild != null &&
|
||||
(activeSpace?.canChangeStateEvent(EventTypes.spaceChild) ?? false))
|
||||
(activeSpace?.canChangeStateEvent(EventTypes.SpaceChild) ?? false))
|
||||
SheetAction(
|
||||
key: SpaceChildContextAction.removeFromSpace,
|
||||
label: L10n.of(context)!.removeFromSpace,
|
||||
|
|
@ -474,7 +474,7 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
onTap: () => _onJoinSpaceChild(spaceChild),
|
||||
),
|
||||
if (activeSpace?.canChangeStateEvent(
|
||||
EventTypes.spaceChild,
|
||||
EventTypes.SpaceChild,
|
||||
) ==
|
||||
true)
|
||||
Material(
|
||||
|
|
|
|||
|
|
@ -25,13 +25,14 @@ import 'package:flutter/services.dart';
|
|||
|
||||
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart';
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart' hide VideoRenderer;
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/utils/voip/video_renderer.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import 'pip/pip_view.dart';
|
||||
|
||||
|
|
@ -75,19 +76,13 @@ class _StreamView extends StatelessWidget {
|
|||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
if (videoMuted)
|
||||
Container(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
if (!videoMuted)
|
||||
RTCVideoView(
|
||||
// yes, it must explicitly be casted even though I do not feel
|
||||
// comfortable with it...
|
||||
wrappedStream.renderer as RTCVideoRenderer,
|
||||
mirror: mirrored,
|
||||
objectFit: RTCVideoViewObjectFit.RTCVideoViewObjectFitContain,
|
||||
),
|
||||
if (videoMuted)
|
||||
VideoRenderer(
|
||||
wrappedStream,
|
||||
mirror: mirrored,
|
||||
fit: RTCVideoViewObjectFit.RTCVideoViewObjectFitContain,
|
||||
),
|
||||
if (videoMuted) ...[
|
||||
Container(color: Colors.black54),
|
||||
Positioned(
|
||||
child: Avatar(
|
||||
mxContent: avatarUrl,
|
||||
|
|
@ -98,6 +93,7 @@ class _StreamView extends StatelessWidget {
|
|||
// matrixClient: matrixClient,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (!isScreenSharing)
|
||||
Positioned(
|
||||
left: 4.0,
|
||||
|
|
@ -159,8 +155,6 @@ class MyCallingPage extends State<Calling> {
|
|||
return null;
|
||||
}
|
||||
|
||||
bool get speakerOn => call.speakerOn;
|
||||
|
||||
bool get isMicrophoneMuted => call.isMicrophoneMuted;
|
||||
|
||||
bool get isLocalVideoMuted => call.isLocalVideoMuted;
|
||||
|
|
@ -175,9 +169,6 @@ class MyCallingPage extends State<Calling> {
|
|||
|
||||
bool get connected => call.state == CallState.kConnected;
|
||||
|
||||
bool get mirrored => call.facingMode == 'user';
|
||||
|
||||
List<WrappedMediaStream> get streams => call.streams;
|
||||
double? _localVideoHeight;
|
||||
double? _localVideoWidth;
|
||||
EdgeInsetsGeometry? _localVideoMargin;
|
||||
|
|
@ -205,12 +196,12 @@ class MyCallingPage extends State<Calling> {
|
|||
final call = this.call;
|
||||
call.onCallStateChanged.stream.listen(_handleCallState);
|
||||
call.onCallEventChanged.stream.listen((event) {
|
||||
if (event == CallEvent.kFeedsChanged) {
|
||||
if (event == CallStateChange.kFeedsChanged) {
|
||||
setState(() {
|
||||
call.tryRemoveStopedStreams();
|
||||
});
|
||||
} else if (event == CallEvent.kLocalHoldUnhold ||
|
||||
event == CallEvent.kRemoteHoldUnhold) {
|
||||
} else if (event == CallStateChange.kLocalHoldUnhold ||
|
||||
event == CallStateChange.kRemoteHoldUnhold) {
|
||||
setState(() {});
|
||||
Logs().i(
|
||||
'Call hold event: local ${call.localHold}, remote ${call.remoteOnHold}',
|
||||
|
|
@ -286,7 +277,7 @@ class MyCallingPage extends State<Calling> {
|
|||
if (call.isRinging) {
|
||||
call.reject();
|
||||
} else {
|
||||
call.hangup();
|
||||
call.hangup(reason: CallErrorCode.userHangup);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -341,11 +332,6 @@ class MyCallingPage extends State<Calling> {
|
|||
await Helper.switchCamera(
|
||||
call.localUserMediaStream!.stream!.getVideoTracks()[0],
|
||||
);
|
||||
if (PlatformInfos.isMobile) {
|
||||
call.facingMode == 'user'
|
||||
? call.facingMode = 'environment'
|
||||
: call.facingMode = 'user';
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
|
@ -450,16 +436,10 @@ class MyCallingPage extends State<Calling> {
|
|||
hangupButton,
|
||||
];
|
||||
case CallState.kFledgling:
|
||||
// TODO: Handle this case.
|
||||
break;
|
||||
case CallState.kWaitLocalMedia:
|
||||
// TODO: Handle this case.
|
||||
break;
|
||||
case CallState.kCreateOffer:
|
||||
// TODO: Handle this case.
|
||||
break;
|
||||
case CallState.kEnding:
|
||||
case null:
|
||||
// TODO: Handle this case.
|
||||
break;
|
||||
}
|
||||
return <Widget>[];
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ class UserBottomSheetView extends StatelessWidget {
|
|||
BorderRadius.circular(AppConfig.borderRadius / 2),
|
||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||
child: DropdownButton<int>(
|
||||
onChanged: user.canChangePowerLevel ||
|
||||
onChanged: user.canChangeUserPowerLevel ||
|
||||
// Workaround until https://github.com/famedly/matrix-dart-sdk/pull/1765
|
||||
(user.room.canChangePowerLevel &&
|
||||
user.id == user.room.client.userID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue