You can convert the old YouTube embed code to the new one using jQuery. However, please note that the YouTube Flash player has been deprecated, and it's recommended to use the newer iframe-based embed code instead.

Here's how you can achieve the conversion:

HTML (Old Embed Code):

<object type="application/x-shockwave-flash" width="280" height="195" data="http://www.youtube.com/v/B1BAY-IBLc0" id="ltVideoYouTube" vspace="4" hspace="4" align="left">

  <param name="movie" value="http://www.youtube.com/v/B1BAY-IBLc0" />

  <param name="wmode" value="transparent" />

  <param name="allowScriptAcess" value="always" />

  <param name="quality" value="best" />

  <param name="bgcolor" value="#FFFFFF" />

  <param name="FlashVars" value="playerMode=embedded" />

  <embed src="http://www.youtube.com/v/B1BAY-IBLc0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="280" height="195"></embed>

</object>

 

JavaScript (using jQuery) - Insert this snippet into the <head> section of your website:

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>

$(document).ready(function() {

  // Get all old YouTube embed objects

  $('object[data^="http://www.youtube.com/v/"]').each(function() {

    // Get the YouTube video ID from the data attribute

    var youtubeVideoID = $(this).attr('data').split('/').pop();

 

    // Create the new iframe-based embed code

    var newEmbedCode = '<iframe width="280" height="195" src="https://www.youtube.com/embed/' + youtubeVideoID + '" frameborder="0" allowfullscreen></iframe>';

 

    // Replace the old embed object with the new iframe code

    $(this).replaceWith(newEmbedCode);

  });

});

</script>

In this JavaScript code, we use jQuery to select all object elements with a data attribute that starts with "http://www.youtube.com/v/". This allows us to target the old YouTube embed objects. We then extract the YouTube video ID from the data attribute and create a new iframe-based embed code with the video ID. Finally, we replace the old object element with the new iframe code using the .replaceWith() method.

Please ensure that you include the jQuery library (as shown in the JavaScript section) before using this code. Additionally, it's always a good practice to test the code on a test page to ensure everything works as expected with your specific setup.