sur950 / any_link_preview

A flutter Plugin/Package to show the preview of any web link that starts with HTTP/HTTPS. Mostly useful for application that had chat.
MIT License
72 stars 72 forks source link

Multimedia doesn't open #33

Closed akshayru closed 4 months ago

akshayru commented 2 years ago

I am trying to open the multimedia link which has a link, while it shows the link data correctly but it doesn't load the image.

 SizedBox(
                        height: 400,
                        child: AnyLinkPreview(
                          link:
                              "https://www.amazon.com/gp/product/B00JZEW4XS?ie=UTF8&th=1&linkCode=li1&tag=pratiksharu-20&linkId=1d34bc8b2b8b01132376486955c5d313&language=en_US&ref_=as_li_ss_il",
                          displayDirection: UIDirection.uiDirectionVertical,
                          cache: Duration(hours: 1),
                          backgroundColor: Colors.grey[300],
                          showMultimedia: true,
                          errorWidget: Container(
                            color: Colors.grey[300],
                            child: Text('Oops!'),
                          ),
                          errorImage:
                              "https://i.ytimg.com/vi/z8wrRRR7_qU/maxresdefault.jpg",
                        ),
                      ),
akshayru commented 2 years ago

It would be cool if you can add feature for HTML, like below

<iframe sandbox="allow-popups allow-scripts allow-modals allow-forms allow-same-origin" style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ss&ref=as_ss_li_til&ad_type=product_link&tracking_id=pratiksharu-20&language=en_US&marketplace=amazon&region=US&placement=B09C48JHRG&asins=B09C48JHRG&linkId=de0ac5de72ebff676228cc6a6c17994c&show_border=true&link_opens_in_new_window=true"></iframe>

<a href="https://www.amazon.com/ZXTY-Triangle-Quilting-Supplies-Accessories/dp/B09C48JHRG?_encoding=UTF8&pd_rd_w=2eQ1w&content-id=amzn1.sym.bbb6bbd8-d236-47cb-b42f-734cb0cacc1f&pf_rd_p=bbb6bbd8-d236-47cb-b42f-734cb0cacc1f&pf_rd_r=5Q85T8C3DZYK8CHVYDVB&pd_rd_wg=tgnLL&pd_rd_r=6b080242-9315-480c-bf97-3ac72f3a3b0f&th=1&linkCode=li2&tag=pratiksharu-20&linkId=07c167dc6642bf2671016812c17b0584&language=en_US&ref_=as_li_ss_il" target="_blank"><img border="0" src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=B09C48JHRG&Format=_SL160_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=pratiksharu-20&language=en_US" ></a><img src="https://ir-na.amazon-adsystem.com/e/ir?t=pratiksharu-20&language=en_US&l=li2&o=1&a=B09C48JHRG" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />

sur950 commented 2 years ago

Hi @akshayru

Thanks for reporting. I haven't tried with any link with multiple images, I think the amazon shopping link that you have pasted is having multiple images. Let me give a try & fix this issue.

Also on the "iframe" functionality, It's in my bucket.

Could you elaborate on Anchor tag use case, href value is the URL that will be passing as an URL to get preview widget. Enabling/Disabling onTap to navigate is something which you still have the control.

akshayru commented 2 years ago

Amazon provides a way to promote products and they provide product info in two formats i shared so we can integrate that within apps and promote products when user click on that link it takes them to amazon. The link "https://www.amazon.com/gp/product/B00JZEW4XS?ie=UTF8&th=1&linkCode=li1&tag=pratiksharu-20&linkId=1d34bc8b2b8b01132376486955c5d313&language=en_US&ref_=as_li_ss_il" actually have only one image which Facebook can decode correctly. image

sur950 commented 2 years ago

Got you, Meta data doesn't have single image, Facebook might be considering one image as primary & might be rendering the same.

However, I have added this my list, I will fix this one in coming release.

Regarding iframe, that might take a little while since the implementation idea that I had only works for Android, IOS. We will loose web, desktop supports if I add that. Anyhow, I will plan for a pre-release with iframe support by restricting the view to just Android, IOS.

Thanks!

akshayru commented 2 years ago

I believe it's not about a single image vs multiple images, for example, if you try the below link you will see the similar issue. It loads the link but no images. https://www.amazon.com/Sewing-Machine-Compatible-Brother-Daylight/dp/B08NHHDCV7?th=1&linkCode=li2&tag=pratiksharu-20&linkId=c27b73d55a561d87fd532032d67a30bf&language=en_US&ref_=as_li_ss_il image

sur950 commented 2 years ago

Hi @akshayru

I have invested this issue, Seems the image links that were shared are not http links. So we have to handle them in different way. This gonna take a little while, I don't have bandwidth.

I am calling the community for their contribution on this.

Thanks!

akshayru commented 2 years ago

Thanks for checking @sur950, I will try and see possible options. For now i was able to continue my development using link_preview_generator.

sur950 commented 6 months ago

Hi, This fix is accommodated in Version 3.0.2.

Screenshot 2024-04-08 at 4 54 12 PM Screenshot 2024-04-08 at 5 03 59 PM

Not sure if the link is still valid. I tried with a few amazon links & the image link that they are giving on metadata is secure one. For a few links since captcha is added it's restricted to redirect further.

sur950 commented 6 months ago

any_link_preview: ^3.0.2 is Live now.

Give a try with the latest version & let me know if you face any issues.

sur950 commented 4 months ago

Since there is no response, I am closing this issue.

Feel free to log a new one if the issue persist. Thanks!