mirror of
https://github.com/stonega/tsacdop
synced 2025-02-26 16:27:39 +01:00
Bug fix.
This commit is contained in:
parent
26353bb67b
commit
ccdfabeb3f
@ -269,7 +269,6 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
|||||||
await _getAutoPlay();
|
await _getAutoPlay();
|
||||||
|
|
||||||
var state = await _playerStateStorage.getPlayerState();
|
var state = await _playerStateStorage.getPlayerState();
|
||||||
print(state.toString());
|
|
||||||
if (state[0] != '') {
|
if (state[0] != '') {
|
||||||
_playlist = _playlists.firstWhere((p) => p.id == state[0],
|
_playlist = _playlists.firstWhere((p) => p.id == state[0],
|
||||||
orElse: () => _playlists.first);
|
orElse: () => _playlists.first);
|
||||||
@ -298,13 +297,21 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> playFromLastPosition() async {
|
Future<void> playFromLastPosition() async {
|
||||||
|
if (_playlist.episodes.isNotEmpty) {
|
||||||
|
await _playlist.getPlaylist();
|
||||||
|
if (_episode == null || !_playlist.episodes.contains(_episode))
|
||||||
|
_episode = _playlist.episodes.first;
|
||||||
_audioState = AudioProcessingState.none;
|
_audioState = AudioProcessingState.none;
|
||||||
|
_backgroundAudioDuration = 0;
|
||||||
|
_backgroundAudioPosition = 0;
|
||||||
|
_seekSliderValue = 0;
|
||||||
_playerRunning = true;
|
_playerRunning = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
_startAudioService(_playlist,
|
_startAudioService(_playlist,
|
||||||
position: _lastPostion ?? 0,
|
position: _lastPostion ?? 0,
|
||||||
index: _playlist.episodes.indexOf(_episode));
|
index: _playlist.episodes.indexOf(_episode));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> playlistLoad(Playlist playlist) async {
|
Future<void> playlistLoad(Playlist playlist) async {
|
||||||
var p = playlist;
|
var p = playlist;
|
||||||
@ -326,7 +333,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
|||||||
_audioState = AudioProcessingState.none;
|
_audioState = AudioProcessingState.none;
|
||||||
_playerRunning = true;
|
_playerRunning = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
_startAudioService(_playlist, position: _lastPostion ?? 0, index: 0);
|
_startAudioService(_playlist, position: 0, index: 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -683,6 +690,10 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
|||||||
for (var p in _playlists)
|
for (var p in _playlists)
|
||||||
if (p != playlist) p
|
if (p != playlist) p
|
||||||
];
|
];
|
||||||
|
if (_playlist == playlist && !_playerRunning) {
|
||||||
|
_playlist = _queue;
|
||||||
|
_episode = _queue.episodes.first;
|
||||||
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
_savePlaylists();
|
_savePlaylists();
|
||||||
}
|
}
|
||||||
@ -731,7 +742,10 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
|||||||
{bool updateEpisodes = true}) async {
|
{bool updateEpisodes = true}) async {
|
||||||
if (updateEpisodes) await playlist.getPlaylist();
|
if (updateEpisodes) await playlist.getPlaylist();
|
||||||
_playlists = [for (var p in _playlists) p.id == playlist.id ? playlist : p];
|
_playlists = [for (var p in _playlists) p.id == playlist.id ? playlist : p];
|
||||||
|
if (_playlist.id == playlist.id && !_playerRunning) {
|
||||||
|
_playlist = _playlists.firstWhere((e) => e.id == _playlist.id);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
}
|
||||||
_savePlaylists();
|
_savePlaylists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ class GroupList extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _start() async {
|
Future<void> _start() async {
|
||||||
if (!_created) {
|
if (!_created) {
|
||||||
await _createIsolate();
|
await _createIsolate();
|
||||||
_created = true;
|
_created = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user