feat(extensions): Youtube Video Player Support Mode #1916
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A workaround for loading YouTube videos on a Desktop without Webview.
Loading YouTube videos using WebView Platform View in
QuillEditor
causes some issues, requires flutter_inappwebview which requires setup on Web, doesn't support Desktop yetOn pub.dev page it is marked as supported on macOS
Screenshot
Though it's not supported yet on macOS, see #2004 or #460 for more details.
If you try to use it on macOS platform you will get this exception:
createPlatformInAppWebViewWidget is not implemented on the current platform.
I caught this while testing the previous two PRs sent recently.
A workaround, in my opinion, is a better solution even on other platforms, is to get the download/video URL and load it using a Video player without a platform widget using plugins with Webview.
The only issue is, as far as I remember, YouTube's terms of service don't allow this unless you download the video using the download button or use it using IFrame which is the main reason why YouTube video player packages use Webview, though we could improve this to make UI similar to the provided IFrame (with Youtube link) to make it clear this video is coming from Youtube, and we could disable this feature if the video author doesn't allow using IFrame feature which will give a similar result to using IFrame, however.
I'm still unsure if this is allowed.
This is why I changed this from a bug fix into a feature that provides
YoutubeVideoSupportMode
option:The default is
YoutubeVideoSupportMode.iframeView
to avoid breaking behavior.You can set
youtubeVideoSupportMode
to load the YouTube video by Download URL on Desktop platforms:Checklist
CHANGELOG.md
nor the package version inpubspec.yaml
files../scripts/before_push.sh
and it all passed successfullyBreaking Change
Does your PR require developers to manually update their apps to accommodate your change?
!
in the title as explained in Conventional Commits).