From ea4be9f9ad7be6058eade17c2bf145d0a6b9937f Mon Sep 17 00:00:00 2001 From: Ryan Heise Date: Tue, 21 Apr 2020 20:26:53 +1000 Subject: [PATCH] Support # and ? in file path on Android. --- example/pubspec.lock | 84 +++++++++++--------------------------------- lib/just_audio.dart | 4 +-- 2 files changed, 23 insertions(+), 65 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 84363c3..4867e8d 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,62 +1,41 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.4.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" + version: "1.14.12" cupertino_icons: dependency: "direct main" description: @@ -64,6 +43,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -79,13 +65,6 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" just_audio: dependency: "direct dev" description: @@ -113,7 +92,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.7.0" path_provider: dependency: transitive description: @@ -121,13 +100,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.5.1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" platform: dependency: transitive description: @@ -135,13 +107,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.2.1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" rxdart: dependency: "direct main" description: @@ -160,7 +125,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.7.0" stack_trace: dependency: transitive description: @@ -195,7 +160,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.14" + version: "0.2.15" typed_data: dependency: transitive description: @@ -210,13 +175,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.5.0" sdks: dart: ">=2.6.0 <3.0.0" flutter: ">=1.12.8 <2.0.0" diff --git a/lib/just_audio.dart b/lib/just_audio.dart index 4748ef7..0bf701d 100644 --- a/lib/just_audio.dart +++ b/lib/just_audio.dart @@ -196,8 +196,8 @@ class AudioPlayer { /// Loads audio media from a file and completes with the duration of that /// audio, or null if this call was interrupted by another call so [setUrl], /// [setFilePath] or [setAsset]. - Future setFilePath(final String filePath) => - setUrl('file://$filePath'); + Future setFilePath(final String filePath) => setUrl( + Platform.isAndroid ? File(filePath).uri.toString() : 'file://$filePath'); /// Loads audio media from an asset and completes with the duration of that /// audio, or null if this call was interrupted by another call so [setUrl],