0

when I share a youtube video via the youtube app from mobile to Whatsapp then it shows a thumbnail with the link is it possible to do it in a flutter as like that, in this video share range rover video on Whatsapp when I go to Whatsapp it looks like that, I want this in my flutter app any idea?

enter image description here

Adnan haider
  • 553
  • 8
  • 21
  • Get thumbnail https://stackoverflow.com/a/2068371/13701546 and format tile as you like. you can get other YT api here https://developers.google.com/youtube/v3/docs/thumbnails#resource if you need more data – Simon Sot Jan 28 '22 at 06:52
  • @SimonSot i want that i am using share_plus package to share my video url to any app i share so when i share then this look like to show if my app is not download then if user click this video then it will go to playstore to download my app. this video is not coming from youtube but it came from restful api – Adnan haider Jan 28 '22 at 06:57
  • it's called deeplinks, you should check docs here [link](https://docs.flutter.dev/development/ui/navigation/deep-linking) – Ruchit Jan 28 '22 at 07:03
  • @Ruchit i try or check – Adnan haider Jan 28 '22 at 07:06

1 Answers1

1

You can use firebase-dynamic-links for this.

screenshot

  void testingVideoLink() async {
    String uriPrefix = 'https://....page.link';
    final DynamicLinkParameters parameters = DynamicLinkParameters(
        uriPrefix: uriPrefix,
        link: Uri.parse('https://www.youtube.com/watch?v=_SB7h2kB6Eg'),
    );

    final ShortDynamicLink shortDynamicLink = await FirebaseDynamicLinks.instance.buildShortLink(parameters);
    Uri uri = shortDynamicLink.shortUrl;
    Share.share(uri.toString(), subject: '...');
  }
Ruchit
  • 2,137
  • 1
  • 9
  • 24
BIS Tech
  • 17,000
  • 12
  • 99
  • 148