Youtube Embed vs Youtube player API


I am learning about embedding videos and wanted to know which method is better?

Previously, I've just used the share>embed method and pasted a bunch on one page. But I've come across the method shown here. It uses html and JavaScript to put the iframe up. Apparently there used to be another way to change the parameters, but it was deprecated?

Is using the api method faster or have other benefits I should know about? I am rather new at JavaScript, but I can more or less follow what's going on.