Change version to 0.2.0

This commit is contained in:
stonegate 2020-04-24 12:19:56 +08:00
parent 60e066d2a9
commit 599fc75647
4 changed files with 46 additions and 18 deletions

View File

@ -47,7 +47,7 @@ android {
applicationId "com.stonegate.tsacdop"
minSdkVersion 19
targetSdkVersion 28
versionCode 4
versionCode 5
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -348,18 +348,20 @@ class AudioPlayerNotifier extends ChangeNotifier {
notifyListeners();
});
double s = _currentSpeed ?? 1.0;
//double s = _currentSpeed ?? 1.0;
int getPosition = 0;
Timer.periodic(Duration(milliseconds: 500), (timer) {
Timer.periodic(Duration(milliseconds: 200), (timer) {
double s = _currentSpeed ?? 1.0;
if (_noSlide) {
if (_audioState == BasicPlaybackState.playing) {
getPosition = _currentPosition +
(DateTime.now().difference(_current).inMilliseconds * s).toInt();
((DateTime.now().difference(_current).inMilliseconds) * s)
.toInt();
_backgroundAudioPosition = getPosition < _backgroundAudioDuration
? getPosition
: _backgroundAudioDuration;
} else
_backgroundAudioPosition = _currentPosition;
_backgroundAudioPosition = _currentPosition ?? 0;
if (_backgroundAudioDuration != null &&
_backgroundAudioDuration != 0 &&
@ -618,6 +620,7 @@ class AudioPlayerTask extends BackgroundAudioTask {
_setState(
state: state,
position: event.position.inMilliseconds,
speed: event.speed,
);
}
});
@ -666,7 +669,8 @@ class AudioPlayerTask extends BackgroundAudioTask {
_skipState = null;
// Resume playback if we were playing
// if (_playing) {
onPlay();
//onPlay();
playFromStart();
// } else {
// _setState(state: BasicPlaybackState.paused);
// }
@ -684,6 +688,7 @@ class AudioPlayerTask extends BackgroundAudioTask {
if (duration != null)
await AudioServiceBackground.setMediaItem(
mediaItem.copyWith(duration: duration.inMilliseconds));
playFromStart();
}
// if (mediaItem.extras['skip'] > 0) {
// await _audioPlayer.setClip(
@ -691,14 +696,27 @@ class AudioPlayerTask extends BackgroundAudioTask {
// print(mediaItem.extras['skip']);
// print('set clip success');
// }
else
else {
_playing = true;
await _audioPlayer.play();
if (_audioPlayer.playbackEvent.state != AudioPlaybackState.connecting &&
_audioPlayer.playbackEvent.state != AudioPlaybackState.none)
_audioPlayer.play();
}
// if (mediaItem.extras['skip'] >
// _audioPlayer.playbackEvent.position.inSeconds ??
// 0) {
// _audioPlayer.seek(Duration(seconds: mediaItem.extras['skip']));
// }
}
}
playFromStart() async {
_playing = true;
_audioPlayer.play();
if (mediaItem.extras['skip'] > 0) {
_audioPlayer.seek(Duration(seconds: mediaItem.extras['skip']));
}
}
}
@override
void onPause() {
@ -711,6 +729,8 @@ class AudioPlayerTask extends BackgroundAudioTask {
@override
void onSeekTo(int position) {
if (_audioPlayer.playbackEvent.state != AudioPlaybackState.connecting &&
_audioPlayer.playbackEvent.state != AudioPlaybackState.none)
_audioPlayer.seek(Duration(milliseconds: position));
}
@ -751,7 +771,8 @@ class AudioPlayerTask extends BackgroundAudioTask {
Duration duration = await _audioPlayer.durationFuture ?? Duration.zero;
AudioServiceBackground.setMediaItem(
mediaItem.copyWith(duration: duration.inMilliseconds));
onPlay();
playFromStart();
//onPlay();
} else {
_queue.insert(index, mediaItem);
await AudioServiceBackground.setQueue(_queue);
@ -807,15 +828,20 @@ class AudioPlayerTask extends BackgroundAudioTask {
}
}
void _setState({@required BasicPlaybackState state, int position}) {
void _setState(
{@required BasicPlaybackState state, int position, double speed}) {
if (position == null) {
position = _audioPlayer.playbackEvent.position.inMilliseconds;
}
if (speed == null) {
speed = _audioPlayer.playbackEvent.speed;
}
AudioServiceBackground.setState(
controls: getControls(state),
systemActions: [MediaAction.seekTo],
basicState: state,
position: position,
speed: speed,
);
}

View File

@ -3,6 +3,8 @@ import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:line_icons/line_icons.dart';
const String version = '0.2.0';
class AboutApp extends StatelessWidget {
_launchUrl(String url) async {
if (await canLaunch(url)) {
@ -72,7 +74,7 @@ class AboutApp extends StatelessWidget {
image: AssetImage('assets/logo.png'),
height: 80,
),
Text('Version: 0.2.0'),
Text('Version: $version'),
],
),
),

View File

@ -11,7 +11,7 @@ description: An easy-use podacasts player.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.1.9
version: 0.2.0
environment:
sdk: ">=2.6.0 <3.0.0"