YouTube videos on my form

Have tried to link a YouTube video and despite being set to autoplay, it 1) doesn’t play automatically and 2) when I click play the video says ‘An Error has occurred’

Any ideas why the video isn’t playing?
(I had been trying to link it to play when a label is hovered over but that’s the next step!)

Can you give me the YT link and I’ll test here?

This link works fine (with and without autoplay) : XyNlqQId-nk

so I’m guessing the video you are linking to might not like being linked to for some reason. Did the error message say anything else?

don’t judge…teaching Year 9 student show to turn their python text based adventure games into visual adventures!

Blimey! Scared me half to death!

Ok that works for me - are you putting the whole link in or just the very last bit (the random letters of the video’s id)?

just the very last bit

Ok, again I’ll need to see your project - please can you clone it like you did with the maps one?

(copied from a PM, just to complete this thread)

You were not referencing the YT control in the page, but instead creating a new one.

So either set up the one you put on the page with the designer :

self.youtube_video_1.youtube_id="2lPcCNyopGI"
self.youtube_video_1.autoplay = True

or remove that and add the one you created in code to the page :

ytv = YouTubeVideo(youtube_id="2lPcCNyopGI", autoplay=True)
self.add_component(ytv)