Skip to content

Commit

Permalink
Change asset URI from asset:// to asset:///
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Aug 12, 2020
1 parent 67b7afc commit 6a4067a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/just_audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ class AudioPlayer {
/// Convenience method to load audio from an asset, equivalent to:
///
/// ```
/// load(AudioSource.uri(Uri.parse('asset://$filePath')));
/// load(AudioSource.uri(Uri.parse('asset:///$assetPath')));
/// ```
Future<Duration> setAsset(String assetPath) =>
load(AudioSource.uri(Uri.parse('asset://$assetPath')));
load(AudioSource.uri(Uri.parse('asset:///$assetPath')));

/// Loads audio from an [AudioSource] and completes when the audio is ready
/// to play with the duration of that audio, or null if the duration is unknown.
Expand Down Expand Up @@ -1079,7 +1079,8 @@ abstract class UriAudioSource extends IndexedAudioSource {
Future<void> _setup(AudioPlayer player) async {
await super._setup(player);
if (uri.scheme == 'asset') {
_overrideUri = Uri.file((await _loadAsset(uri.path)).path);
_overrideUri = Uri.file(
(await _loadAsset(uri.path.replaceFirst(RegExp(r'^/'), ''))).path);
} else if (headers != null) {
_overrideUri = player._proxy.addUrl(uri, headers);
}
Expand Down

0 comments on commit 6a4067a

Please sign in to comment.