Embed youtube in header of form called from code in textarea

Howdy! I don’t know if this has been done of if I’m living in never-never land but it’s something I would like to be able to do for my course notes software.
I have a python program that allows me to take notes as I’m watching you tube lecture video. The form where I enter the notes has a header and then the form. The form and header are dynamic and used by other class notes sections so I can’t embed the code directly into the header because it would show for each class notes page. I am able to copy the you tube embed code into the notes section and then when I save the notes it displays the notes as laid out by the HTML and the embedded video.
What I would like to do is copy the embed code into the text area, save the file go back to edit mode and have the video display in the header of the form by having javascript read the code off the page of the specific div where the code is pasted. I’ve never seen or heard of anything like this and it’s way beyond my coding abilities. Any ideas?
Thanks