Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouTube #74

Closed
evgenijromanishyn opened this issue Mar 22, 2019 · 4 comments
Closed

YouTube #74

evgenijromanishyn opened this issue Mar 22, 2019 · 4 comments

Comments

@evgenijromanishyn
Copy link

It would be great to add YouTube support.

@The-Redhat
Copy link
Contributor

The-Redhat commented Mar 22, 2019

There's actually a package for inline displaying YouTube videos (https://github.com/hoanglm4/flutter_youtube_view). So I think this shouldn't be really complicated. If this feature is urgent for you, you should consider making a pr. The maintainer of the package hasn't got a lot of time.

@Sub6Resources
Copy link
Owner

@evgenijromanishyn I won't be adding native support for youtube videos since that's outside the scope of this project. (However, you can use the customRender function with the library @The-Redhat suggested to add support in your own project)

@evgenijromanishyn
Copy link
Author

It is wonderful! Thank you for your work :-)
Could you give me some sample code how do I combine these two packages?

@The-Redhat
Copy link
Contributor

Example code:

Html(
        data: '<video src="https://www.youtube.com/embed/tgbNymZ7vqY"></video>',
        customRender: (node, children) {
          if (node is dom.Element) {
            if (node.localName == 'video') {
              FlutterYoutube.playYoutubeVideoById(
                  apiKey: "<API_KEY>",
                  videoId: node.attributes['src'],
                  autoPlay: true,
                  fullScreen: true 
              );
            }
          }
        },
      ),

you could alternatively do the same for iframes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants