YouTube Autoplay

I am trying to autplay YouTube Videos from an alert and the video works fine, but the autoplay feature is not working.

client side code:
ytv = YouTubeVideo(youtube_id=“yLU6NpBWv2M”, autoplay=True)
alert(ytv, buttons=[(‘Close’, None, None)], large=True)

I moved the code to trigger from a button click rather than a form opening, and that did the trick