support seeking to end of live streams (#108)

* support seeking to end of live streams

suggested edit for #96

* fix type casting
This commit is contained in:
LKHO 2020-06-07 14:31:36 +08:00 committed by GitHub
parent ee0c4cd7cd
commit f66413c007
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 11 deletions

View file

@ -421,11 +421,13 @@ class AudioPlayer {
[automaticallyWaitsToMinimizeStalling]);
}
/// Seeks to a particular position. It is legal to invoke this method from
/// Seeks to a particular position. Specify [null] to seek to the end of live streams.
/// It is legal to invoke this method from
/// any state except for [AudioPlaybackState.none] and
/// [AudioPlaybackState.connecting].
Future<void> seek(final Duration position) async {
await _invokeMethod('seek', [position.inMilliseconds]);
await _invokeMethod(
'seek', [position != null ? position.inMilliseconds : -2]);
}
/// Release all resources associated with this player. You must invoke this