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
3 changes: 2 additions & 1 deletion .github/workflows/build-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
type: choice
options:
- 'any'
- '3.29.x'
- '3.27.x'
- '3.24.x'
- '3.22.x'
Expand Down Expand Up @@ -61,7 +62,7 @@ on:
inputs:
flutter_version:
required: false
default: '3.27.3'
default: '3.29.0'
type: string
flutter_channel:
required: false
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ on:
- ready_for_review

jobs:
# Disable min flutter tests until version differs from latest supported version.
# call-min-flutter-test:
# uses: ./.github/workflows/test.yml
# with:
# flutter_version: '3.27.4'
# fatal_warnings: false
# enable_android: ${{ github.event.pull_request.draft == false }}
# enable_web: ${{ github.event.pull_request.draft == false }}
# enable_ios: ${{ github.event.pull_request.draft == false }}
# enable_windows: ${{ github.event.pull_request.draft == false }}
# enable_linux: ${{ github.event.pull_request.draft == false }}
# enable_macos: ${{ github.event.pull_request.draft == false }}
call-min-flutter-test:
uses: ./.github/workflows/test.yml
with:
flutter_version: '3.27.4'
fatal_warnings: false
enable_android: ${{ github.event.pull_request.draft == false }}
enable_web: ${{ github.event.pull_request.draft == false }}
enable_ios: ${{ github.event.pull_request.draft == false }}
enable_windows: ${{ github.event.pull_request.draft == false }}
enable_linux: ${{ github.event.pull_request.draft == false }}
enable_macos: ${{ github.event.pull_request.draft == false }}
call-test:
uses: ./.github/workflows/test.yml
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
type: choice
options:
- 'any'
- '3.29.x'
- '3.27.x'
- '3.24.x'
- '3.22.x'
Expand Down Expand Up @@ -61,7 +62,7 @@ on:
inputs:
flutter_version:
required: false
default: '3.27.3'
default: '3.29.0'
type: string
flutter_channel:
required: false
Expand Down
43 changes: 27 additions & 16 deletions packages/audioplayers/example/integration_test/platform_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,14 @@ void main() async {
testWidgets(
'#durationEvent ${td.source}',
(tester) async {
// Wait for duration before event is emitted.
final durationFuture = tester
.getDurationFromEvent(
playerId: playerId,
platform: platform,
)
.timeout(_defaultTimeout);

await tester.prepareSource(
playerId: playerId,
platform: platform,
Expand All @@ -340,12 +348,7 @@ void main() async {
);

expect(
await tester
.getDurationFromEvent(
playerId: playerId,
platform: platform,
)
.timeout(_defaultTimeout),
await durationFuture,
(Duration? actual) => durationRangeMatcher(
actual,
td.duration,
Expand Down Expand Up @@ -471,6 +474,22 @@ extension on WidgetTester {
required LibSourceTestData testData,
bool waitForDurationEvent = true,
}) async {
final Future<void>? durationFuture;

if (waitForDurationEvent &&
testData.duration != null &&
canDetermineDuration(testData)) {
// Need to wait for the duration event,
// otherwise it gets fired/received after the test has ended,
// and therefore then ends up being received in the next test.
durationFuture = getDurationFromEvent(
playerId: playerId,
platform: platform,
);
} else {
durationFuture = null;
}

final eventStream = platform.getEventStream(playerId);
final preparedFuture = eventStream
.firstWhere(
Expand Down Expand Up @@ -499,16 +518,8 @@ extension on WidgetTester {
// Wait simultaneously to ensure all errors are propagated through the same
// future.
await Future.wait([setSourceFuture, preparedFuture]);
if (waitForDurationEvent &&
testData.duration != null &&
canDetermineDuration(testData)) {
// Need to wait for the duration event,
// otherwise it gets fired/received after the test has ended,
// and therefore then ends up being received in the next test.
await getDurationFromEvent(
playerId: playerId,
platform: platform,
);
if (durationFuture != null) {
await durationFuture;
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/audioplayers/lib/src/source.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

import 'package:audioplayers/src/audioplayer.dart';
import 'package:flutter/foundation.dart';

Expand Down Expand Up @@ -27,7 +29,8 @@ class UrlSource extends Source {

@override
String toString() {
return 'UrlSource(url: $url, mimeType: $mimeType)';
return 'UrlSource(url: ${url.substring(0, min(500, url.length))},'
' mimeType: $mimeType)';
}
}

Expand Down