Exoplayer exceptions (#76)

* exoplayer exceptions back to flutter

* fix git ignore

* fix dispose player

* pump exoplayer exceptions

* readme

* code reformat

* code reformat - with tabs

* re-reformat code
This commit is contained in:
Tarek BAZINE 2020-04-20 06:19:43 +02:00 committed by GitHub
parent e02f59cd31
commit 5147a52397
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 133 additions and 122 deletions

View file

@ -182,11 +182,15 @@ class AudioPlayer {
/// audio, or null if this call was interrupted by another call so [setUrl],
/// [setFilePath] or [setAsset].
Future<Duration> setUrl(final String url) async {
_durationFuture = _invokeMethod('setUrl', [url])
.then((ms) => ms == null ? null : Duration(milliseconds: ms));
_duration = await _durationFuture;
_durationSubject.add(_duration);
return _duration;
try {
_durationFuture = _invokeMethod('setUrl', [url])
.then((ms) => ms == null ? null : Duration(milliseconds: ms));
_duration = await _durationFuture;
_durationSubject.add(_duration);
return _duration;
} on PlatformException catch (e) {
return Future.error(e.message);
}
}
/// Loads audio media from a file and completes with the duration of that