ScreenSharingService class
Servicio para manejar el compartir pantalla (SharePlay en iOS, Google Cast en Android)
Este servicio permite compartir videos con otros dispositivos usando tecnologías nativas de cada plataforma:
- iOS: SharePlay para compartir con otros dispositivos Apple
- Android: Google Cast para transmitir a Chromecast y Smart TVs
Implementado usando canales de método nativos sin dependencias externas.
Ejemplo de uso:
final service = ScreenSharingService();
await service.initialize();
// Buscar dispositivos disponibles
final devices = await service.discoverDevices();
// Conectar a un dispositivo
await service.connectToDevice(deviceId, deviceName);
// Compartir un video
await service.shareVideo(
videoUrl: 'https://example.com/video.mp4',
title: 'Mi Video',
);
Constructors
- ScreenSharingService()
-
factory
Properties
- currentState → ScreenSharingState
-
no setter
-
deviceStream
→ Stream<
Map< String, dynamic> > -
no setter
-
errorStream
→ Stream<
String> -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInitialized → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stateStream
→ Stream<
ScreenSharingState> -
no setter
Methods
-
connectToDevice(
String deviceId, String deviceName) → Future< bool> - Conecta a un dispositivo específico
-
controlPlayback(
{required String action, double? position}) → Future< bool> - Controla la reproducción del video compartido
-
disconnect(
) → Future< bool> - Desconecta del dispositivo actual
-
discoverDevices(
) → Future< List< Map< >String, dynamic> > - Busca dispositivos disponibles para compartir
-
dispose(
) → void - Limpia los recursos
-
initialize(
) → Future< bool> - Inicializa el servicio de compartir pantalla
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
- Comparte un video específico
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getPlatformName(
) → String - Obtiene el nombre de la plataforma actual
-
isScreenSharingSupported(
) → Future< bool> - Verifica si el compartir pantalla está soportado