Skip to content

[Story video] Use inlined video cache responses #37397

@gmajoulet

Description

@gmajoulet

Description

amp-video[cache=google] sends a XHR request to a Google hosted backend to retrieve cached sources.
The AMP Cache is now inlining the cached sources for the first 5 videos of each Story. amp-video should try to get the sources from the script id=amp-google-video-cache-response before sending the XHR request.

<head>
<script id=amp-google-video-cache-response type=application/json>{
  "1":  {
    "sources":    [
      {
        "url": "http://foo_kyoto.mov",
        "codec": "h264",
        "type": "video/mp4",
        "bitrate_kbps": 400
      },
      {
        "url": "http://bar.mp4",
        "codec": "h264",
        "type": "video/mp4",
        "bitrate_kbps": 2000
      }
    ],
    "has_audio": false
  },
  "2":  {
    "sources":    [
      {
        "url": "http://foo_osaka.mov",
        "codec": "h264",
        "type": "video/mp4",
        "bitrate_kbps": 400
      },
      {
        "url": "http://bar.mp4",
        "codec": "h264",
        "type": "video/mp4",
        "bitrate_kbps": 2000
      }
    ],
    "has_audio": false
  }
}
</script>
</head>
<body>
  ...
  <amp-video amp-google-cache-video-id=0  cache="google" ... 

cc @ampproject/wg-stories

Alternatives Considered

Additional Context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions