I’m not sure how the YouTube API works, but how I implement spinners generally is to create them in CSS, then hide or show them when an AJAX call is launched or finished. This is really, really easy to do with jQuery since it has global event handlers for its AJAX functions. When it comes to using Fetch, you could wrap your calls in a function and handle the spinner logic there, or create your own abstraction library that fires off events like jQuery.
My RxJS example project uses a spinner in this way:
Don’t worry about understanding this, just focus on lines 29 - 38. The loader is a
div with a CSS animation (that I shamelessly stole from somewhere on the webs) When jQuery fires off the “ajaxSend” event, the loader is shown. When the “ajaxComplete” event fires, the loader is hidden.
Hope that helps.