Currently our intention is for the post-normalizer to select the first usable media as canonical media.
There is a case though, where if the first usable media is a video but it is followed by 4+ usable images we display a gallery instead. This is a mistake and we should actually show the video instead!
This issue can be closed when the case where a video followed by 4 images gets chosen to be a video card instead of a gallery card (along with unit tests).
@samouri I see the last activity on this issue is Jun 2018. I am looking to start contributing to Calypso. Is this bug still considered active?
As a test case, I created a post with a video and 4 images at http://www.dufair.org/blarpy/2019/02/11/12/. When I follow http://www.dufair.org/blarpy in the reader tab, the card that is generated is of the first image, not the video, nor a gallery. Is this a reasonable way to test this bug?
@jkdufair: I no longer work on Calypso and am pretty out of the loop.
I know that the post-normalizer has specific requirements around the min-size an image can be in order to be qualified for a gallery. One of your 4 images is smaller than 200x200, I'd suggest swapping it with something at least 400x400 to be safe.
ccing @bluefuton / @blowery for further guidance
Thanks for fielding that @samouri :)
@jkdufair great to hear you'd like to contribute to Calypso. As @samouri suggests, you'll need at least 4 images with a minimum width of 300px to see a gallery card. A good place to start is classifyPost, which chooses the type of card to display for each post:
Sorry for the delay. I'll give that at look now. Thanks for the tip!
@bluefuton It appears that the root cause of this issue is that gutenberg now uses the html5 'video' tag vs an iframe embed. These aren't being detected in the rule-pick-canonical-media.jsmodule. Posts that still use the embed strategy generate the correct card, even with 4 large images appearing subsequently in the post.
I took a first stab here. Should we try to lump iframe embedded video and html5 <video/> tags all as mediaType: video?
Good sleuthing @jkdufair! Thanks for looking at this.
Should we try to lump iframe embedded video and html5
<video/>tags all asmediaType: video?
That makes sense to me 馃憤
Would it be possible to add some tests to client/lib/post-normalizer/tests/index.js demonstrating the new behaviour?