mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
Seekbar support added to Android Media Controls
Turned off MPRIS for flatpak
This commit is contained in:
parent
9129c4d2b1
commit
4453049e08
@ -23,6 +23,7 @@ import 'package:spotube/provider/YouTube.dart';
|
||||
import 'package:spotube/services/LinuxAudioService.dart';
|
||||
import 'package:spotube/services/MobileAudioService.dart';
|
||||
import 'package:spotube/utils/PersistedChangeNotifier.dart';
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
import 'package:youtube_explode_dart/youtube_explode_dart.dart' hide Playlist;
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:spotube/extensions/list-sort-multiple.dart';
|
||||
@ -73,7 +74,7 @@ class Playback extends PersistedChangeNotifier {
|
||||
_subscriptions = [],
|
||||
status = PlaybackStatus.idle,
|
||||
super() {
|
||||
if (Platform.isLinux) {
|
||||
if (Platform.isLinux && !kIsFlatpak) {
|
||||
_linuxAudioService = LinuxAudioService(this);
|
||||
}
|
||||
|
||||
@ -151,19 +152,21 @@ class Playback extends PersistedChangeNotifier {
|
||||
status = PlaybackStatus.loading;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
// the track is not a SpotubeTrack so turning it to one
|
||||
if (track is! SpotubeTrack) {
|
||||
track = await toSpotubeTrack(track);
|
||||
}
|
||||
|
||||
final tag = MediaItem(
|
||||
id: track.id!,
|
||||
title: track.name!,
|
||||
album: track.album?.name,
|
||||
artist: artistsToString(track.artists ?? <ArtistSimple>[]),
|
||||
artUri: Uri.parse(imageToUrlString(track.album?.images)),
|
||||
duration: track.ytTrack.duration,
|
||||
);
|
||||
mobileAudioService?.addItem(tag);
|
||||
|
||||
// the track is not a SpotubeTrack so turning it to one
|
||||
if (track is! SpotubeTrack) {
|
||||
track = await toSpotubeTrack(track);
|
||||
}
|
||||
_logger.v("[Track Direct Source] - ${(track).ytUri}");
|
||||
this.track = track;
|
||||
notifyListeners();
|
||||
|
@ -15,6 +15,10 @@ class MobileAudioService extends BaseAudioHandler {
|
||||
}
|
||||
});
|
||||
|
||||
_player.onPositionChanged.listen((pos) async {
|
||||
playbackState.add(await _transformEvent());
|
||||
});
|
||||
|
||||
_player.onPlayerComplete.listen((_) {
|
||||
if (playback.playlist == null && playback.track == null) {
|
||||
playbackState.add(
|
||||
@ -70,6 +74,9 @@ class MobileAudioService extends BaseAudioHandler {
|
||||
MediaControl.skipToNext,
|
||||
MediaControl.stop,
|
||||
],
|
||||
systemActions: {
|
||||
MediaAction.seek,
|
||||
},
|
||||
androidCompactActionIndices: const [0, 1, 2],
|
||||
playing: playback.player.state == PlayerState.playing,
|
||||
updatePosition:
|
||||
|
@ -3,3 +3,5 @@ import 'dart:io';
|
||||
final kIsDesktop = Platform.isLinux || Platform.isWindows || Platform.isMacOS;
|
||||
|
||||
final kIsMobile = Platform.isAndroid || Platform.isIOS;
|
||||
|
||||
final kIsFlatpak = Platform.environment["FLATPAK_ID"] != null;
|
||||
|
Loading…
Reference in New Issue
Block a user