|
4 | 4 |
|
5 | 5 | All notable changes to this project will be documented in this file. |
6 | 6 |
|
| 7 | +## 10.8.0 |
| 8 | + |
| 9 | +> [!CAUTION] |
| 10 | +> This release can be breaking change for `flutter_quill_extensions` users as it remove the built-in support for loading YouTube videos |
| 11 | +
|
| 12 | +If 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). |
| 13 | + |
| 14 | +We have added an experimental property that gives you more flexibility and control about the implementation you want to use for loading videos. |
| 15 | + |
| 16 | +> [!WARNING] |
| 17 | +> 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. |
| 18 | +
|
| 19 | +If 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). |
| 20 | + |
| 21 | +Here’s an example setup using `youtube_player_flutter`: |
| 22 | + |
| 23 | +```shell |
| 24 | +flutter pub add youtube_player_flutter |
| 25 | +``` |
| 26 | + |
| 27 | +Example widget configuration: |
| 28 | + |
| 29 | +```dart |
| 30 | +import 'package:flutter/material.dart'; |
| 31 | +import 'package:youtube_player_flutter/youtube_player_flutter.dart'; |
| 32 | +
|
| 33 | +class YoutubeVideoPlayer extends StatefulWidget { |
| 34 | + const YoutubeVideoPlayer({required this.videoUrl, super.key}); |
| 35 | +
|
| 36 | + final String videoUrl; |
| 37 | +
|
| 38 | + @override |
| 39 | + State<YoutubeVideoPlayer> createState() => _YoutubeVideoPlayerState(); |
| 40 | +} |
| 41 | +
|
| 42 | +class _YoutubeVideoPlayerState extends State<YoutubeVideoPlayer> { |
| 43 | + late final YoutubePlayerController _youtubePlayerController; |
| 44 | + @override |
| 45 | + void initState() { |
| 46 | + super.initState(); |
| 47 | + _youtubePlayerController = YoutubePlayerController( |
| 48 | + initialVideoId: YoutubePlayer.convertUrlToId(widget.videoUrl) ?? |
| 49 | + (throw StateError('Expect a valid video URL')), |
| 50 | + flags: const YoutubePlayerFlags( |
| 51 | + autoPlay: true, |
| 52 | + mute: true, |
| 53 | + ), |
| 54 | + ); |
| 55 | + } |
| 56 | +
|
| 57 | + @override |
| 58 | + Widget build(BuildContext context) { |
| 59 | + return YoutubePlayer( |
| 60 | + controller: _youtubePlayerController, |
| 61 | + showVideoProgressIndicator: true, |
| 62 | + ); |
| 63 | + } |
| 64 | +
|
| 65 | + @override |
| 66 | + void dispose() { |
| 67 | + _youtubePlayerController.dispose(); |
| 68 | + super.dispose(); |
| 69 | + } |
| 70 | +} |
| 71 | +
|
| 72 | +``` |
| 73 | + |
| 74 | +Then, integrate it with `QuillEditorVideoEmbedConfigurations` |
| 75 | + |
| 76 | +```dart |
| 77 | +FlutterQuillEmbeds.editorBuilders( |
| 78 | + videoEmbedConfigurations: QuillEditorVideoEmbedConfigurations( |
| 79 | + customVideoBuilder: (videoUrl, readOnly) { |
| 80 | + // Example: Check for YouTube Video URL and return your |
| 81 | + // YouTube video widget here. |
| 82 | + bool isYouTubeUrl(String videoUrl) { |
| 83 | + try { |
| 84 | + final uri = Uri.parse(videoUrl); |
| 85 | + return uri.host == 'www.youtube.com' || |
| 86 | + uri.host == 'youtube.com' || |
| 87 | + uri.host == 'youtu.be' || |
| 88 | + uri.host == 'www.youtu.be'; |
| 89 | + } catch (_) { |
| 90 | + return false; |
| 91 | + } |
| 92 | + } |
| 93 | +
|
| 94 | + if (isYouTubeUrl(videoUrl)) { |
| 95 | + return YoutubeVideoPlayer( |
| 96 | + videoUrl: videoUrl, |
| 97 | + ); |
| 98 | + } |
| 99 | +
|
| 100 | + // Return null to fallback to the default logic |
| 101 | + return null; |
| 102 | + }, |
| 103 | + ignoreYouTubeSupport: true, |
| 104 | + ), |
| 105 | +); |
| 106 | +``` |
| 107 | + |
| 108 | +> [!NOTE] |
| 109 | +> 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. |
| 110 | +
|
| 111 | +[`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. |
| 112 | + |
| 113 | +We're looking forward to your feedback. |
| 114 | + |
| 115 | +**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v10.7.7...v10.8.0 |
| 116 | + |
7 | 117 | ## 10.7.7 |
8 | 118 |
|
9 | 119 | This version is nearly identical to `10.7.6` with a build failure bug fix in [#2283](https://github.com/singerdmx/flutter-quill/pull/2283) related to unmerged change in [#2230](https://github.com/singerdmx/flutter-quill/pull/2230) |
|
0 commit comments