Steemit Condenser Contributions: Refactoring embedded player code

Words
267
Reading
2 min
Listen
Play
7y

Context

Adding embedded player for video or audio services (Youtube, Vimeo, DTube etc...) to the Condenser has always been a pain with the related logic split into many files making it difficult to maintain.

The purpose of this change is to centralise the logic as much as possible so that we only need to update a couple of files for each new embed player to support.

My 3Speak embedded player support has been approved and deployed recently, this allowed me to complete this work and move the 3Speak code into the new architecture.

Steemit Condenser Contributions

The work done

I moved the logic from the following files:

  • src/app/utils/Links.js
  • src/app/utils/SanitizeConfig.js
  • src/app/utils/SlateEditor/Iframe.js
  • src/shared/HtmlReady.js
  • src/app/components/cards/MarkdownViewer.jsx

Into files located under src/app/components/elements/EmbeddedPlayers. To add a support for a new player, the developer only needs to create a new provider file, for example src/app/components/elements/EmbeddedPlayers/threespeak.jsx and configure it inside the main script src/app/components/elements/EmbeddedPlayers/index.jsx

As seen below, as a result, wherever we needed to call the code for each provider, we now just call a central method EmbeddedPlayerNode() which then do the rest for us.

Condenser Embedded Player code

Steemit Condenser Pull Request

This feature is not out yet, a pull request has been created:
https://github.com/steemit/condenser/pull/3704.

Once approved and merged, it will be available in a future release by Steemit Inc.


Vote for my witness
Support @quochuy Witness.jpg
On Steem, Witnesses are playing the important role of providing a performant and safe network for all of us. You have the power to choose 30 trusty witnesses to package transactions and sign the blocks that will go in the Steem blockchain. Vote for me via SteemConnect to help me do more useful projects for the communities.

Steemit Condenser Contributions: Refactoring embedded player code | Ecency