[amp-story-player] story player stuck with some story URLs when using cached version of story
What's the issue?
Story player get stuck at one story with some specific stories and AMP cache version ie. amp-cache="cdn.ampproject.org".
How do we reproduce the issue?
https://jsfiddle.net/tj9w6gab/8/
Click on the above URL you'll see amp-story-player. In that player I've added 3 valid amp story URLs. Try to move player to second story by clicking on slides or swipe to left. Story player got stuck on first story.
What browsers are affected?
All browsers
Which AMP version is affected?
-
It seems like the amp-cache-toolbox is resolving the url
https://recipes-timesofindia-com.cdn.ampproject.org/v/s/recipes.timesofindia.com/web-stories/8-vegetable-flours-and-their-benefits/photostory/80139765.cms
but checking the actual cache url, I get:
https://m-recipes-timesofindia-com.cdn.ampproject.org/v/s/m.recipes.timesofindia.com/web-stories/8-vegetable-flours-and-their-benefits/photostory/80139765.cms?amp_js_v=0.1#visibilityState=inactive&origin=https%3A%2F%2Fm-recipes-timesofindia-com.cdn.ampproject.org&showStoryUrlInfo=0&storyPlayer=v0&cap=swipe
The real cache url has an m- prepended to the url, but the createCacheUrl in AmpCacheUrlGenerator does not provide that. This mismatch is causing the messaging between the iframe and player to fail.
https://github.com/ampproject/amp-toolbox/blob/94956207cd0de658da9553424c4881481e96a612/packages/cache-url/lib/AmpCacheUrlGenerator.js#L46
@sebastianbenz do you have any idea why this is happening?
No idea. I don't think that this is a problem with how we're calculating the cache URL. My guess is that GoogleBot gets a different document served. For example, https://m.recipes.timesofindia.com/web-stories/8-vegetable-flours-and-their-benefits/photostory/80139765.cms redirects me to https://recipes.timesofindia.com/web-stories/8-vegetable-flours-and-their-benefits/photostory/80139765.cms.
Found an older issue that bumped into the same problem https://github.com/ampproject/amphtml/issues/7274
We need to make a change to the viewer integration messaging library to handle the redirect case.