Skip to content

Commit

Permalink
DEBUG: log events
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed Jun 27, 2024
1 parent fc3f818 commit ff43eef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,15 +478,15 @@ extension on WidgetTester {
final futurePrepared = eventStream
.firstWhere(
(event) {
print('DEBUG: Get events (type: ${event.eventType}, prepared: ${event.isPrepared}) ${testData.source}');
print('DEBUG: ${DateTime.now().toIso8601String()} Get events (type: ${event.eventType}, prepared: ${event.isPrepared}) ${testData.source}');
return event.eventType == AudioEventType.prepared &&
(event.isPrepared ?? false);
},
)
.timeout(const Duration(seconds: 30));

Future<void> setSource(Source source) async {
print('DEBUG: setSource $source');
print('DEBUG: ${DateTime.now().toIso8601String()} setSource $source');
if (source is UrlSource) {
await platform.setSourceUrl(playerId, source.url);
} else if (source is AssetSource) {
Expand All @@ -497,15 +497,15 @@ extension on WidgetTester {
} else {
throw 'Unknown source type: ${source.runtimeType}';
}
print('DEBUG: setting Source finished $source');
print('DEBUG: ${DateTime.now().toIso8601String()} setting Source finished $source');
}

// Need to await the setting the source to propagate immediate errors.
final futureSetSource = setSource(testData.source);
await pumpPlatform();

// Wait simultaneously to ensure all errors are propagated through the same
// future.
await Future.wait([futureSetSource, futurePrepared]);
print('DEBUG: ${DateTime.now().toIso8601String()} after future wait');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ mixin EventChannelAudioplayersPlatform
(dynamic event) {
final map = event as Map<dynamic, dynamic>;
final eventType = map.getString('event');
print('DEBUG: ${DateTime.now().toIso8601String()} EVENT $eventType');
switch (eventType) {
case 'audio.onDuration':
final millis = map.getInt('value');
Expand Down

0 comments on commit ff43eef

Please sign in to comment.