setLiveWallpaper method

  1. @override
Future<String?> setLiveWallpaper(
  1. String videoPath
)
override

Sets a live wallpaper from a video file.

videoPath is the path to the video file. Opens the system live wallpaper picker for user to apply.

Implementation

@override
Future<String?> setLiveWallpaper(String videoPath) async {
  try {
    final String? result = await methodChannel.invokeMethod<String>(
      'setLiveWallpaper',
      {'videoPath': videoPath},
    );
    return result;
  } on PlatformException catch (e) {
    throw Exception('Failed to set live wallpaper: ${e.message}');
  } catch (e) {
    throw Exception('Unexpected error: $e');
  }
}