mirror of
https://github.com/immich-app/immich
synced 2025-06-07 18:20:56 +00:00
stop playing media if we seek to an asset that is not remote
This commit is contained in:
parent
a097369466
commit
892e6d93a1
@ -20,6 +20,7 @@ abstract interface class ICastDestinationService {
|
||||
void play();
|
||||
void pause();
|
||||
void seekTo(Duration position);
|
||||
void stop();
|
||||
Future<void> disconnect();
|
||||
|
||||
Future<List<(String, CastDestinationType, dynamic)>> getDevices();
|
||||
|
@ -130,6 +130,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
||||
if (isCasting) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (context.mounted) {
|
||||
ref.read(castProvider.notifier).stop();
|
||||
context.scaffoldMessenger.showSnackBar(
|
||||
SnackBar(
|
||||
duration: const Duration(seconds: 1),
|
||||
@ -398,6 +399,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
||||
context.scaffoldMessenger.clearSnackBars();
|
||||
|
||||
if (isCasting) {
|
||||
ref.read(castProvider.notifier).stop();
|
||||
context.scaffoldMessenger.showSnackBar(
|
||||
SnackBar(
|
||||
duration: const Duration(seconds: 2),
|
||||
|
@ -83,6 +83,10 @@ class CastNotifier extends StateNotifier<CastManagerState> {
|
||||
_gCastService.seekTo(position);
|
||||
}
|
||||
|
||||
void stop() {
|
||||
_gCastService.stop();
|
||||
}
|
||||
|
||||
Future<void> disconnect() async {
|
||||
await _gCastService.disconnect();
|
||||
}
|
||||
|
@ -263,6 +263,17 @@ class GCastService implements ICastDestinationService {
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void stop() {
|
||||
_gCastRepository.sendMessage(CastSession.kNamespaceMedia, {
|
||||
"type": "STOP",
|
||||
"mediaSessionId": _sessionId,
|
||||
});
|
||||
_mediaStatusPollingTimer?.cancel();
|
||||
|
||||
currentAssetId = null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<(String, CastDestinationType, dynamic)>> getDevices() async {
|
||||
final dests = await _gCastRepository.listDestinations();
|
||||
|
Loading…
x
Reference in New Issue
Block a user