steemit / condenser

The greatest application front-end to the Steem Blockchain.
https://steemit.com
505 stars 430 forks source link

Make it simpler to add support for embedded video player #3643

Open quochuy opened 4 years ago

quochuy commented 4 years ago

This is a note for refactoring the embedded player logic in the Condenser. Currently, we need to modify multiple files in order to support other video platform (youtube, dtube etc...). This can be changed to read a config file (JSON). For example:

{
  "vimeo": {
    "regex": {
      "link": "/https?:\/\/(?:vimeo.com\/|player.vimeo.com\/video\/)([0-9]+)\/?(#t=((\d+)s?))?\/?/",
      "videoId": "/(?:vimeo.com\/|player.vimeo.com\/video\/)([0-9]+)/"
    },
    "code": {
      "thumbnail": "https://img.youtube.com/vi/<VIDEO_ID>/0.jpg",
      "embeddedPlayer": "https://www.youtube.com/embed/<VIDEO_ID>",
    }
  }
}

This will make it easier to add support for more platforms in the future.

quochuy commented 4 years ago

Already started, just awaiting for results on https://github.com/steemit/condenser/pull/3655 to merge back and refactor into the new format.