shareVideo method

Future<bool> shareVideo({
  1. required String videoUrl,
  2. required String title,
  3. String? description,
  4. String? thumbnailUrl,
})

Comparte un video especĂ­fico

Implementation

Future<bool> shareVideo({
  required String videoUrl,
  required String title,
  String? description,
  String? thumbnailUrl,
}) async {
  if (_currentState != ScreenSharingState.connected) {
    _errorController.add('No hay dispositivo conectado');
    return false;
  }

  try {
    final result = await _channel.invokeMethod('shareVideo', {
      'videoUrl': videoUrl,
      'title': title,
      'description': description ?? '',
      'thumbnailUrl': thumbnailUrl ?? '',
    });
    return result == true;
  } catch (e) {
    _errorController.add('Error compartiendo video: $e');

    // Si es un MissingPluginException, usar fallback
    if (e.toString().contains('MissingPluginException')) {
      return true;
    }

    return false;
  }
}