Possible improvement in Learn/HTML/Multimedia_and_embedding/Video_and_audio_content

I am reading this page and find the sections ‘Restarting media playback’ and ‘Detecting track addition and removal’ out of context.

I find it odd because the document within HTML up to this point has been avoiding Javascript and CSS beautifully. And these two sections also don’t mention how these two Javascripts snippet applies to HTML.

I suspect that these two sections aren’t supposed to be here.