Skip to content

Commit

Permalink
Fix bug in loading from assets.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Oct 4, 2020
1 parent 35a6e48 commit c767f9c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions just_audio/lib/just_audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,11 @@ abstract class UriAudioSource extends IndexedAudioSource {
: _type = type,
super(tag);

/// If [uri] points to an asset, this gives us [_overrideUri] which is the URI
/// of the copied asset on the filesystem, otherwise it gives us the original
/// [uri].
Uri get _effectiveUri => _overrideUri ?? uri;

@override
Future<void> _setup(AudioPlayer player) async {
await super._setup(player);
Expand Down Expand Up @@ -1244,7 +1249,7 @@ class ProgressiveAudioSource extends UriAudioSource {

@override
AudioSourceMessage _toMessage() => ProgressiveAudioSourceMessage(
id: _id, uri: uri.toString(), headers: headers);
id: _id, uri: _effectiveUri.toString(), headers: headers);
}

/// An [AudioSource] representing a DASH stream. The following URI schemes are
Expand All @@ -1263,8 +1268,8 @@ class DashAudioSource extends UriAudioSource {
: super(uri, headers: headers, tag: tag, type: 'dash');

@override
AudioSourceMessage _toMessage() =>
DashAudioSourceMessage(id: _id, uri: uri.toString(), headers: headers);
AudioSourceMessage _toMessage() => DashAudioSourceMessage(
id: _id, uri: _effectiveUri.toString(), headers: headers);
}

/// An [AudioSource] representing an HLS stream. The following URI schemes are
Expand All @@ -1282,8 +1287,8 @@ class HlsAudioSource extends UriAudioSource {
: super(uri, headers: headers, tag: tag, type: 'hls');

@override
AudioSourceMessage _toMessage() =>
HlsAudioSourceMessage(id: _id, uri: uri.toString(), headers: headers);
AudioSourceMessage _toMessage() => HlsAudioSourceMessage(
id: _id, uri: _effectiveUri.toString(), headers: headers);
}

/// An [AudioSource] representing a concatenation of multiple audio sources to
Expand Down

0 comments on commit c767f9c

Please sign in to comment.