"10.8.0": "> [!CAUTION]\r\n> This release can be breaking change for `flutter_quill_extensions` users as it remove the built-in support for loading YouTube videos\r\n\r\nIf you're using [flutter_quill_extensions](https://pub.dev/packages/flutter_quill_extensions) then this release, can be a breaking change for you if you load videos in the editor and expect YouTube videos to be supported, [youtube_player_flutter](https://pub.dev/packages/youtube_player_flutter) and [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview) are no longer dependencies of the extensions package, which are used to support loading YouTube Iframe videos on non-web platforms, more details about the discussion and reasons in [#2286](https://github.com/singerdmx/flutter-quill/pull/2286) and [#2284](https://github.com/singerdmx/flutter-quill/issues/2284).\r\n\r\nWe have added an experimental property that gives you more flexibility and control about the implementation you want to use for loading videos.\r\n\r\n> [!WARNING]\r\n> It's likely to experience some common issues while implementing this feature, especially on desktop platforms as the support for [flutter_inappwebview_windows](https://pub.dev/packages/flutter_inappwebview_windows) and [flutter_inappwebview_macos](https://pub.dev/packages/flutter_inappwebview_macos) before 2 days. Some of the issues are in the Flutter Quill editor.\r\n\r\nIf you want loading YouTube videos to be a feature again with the latest version of Flutter Quill, you can use an existing plugin or package, or implement your own solution. For example, you might use [`youtube_video_player`](https://pub.dev/packages/youtube_video_player) or [`youtube_player_flutter`](https://pub.dev/packages/youtube_player_flutter), which was previously used in [`flutter_quill_extensions`](https://pub.dev/packages/flutter_quill_extensions).\r\n\r\nHere’s an example setup using `youtube_player_flutter`:\r\n\r\n```shell\r\nflutter pub add youtube_player_flutter\r\n```\r\n\r\nExample widget configuration:\r\n\r\n```dart\r\nimport 'package:flutter/material.dart';\r\nimport 'package:youtube_player_flutter/youtube_player_flutter.dart';\r\n\r\nclass YoutubeVideoPlayer extends StatefulWidget {\r\n  const YoutubeVideoPlayer({required this.videoUrl, super.key});\r\n\r\n  final String videoUrl;\r\n\r\n  @override\r\n  State<YoutubeVideoPlayer> createState() => _YoutubeVideoPlayerState();\r\n}\r\n\r\nclass _YoutubeVideoPlayerState extends State<YoutubeVideoPlayer> {\r\n  late final YoutubePlayerController _youtubePlayerController;\r\n  @override\r\n  void initState() {\r\n    super.initState();\r\n    _youtubePlayerController = YoutubePlayerController(\r\n      initialVideoId: YoutubePlayer.convertUrlToId(widget.videoUrl) ??\r\n          (throw StateError('Expect a valid video URL')),\r\n      flags: const YoutubePlayerFlags(\r\n        autoPlay: true,\r\n        mute: true,\r\n      ),\r\n    );\r\n  }\r\n\r\n  @override\r\n  Widget build(BuildContext context) {\r\n    return YoutubePlayer(\r\n      controller: _youtubePlayerController,\r\n      showVideoProgressIndicator: true,\r\n    );\r\n  }\r\n\r\n  @override\r\n  void dispose() {\r\n    _youtubePlayerController.dispose();\r\n    super.dispose();\r\n  }\r\n}\r\n\r\n```\r\n\r\nThen, integrate it with `QuillEditorVideoEmbedConfigurations`\r\n\r\n```dart\r\nFlutterQuillEmbeds.editorBuilders(\r\n      videoEmbedConfigurations: QuillEditorVideoEmbedConfigurations(\r\n        customVideoBuilder: (videoUrl, readOnly) {\r\n          // Example: Check for YouTube Video URL and return your\r\n          // YouTube video widget here.\r\n          bool isYouTubeUrl(String videoUrl) {\r\n            try {\r\n              final uri = Uri.parse(videoUrl);\r\n              return uri.host == 'www.youtube.com' ||\r\n                  uri.host == 'youtube.com' ||\r\n                  uri.host == 'youtu.be' ||\r\n                  uri.host == 'www.youtu.be';\r\n            } catch (_) {\r\n              return false;\r\n            }\r\n          }\r\n\r\n          if (isYouTubeUrl(videoUrl)) {\r\n            return YoutubeVideoPlayer(\r\n              videoUrl: videoUrl,\r\n            );\r\n          }\r\n\r\n          // Return null to fallback to the default logic\r\n          return null;\r\n        },\r\n        ignoreYouTubeSupport: true,\r\n      ),\r\n);\r\n```\r\n\r\n> [!NOTE]\r\n> This example illustrates a basic approach, additional adjustments might be necessary to meet your specific needs. YouTube video support is no longer included in this project. Keep in mind that `customVideoBuilder` is experimental and can change without being considered as breaking change. More details in [breaking changes](https://github.com/singerdmx/flutter-quill#-breaking-changes) section.\r\n\r\n[`super_clipboard`](https://pub.dev/packages/super_clipboard) will also no longer a dependency of `flutter_quill_extensions` once [PR #2230](https://github.com/singerdmx/flutter-quill/pull/2230) is ready.\r\n\r\nWe're looking forward to your feedback.\r\n\r\n**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.7...v10.8.0",
0 commit comments