Skip to content

Commit b4d8c6d

Browse files
authored
Upgrade dependencies (#213)
2 parents 4b7e083 + 0801f39 commit b4d8c6d

File tree

6 files changed

+119
-100
lines changed

6 files changed

+119
-100
lines changed

lib/widgets/device_grid/video_status_label.dart

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,12 @@ class _VideoStatusLabelState extends State<VideoStatusLabel> {
6969
final overlayKey = GlobalKey(debugLabel: 'Label Overlay');
7070

7171
bool get isLoading => widget.video.lastImageUpdate == null;
72-
String get _source => widget.video.player.dataSource!;
73-
bool get isLive =>
74-
widget.video.player.dataSource != null &&
75-
// It is only LIVE if it starts with rtsp or is hls
76-
(_source.startsWith('rtsp') ||
77-
_source.contains('media/mjpeg') ||
78-
_source.contains('.m3u8') /* hls */);
7972

8073
VideoLabel get status => widget.video.error != null
8174
? VideoLabel.error
8275
: isLoading
8376
? VideoLabel.loading
84-
: !isLive
77+
: !widget.video.player.isLive
8578
? VideoLabel.recorded
8679
: widget.video.player.isImageOld
8780
? VideoLabel.timedOut
@@ -105,7 +98,6 @@ class _VideoStatusLabelState extends State<VideoStatusLabel> {
10598
device: widget.device,
10699
video: widget.video,
107100
label: status,
108-
isLive: isLive,
109101
event: widget.event,
110102
);
111103
final minHeight = label.buildTextSpans(context).length * 15;
@@ -248,15 +240,13 @@ class _DeviceVideoInfo extends StatelessWidget {
248240
final Device device;
249241
final VideoViewInheritance video;
250242
final VideoLabel label;
251-
final bool isLive;
252243

253244
final Event? event;
254245

255246
const _DeviceVideoInfo({
256247
required this.device,
257248
required this.video,
258249
required this.label,
259-
required this.isLive,
260250
required this.event,
261251
});
262252

@@ -271,7 +261,7 @@ class _DeviceVideoInfo extends StatelessWidget {
271261
title: loc.server,
272262
data: '${device.server.name} (${device.id})',
273263
);
274-
if (isLive) {
264+
if (video.player.isLive) {
275265
return [
276266
name,
277267
server,

packages/unity_video_player/unity_video_player_platform_interface/lib/unity_video_player_platform_interface.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,12 +437,21 @@ abstract class UnityVideoPlayer with ChangeNotifier {
437437
/// The video is considered late if the current position is more than 1.5
438438
/// seconds after the last image update.
439439
bool get isLate {
440-
if (lastImageUpdate == null) return false;
440+
if (dataSource == null || lastImageUpdate == null || !isLive) return false;
441441
final now = DateTime.now();
442442
final diff = now.difference(lastImageUpdate!);
443443
return diff.inMilliseconds > 1500;
444444
}
445445

446+
/// Whether the video is a live stream.
447+
bool get isLive =>
448+
// TODO(bdlukaa): do a better checking of this
449+
dataSource != null &&
450+
// It is only LIVE if it starts with rtsp or is hls
451+
(dataSource!.startsWith('rtsp') ||
452+
dataSource!.contains('media/mjpeg') ||
453+
dataSource!.contains('.m3u8') /* hls */);
454+
446455
void _handleLateVideo() {
447456
switch (lateVideoBehavior) {
448457
case LateVideoBehavior.automatic:

0 commit comments

Comments
 (0)