That plastic thing on a cord is a ferrite bead, ferrite core or sometimes also known as a choke.
The choke or ferrite bead or ferrite core is added to some cords to prevent electrical interference.
Cables act like unintentional antennas and can broadcast electrical interference or noise or pick it up and the chokes prevent the interference from occurring.
Ferrite beads, often called Ferrite chokes or Ferrite rings, are passive electronic components who's job is to help suppress radio frequency interference (RFI) on a power supply line.
They can be a very useful tool in your sound bar or powered monitor set up and should take you less then 5 minutes to install!
The performance of power cords is enhanced by fitting the ferrite cores.
In HDMI cables and speaker cords, the incorporation of ferrite cores makes the signal quality better.
Ferrite cores are inexpensive and low-risk noise suppression systems.