Fix bug in loading from assets.

This commit is contained in:
Ryan Heise 2020-10-04 13:35:34 +11:00
parent 35a6e4810b
commit c767f9cc62
1 changed files with 10 additions and 5 deletions

View File

@ -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);
@ -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
@ -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
@ -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