Check for null duration
This commit is contained in:
parent
c7c91c1804
commit
1fcfdefa20
|
@ -134,8 +134,8 @@ class AudioPlayer {
|
||||||
/// audio, or null if this call was interrupted by another call so [setUrl],
|
/// audio, or null if this call was interrupted by another call so [setUrl],
|
||||||
/// [setFilePath] or [setAsset].
|
/// [setFilePath] or [setAsset].
|
||||||
Future<Duration> setUrl(final String url) async {
|
Future<Duration> setUrl(final String url) async {
|
||||||
_durationFuture =
|
_durationFuture = _invokeMethod('setUrl', [url])
|
||||||
_invokeMethod('setUrl', [url]).then((ms) => Duration(milliseconds: ms));
|
.then((ms) => ms == null ? null : Duration(milliseconds: ms));
|
||||||
final duration = await _durationFuture;
|
final duration = await _durationFuture;
|
||||||
_durationSubject.add(duration);
|
_durationSubject.add(duration);
|
||||||
return duration;
|
return duration;
|
||||||
|
@ -168,7 +168,7 @@ class AudioPlayer {
|
||||||
Future<Duration> setClip({Duration start, Duration end}) async {
|
Future<Duration> setClip({Duration start, Duration end}) async {
|
||||||
_durationFuture =
|
_durationFuture =
|
||||||
_invokeMethod('setClip', [start?.inMilliseconds, end?.inMilliseconds])
|
_invokeMethod('setClip', [start?.inMilliseconds, end?.inMilliseconds])
|
||||||
.then((ms) => Duration(milliseconds: ms));
|
.then((ms) => ms == null ? null : Duration(milliseconds: ms));
|
||||||
final duration = await _durationFuture;
|
final duration = await _durationFuture;
|
||||||
_durationSubject.add(duration);
|
_durationSubject.add(duration);
|
||||||
return duration;
|
return duration;
|
||||||
|
|
Loading…
Reference in New Issue