diff --git a/packages/hms_room_kit/lib/src/preview/preview_store.dart b/packages/hms_room_kit/lib/src/preview/preview_store.dart index c1d722b06..971273c6e 100644 --- a/packages/hms_room_kit/lib/src/preview/preview_store.dart +++ b/packages/hms_room_kit/lib/src/preview/preview_store.dart @@ -171,7 +171,7 @@ class PreviewStore extends ChangeNotifier @override void onRoomUpdate({required HMSRoom room, required HMSRoomUpdate update}) { this.room = room; - log("onRoomUpdate-> room: ${room.toString()} update: ${update.name}"); + log("onRoomUpdate-> room: ${room.toString()} update: ${update.name} streamingState: ${room.hmshlsStreamingState?.state.name}"); switch (update) { case HMSRoomUpdate.browserRecordingStateUpdated: isRecordingStarted = @@ -194,10 +194,8 @@ class PreviewStore extends ChangeNotifier case HMSRoomUpdate.hlsStreamingStateUpdated: isHLSStreamingStarted = room.hmshlsStreamingState?.state == HMSStreamingState.started; - if (!isMeetingJoined && isRoomJoined) { - isRoomJoinedAndHLSStarted = - (room.hmshlsStreamingState?.state == HMSStreamingState.started) && - isRoomJoined; + if (!isMeetingJoined && isRoomJoined && isHLSStreamingStarted) { + isRoomJoinedAndHLSStarted = true; isMeetingJoined = true; } break; diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSHLSVariantExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSHLSVariantExtension.kt index 823ea8296..bebd5530e 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSHLSVariantExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSHLSVariantExtension.kt @@ -12,7 +12,7 @@ class HMSHLSVariantExtension { args["meeting_url"] = hmshlsVariant.meetingUrl ?: "" args["metadata"] = hmshlsVariant.metadata ?: "" hmshlsVariant.startedAt?.let { - args["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(it).toString() + args["started_at"] = it } return args } diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSRtmpStreamingState.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSRtmpStreamingState.kt index 3fe4ce4bf..04e62b4b2 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSRtmpStreamingState.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSRtmpStreamingState.kt @@ -15,7 +15,7 @@ class HMSStreamingState { map["error"] = HMSExceptionExtension.toDictionary(rtmpStreamingState.error) rtmpStreamingState.startedAt?.let { - map["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(rtmpStreamingState.startedAt).toString() + map["started_at"] = it } map["state"] = rtmpStreamingState.state.name @@ -32,7 +32,7 @@ class HMSStreamingState { map["error"] = HMSExceptionExtension.toDictionary(serverRecordingState.error) serverRecordingState.startedAt?.let { - map["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serverRecordingState.startedAt).toString() + map["started_at"] = it } map["state"] = serverRecordingState.state.name @@ -49,7 +49,7 @@ class HMSStreamingState { map["error"] = HMSExceptionExtension.toDictionary(browserRecordingState.error) browserRecordingState.startedAt?.let { - map["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(browserRecordingState.startedAt).toString() + map["started_at"] = it } map["initialising"] = browserRecordingState.initialising @@ -84,7 +84,7 @@ class HMSStreamingState { map["running"] = hlsRecordingState.running hlsRecordingState.startedAt?.let { - map["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(hlsRecordingState.startedAt).toString() + map["started_at"] = it } map["state"] = hlsRecordingState.state.name diff --git a/packages/hmssdk_flutter/ios/Classes/Models/HMSHLSVariantExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/HMSHLSVariantExtension.swift index 8d02b750e..965b9bd34 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/HMSHLSVariantExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/HMSHLSVariantExtension.swift @@ -25,7 +25,7 @@ class HMSHLSVariantExtension { } if let startedAt = hmshlsVariant.startedAt { - dict["started_at"] = "\(startedAt)" + dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000) } return dict diff --git a/packages/hmssdk_flutter/ios/Classes/Models/HMSStreamingStateExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/HMSStreamingStateExtension.swift index 6b573b123..e1c1895a1 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/HMSStreamingStateExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/HMSStreamingStateExtension.swift @@ -15,7 +15,7 @@ class HMSStreamingStateExtension { dict["running"] = rtmp.running if let startedAt = rtmp.startedAt { - dict["started_at"] = "\(startedAt)" + dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000) } if let error = rtmp.error { dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new } @@ -31,7 +31,7 @@ class HMSStreamingStateExtension { dict["running"] = server.running if let startedAt = server.startedAt { - dict["started_at"] = "\(startedAt)" + dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000) } if let error = server.error { dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new } @@ -49,7 +49,7 @@ class HMSStreamingStateExtension { dict["running"] = browser.running if let startedAt = browser.startedAt { - dict["started_at"] = "\(startedAt)" + dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000) } if let error = browser.error { dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new } @@ -78,7 +78,7 @@ class HMSStreamingStateExtension { dict["running"] = hlsRecording.running if let startedAt = hlsRecording.startedAt { - dict["started_at"] = "\(startedAt)" + dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000) } if let error = hlsRecording.error { dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new } diff --git a/packages/hmssdk_flutter/lib/src/model/hms_browser_recording_state.dart b/packages/hmssdk_flutter/lib/src/model/hms_browser_recording_state.dart index 38b69b49f..60dc9115a 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_browser_recording_state.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_browser_recording_state.dart @@ -24,7 +24,7 @@ class HMSBrowserRecordingState { error: map["error"] != null ? HMSException.fromMap(map) : null, running: map['running'], startedAt: map['started_at'] != null - ? HMSDateExtension.convertDateFromString(map['started_at']) + ? HMSDateExtension.convertDateFromEpoch(map['started_at']) : null, initialising: map['initialising'], state: HMSRecordingStateValues.getRecordingStateFromName( diff --git a/packages/hmssdk_flutter/lib/src/model/hms_hls_recording_state.dart b/packages/hmssdk_flutter/lib/src/model/hms_hls_recording_state.dart index c94bdc9a6..1ded6f1d6 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_hls_recording_state.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_hls_recording_state.dart @@ -24,7 +24,7 @@ class HMSHLSRecordingState { : null, running: map['running'], startedAt: map['started_at'] != null - ? HMSDateExtension.convertDateFromString(map['started_at']) + ? HMSDateExtension.convertDateFromEpoch(map['started_at']) : null, state: HMSRecordingStateValues.getRecordingStateFromName( map['state'] ?? 'NONE')); diff --git a/packages/hmssdk_flutter/lib/src/model/hms_hls_variant.dart b/packages/hmssdk_flutter/lib/src/model/hms_hls_variant.dart index d875b9f06..70cd49f67 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_hls_variant.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_hls_variant.dart @@ -38,7 +38,7 @@ class HMSHLSVariant { meetingUrl: map['meeting_url'] as String?, metadata: map['metadata'] as String?, startedAt: map['started_at'] != null - ? HMSDateExtension.convertDateFromString(map['started_at']) + ? HMSDateExtension.convertDateFromEpoch(map['started_at']) : null, ); } diff --git a/packages/hmssdk_flutter/lib/src/model/hms_rtmp_streaming_state.dart b/packages/hmssdk_flutter/lib/src/model/hms_rtmp_streaming_state.dart index d6c64c9c2..dc0af80e6 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_rtmp_streaming_state.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_rtmp_streaming_state.dart @@ -22,7 +22,7 @@ class HMSRtmpStreamingState { error: map["error"] != null ? HMSException.fromMap(map) : null, running: map['running'], startedAt: map['started_at'] != null - ? HMSDateExtension.convertDateFromString(map['started_at']) + ? HMSDateExtension.convertDateFromEpoch(map['started_at']) : null, state: HMSStreamingStateValues.getStreamingStateFromName( map['state'] ?? 'NONE')); diff --git a/packages/hmssdk_flutter/lib/src/model/hms_server_recording_state.dart b/packages/hmssdk_flutter/lib/src/model/hms_server_recording_state.dart index edee81a76..d7707b48b 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_server_recording_state.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_server_recording_state.dart @@ -23,7 +23,7 @@ class HMSServerRecordingState { error: map["error"] != null ? HMSException.fromMap(map) : null, running: map['running'], startedAt: map['started_at'] != null - ? HMSDateExtension.convertDateFromString(map['started_at']) + ? HMSDateExtension.convertDateFromEpoch(map['started_at']) : null, state: HMSRecordingStateValues.getRecordingStateFromName( map['state'] ?? 'NONE'));