Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,19 @@ Future<void> testStreamsTab(
}

extension StreamWidgetTester on WidgetTester {
// Precision for duration & position:
// Android: two tenth of a second
// Precision for position & duration:
// Android: millisecond
// Windows: millisecond
// Linux: second
// Web: second
// Linux: millisecond
// Web: millisecond
// Darwin: millisecond

// Update interval for duration & position:
// Android: two tenth of a second
// Update interval for position:
// Android: ~200ms
// Windows: ~250ms
// Linux: second
// Web: second
// Linux: ~250ms
// Web: ~250ms
// Darwin: ~200ms

Future<void> stopStream() async {
final st = StackTrace.current.toString();
Expand All @@ -144,7 +146,11 @@ extension StreamWidgetTester on WidgetTester {
await waitFor(
() async => expectWidgetHasDuration(
const Key('onDurationText'),
matcher: (Duration? actual) => durationRangeMatcher(actual, duration),
matcher: (Duration? actual) => durationRangeMatcher(
actual,
duration,
deviation: const Duration(milliseconds: 500),
),
),
timeout: timeout,
stackTrace: st,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class WrappedMediaPlayer {
self.url = url

// stream player position
let interval = toCMTime(millis: 0.2)
let interval = toCMTime(millis: 200)
let timeObserver = player.addPeriodicTimeObserver(forInterval: interval, queue: nil) {
[weak self] time in
self?.onTimeInterval(time: time)
Expand Down
4 changes: 2 additions & 2 deletions packages/audioplayers_linux/linux/audio_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AudioPlayer::AudioPlayer(std::string playerId, FlMethodChannel *methodChannel,
if (panorama) {
audiobin = gst_bin_new(NULL);
audiosink = gst_element_factory_make("autoaudiosink", NULL);

gst_bin_add_many(GST_BIN(audiobin), panorama, audiosink, NULL);
gst_element_link(panorama, audiosink);

Expand All @@ -43,7 +43,7 @@ AudioPlayer::AudioPlayer(std::string playerId, FlMethodChannel *methodChannel,
gst_bus_add_watch(bus, (GstBusFunc)AudioPlayer::OnBusMessage, this);

// Refresh continuously to emit reoccurring events
_refreshId = g_timeout_add(1000, (GSourceFunc)AudioPlayer::OnRefresh, this);
_refreshId = g_timeout_add(250, (GSourceFunc)AudioPlayer::OnRefresh, this);
}

AudioPlayer::~AudioPlayer() {}
Expand Down
2 changes: 1 addition & 1 deletion packages/audioplayers_web/lib/num_extension.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extension NumExtension on num {
/// Converts [num] (expected in seconds) to the duration.
Duration fromSecondsToDuration() => Duration(
seconds: (isNaN || isInfinite ? 0 : this).round(),
milliseconds: ((isNaN || isInfinite ? 0 : this) * 1000).round(),
);
}