mirror of
https://github.com/immich-app/immich
synced 2025-06-08 21:48:04 +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 play();
|
||||||
void pause();
|
void pause();
|
||||||
void seekTo(Duration position);
|
void seekTo(Duration position);
|
||||||
|
void stop();
|
||||||
Future<void> disconnect();
|
Future<void> disconnect();
|
||||||
|
|
||||||
Future<List<(String, CastDestinationType, dynamic)>> getDevices();
|
Future<List<(String, CastDestinationType, dynamic)>> getDevices();
|
||||||
|
@ -130,6 +130,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
if (isCasting) {
|
if (isCasting) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
|
ref.read(castProvider.notifier).stop();
|
||||||
context.scaffoldMessenger.showSnackBar(
|
context.scaffoldMessenger.showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
duration: const Duration(seconds: 1),
|
duration: const Duration(seconds: 1),
|
||||||
@ -398,6 +399,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
context.scaffoldMessenger.clearSnackBars();
|
context.scaffoldMessenger.clearSnackBars();
|
||||||
|
|
||||||
if (isCasting) {
|
if (isCasting) {
|
||||||
|
ref.read(castProvider.notifier).stop();
|
||||||
context.scaffoldMessenger.showSnackBar(
|
context.scaffoldMessenger.showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
duration: const Duration(seconds: 2),
|
duration: const Duration(seconds: 2),
|
||||||
|
@ -83,6 +83,10 @@ class CastNotifier extends StateNotifier<CastManagerState> {
|
|||||||
_gCastService.seekTo(position);
|
_gCastService.seekTo(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void stop() {
|
||||||
|
_gCastService.stop();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> disconnect() async {
|
Future<void> disconnect() async {
|
||||||
await _gCastService.disconnect();
|
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
|
@override
|
||||||
Future<List<(String, CastDestinationType, dynamic)>> getDevices() async {
|
Future<List<(String, CastDestinationType, dynamic)>> getDevices() async {
|
||||||
final dests = await _gCastRepository.listDestinations();
|
final dests = await _gCastRepository.listDestinations();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user