Make sure that your custom gadget is accessible with both protocols, http and https.
When user opens your channel with url https://youtube.com/[username], youtube will render your gadget in iframe with https, when user opens http://youtube.com/[username], youtube will render http version of your gadget.
Just make sure that you are not redirecting from http to https.
We made a gadget like this a couple of days ago with dynamic resizing and keeping in mind what i wrote earlier everything works on both protocols.