-
Notifications
You must be signed in to change notification settings - Fork 16
Added support for preview of Facebook video #6105 #94
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for the PR. First of all I see there's a unit tests coverage drop, please make sure to add proper unit tests for the new code.
Also could you provide more information on this problem:
Fix portrait videos shrink.
Finally I think you have added allow="autoplay" I believe this is not something that should be enabled by default.
It's my very first time both using github and contributing, sorry in advance for messing up.
Yes, square and horizontal videos looks like this: And the vertical videos looks like this:
Yes you right, tbh I had copied vimeo version of template which contains this too. |
OK, I give up, what is wrong with my test? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look closely at assertion error message, you'll see the answer (I changed changed the formatting in pasted content to make it more readable).
AssertionError: assertion for "https://www.facebook.com/xyz/videos/1234": expected
'<figure class="ck-widget media" contenteditable="false"><div class="ck-media__wrapper" data-oembed-url="https://www.facebook.com/xyz/videos/1234"><div style="height:0;padding-bottom:100%;position:relative"><iframe allow="encrypted-media" frameborder="0" src="https://www.facebook.com/plugins/video.php?show_text=false&href=https://www.facebook.com/watch/?v=1234" style="height:100%;left:0;position:absolute;top:0;width:100%"></iframe></div></div></figure>'
to match
/<figure[^>]+><div[^>]+><div style="height:0;padding-bottom:100%;position:relative"><iframe allow="encrypted-media" frameborder="0" src="https:\
/\/www.facebook.com\/plugins\/video.php?show_text=false&href=https:\/\/www.facebook.com\/watch\/?v=1234" style="height:100%;left:0;position:absolute;top:0;width:100%"><\/iframe><\/div><\/div><\/figure>/
Based on this you can say that the regexp does not match. To se what exactly is the problem I recommend to use tools like https://regexr.com/ (or any other, there are many other great regexp tools) to put the entire regexp and tested content there. At first it won't match anything - that's ok because this is what's happening.
What you want to do from there is remove parts of regexp, piece by piece until it starts matching - this will tell you where exactly the problem is. It's basically as if you'd do manual a git bisect
, just for regexp.
I believe the way we're making a dynamic runtime regexp doesn't take into accounts some special characters, and you'd need to correct that.
The problem with cropped videos is a little bigger that I initially thought, as this bottom part do contain valuable information that should not be missing. So we need to have this sorted out before merging the PR.
And @ElectroluxV2 since you mentioned you're fresh to GH - you can paste images directly into the GH comments - that way others will not have to leave it to see your screens, etc. |
📝 Provide a description of the improvement
Now links like https://www.facebook.com/realitetiofficial/videos/458353101779653/ or https://www.facebook.com/watch/?v=458353101779653 will have preview.
TODO (can't do this myself)
📃 Details
If you'd like to see this improvement implemented, add a 👍 reaction to this post.