magento2 – How to use Youtube Player API with jQuery in in Magento 2?

I’m using Magento 2.4 and i’m trying to use Youtube player API with jQuery in Magento 2 .phtml file like this first:

    require(('jquery'), function($){
        var tag = document.createElement('script');

        tag.src = "";
        var firstScriptTag = document.getElementsByTagName('script')(0);
        firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

However it is not working at all, then I tried to inject the youtube player api script in requirejs-config.js like this:

var config = {
    map: {
            youTubeIFrame: ''

.phtml file:

    require(('jquery','youTubeIFrame'), function($,YT){...

but the youtube video does not appear at all

Is there a correct way to load the Youtube Player API with jQuery in MAgento 2 ?