bbc / simorgh

The BBC's Open Source Web Application. Contributions welcome! Used on some of our biggest websites, e.g.
https://www.bbc.com/pidgin
Other
1.42k stars 229 forks source link

Add AV block to MAPs #4097

Closed pjlee11 closed 5 years ago

pjlee11 commented 5 years ago

Is your feature request related to a problem? Please describe. We need to add a preprocessor rule that takes an aresMedia block and generates an Optimo format AV block/s.

Describe the solution you'd like Create a new generator that takes an aresMedia block and creates an Optimo format video block with support for caption, aresMediaMetadata, aresMedia, image etc. This should then be rendered using the blocks container logic similar to how Articles render the Media Player component.

Describe alternatives you've considered N/A

Testing notes [Tester to complete]

Dev insight: Snapshot testing and E2Es are required to ensure a headline is rendered on the page.

Additional context

Optimo format video block:

        {
          "model": {
            "blocks": [
              {
                "model": {
                  "blocks": [
                    {
                      "model": {
                        "blocks": [
                          {
                            "model": {
                              "blocks": [
                                {
                                  "model": {
                                    "attributes": [

                                    ],
                                    "text": "Video, Clip, International and UK, Guidance, Subtitles"
                                  },
                                  "type": "fragment"
                                }
                              ],
                              "text": "Video, Clip, International and UK, Guidance, Subtitles"
                            },
                            "type": "paragraph"
                          }
                        ]
                      },
                      "type": "text"
                    }
                  ]
                },
                "type": "caption"
              },
              {
                "model": {
                  "blocks": [
                    {
                      "blockId": "urn:bbc:ares::clip:p01k6msm",
                      "model": {
                        "advertising": true,
                        "embedding": true,
                        "format": "audio_video",
                        "id": "p01k6msm",
                        "imageCopyright": "BBC",
                        "imageUrl": "ichef.test.bbci.co.uk/images/ic/$recipe/p01k6mtv.jpg",
                        "subType": "clip",
                        "syndication": {
                          "destinations": [

                          ]
                        },
                        "synopses": {
                          "short": "They may be tiny, but us humans could learn a thing or two from ants."
                        },
                        "title": "Five things ants can teach us about management",
                        "versions": [
                          {
                            "availableFrom": 1540218932000,
                            "availableTerritories": {
                              "nonUk": true,
                              "uk": true
                            },
                            "duration": 191,
                            "durationISO8601": "PT3M11S",
                            "types": [
                              "Original"
                            ],
                            "versionId": "p01k6msp",
                            "warnings": {
                              "long": "Contains strong language and adult humour.",
                              "short": "Contains strong language and adult humour."
                            }
                          }
                        ]
                      },
                      "type": "aresMediaMetadata"
                    },
                    {
                      "model": {
                        "blocks": [
                          {
                            "model": {
                              "copyrightHolder": "BBC",
                              "height": 1080,
                              "locator": "ichef.test.bbci.co.uk/images/ic/$widthxn/p01k6mtv.jpg",
                              "originCode": "mpv",
                              "width": 1920
                            },
                            "type": "rawImage"
                          },
                          {
                            "model": {
                              "blocks": [
                                {
                                  "model": {
                                    "blocks": [
                                      {
                                        "model": {
                                          "blocks": [
                                            {
                                              "model": {
                                                "attributes": [

                                                ],
                                                "text": "Ants"
                                              },
                                              "type": "fragment"
                                            }
                                          ],
                                          "text": "Ants"
                                        },
                                        "type": "paragraph"
                                      }
                                    ]
                                  },
                                  "type": "text"
                                }
                              ]
                            },
                            "type": "altText"
                          }
                        ]
                      },
                      "type": "image"
                    }
                  ]
                },
                "type": "aresMedia"
              }
            ],
            "locator": "urn:bbc:pips:pid:p01k6msm"
          },
          "type": "video"
        },
ryanmccombe commented 5 years ago

will catch up with @jamesdonoh before refining

ryanmccombe commented 5 years ago

CPS does not have all the data required for the sample optimo payload above

So, what I have implemented is stripped back somewhat, however, the things that were removed all appear to be unused within Simorgh anyway, so also has the benefit of simplifying things:

Where things were unused, but the data was available within the CPS payload, I just included the transformation anyway