Room recording event (#252)
* feat: Add room reocording reminder. * chore: comment for recording event.
This commit is contained in:
@@ -136,6 +136,23 @@ extension LKExampleExt on BuildContext {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Future<bool?> showRecordingStatusChangedDialog(bool isActiveRecording) =>
|
||||||
|
showDialog<bool>(
|
||||||
|
context: this,
|
||||||
|
builder: (ctx) => AlertDialog(
|
||||||
|
title: const Text('Room recording reminder'),
|
||||||
|
content: Text(isActiveRecording
|
||||||
|
? 'Room recording is active.'
|
||||||
|
: 'Room recording is stoped.'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(ctx, true),
|
||||||
|
child: const Text('OK'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
Future<bool?> showSubscribePermissionDialog() => showDialog<bool>(
|
Future<bool?> showSubscribePermissionDialog() => showDialog<bool>(
|
||||||
context: this,
|
context: this,
|
||||||
builder: (ctx) => AlertDialog(
|
builder: (ctx) => AlertDialog(
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ class _RoomPageState extends State<RoomPage> {
|
|||||||
WidgetsBindingCompatible.instance
|
WidgetsBindingCompatible.instance
|
||||||
?.addPostFrameCallback((timeStamp) => Navigator.pop(context));
|
?.addPostFrameCallback((timeStamp) => Navigator.pop(context));
|
||||||
})
|
})
|
||||||
|
..on<RoomRecordingStatusChanged>((event) {
|
||||||
|
context.showRecordingStatusChangedDialog(event.activeRecording);
|
||||||
|
})
|
||||||
..on<LocalTrackPublishedEvent>((_) => _sortParticipants())
|
..on<LocalTrackPublishedEvent>((_) => _sortParticipants())
|
||||||
..on<LocalTrackUnpublishedEvent>((_) => _sortParticipants())
|
..on<LocalTrackUnpublishedEvent>((_) => _sortParticipants())
|
||||||
..on<DataReceivedEvent>((event) {
|
..on<DataReceivedEvent>((event) {
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
|||||||
String? get serverRegion => _serverRegion;
|
String? get serverRegion => _serverRegion;
|
||||||
String? _serverRegion;
|
String? _serverRegion;
|
||||||
|
|
||||||
|
bool get isRecording => _isRecording;
|
||||||
|
bool _isRecording = false;
|
||||||
|
|
||||||
/// a list of participants that are actively speaking, including local participant.
|
/// a list of participants that are actively speaking, including local participant.
|
||||||
UnmodifiableListView<Participant> get activeSpeakers =>
|
UnmodifiableListView<Participant> get activeSpeakers =>
|
||||||
UnmodifiableListView<Participant>(_activeSpeakers);
|
UnmodifiableListView<Participant>(_activeSpeakers);
|
||||||
@@ -154,6 +157,12 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
|||||||
_serverVersion = event.response.serverVersion;
|
_serverVersion = event.response.serverVersion;
|
||||||
_serverRegion = event.response.serverRegion;
|
_serverRegion = event.response.serverRegion;
|
||||||
|
|
||||||
|
if (_isRecording != event.response.room.activeRecording) {
|
||||||
|
_isRecording = event.response.room.activeRecording;
|
||||||
|
emitWhenConnected(
|
||||||
|
RoomRecordingStatusChanged(activeRecording: _isRecording));
|
||||||
|
}
|
||||||
|
|
||||||
logger.fine('[Engine] Received JoinResponse, '
|
logger.fine('[Engine] Received JoinResponse, '
|
||||||
'serverVersion: ${event.response.serverVersion}');
|
'serverVersion: ${event.response.serverVersion}');
|
||||||
|
|
||||||
@@ -262,6 +271,11 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
|||||||
_metadata = event.room.metadata;
|
_metadata = event.room.metadata;
|
||||||
emitWhenConnected(
|
emitWhenConnected(
|
||||||
RoomMetadataChangedEvent(metadata: event.room.metadata));
|
RoomMetadataChangedEvent(metadata: event.room.metadata));
|
||||||
|
if (_isRecording != event.room.activeRecording) {
|
||||||
|
_isRecording = event.room.activeRecording;
|
||||||
|
emitWhenConnected(
|
||||||
|
RoomRecordingStatusChanged(activeRecording: _isRecording));
|
||||||
|
}
|
||||||
})
|
})
|
||||||
..on<SignalConnectionStateUpdatedEvent>((event) {
|
..on<SignalConnectionStateUpdatedEvent>((event) {
|
||||||
// during reconnection, need to send sync state upon signal connection.
|
// during reconnection, need to send sync state upon signal connection.
|
||||||
|
|||||||
@@ -87,6 +87,19 @@ class RoomMetadataChangedEvent with RoomEvent {
|
|||||||
String toString() => '${runtimeType}()';
|
String toString() => '${runtimeType}()';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Room recording status has changed.
|
||||||
|
/// Emitted by [Room].
|
||||||
|
class RoomRecordingStatusChanged with RoomEvent {
|
||||||
|
final bool activeRecording;
|
||||||
|
|
||||||
|
const RoomRecordingStatusChanged({
|
||||||
|
required this.activeRecording,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => '${runtimeType}(activeRecording = $activeRecording)';
|
||||||
|
}
|
||||||
|
|
||||||
/// When a new [RemoteParticipant] joins *after* the current participant has connected
|
/// When a new [RemoteParticipant] joins *after* the current participant has connected
|
||||||
/// It will not fire for participants that are already in the room
|
/// It will not fire for participants that are already in the room
|
||||||
/// Emitted by [Room].
|
/// Emitted by [Room].
|
||||||
|
|||||||
Reference in New Issue
Block a user