Add nbVideo & nbAudio (revive #153)
for all_blocks.nim I wasn't sure what to put, so I ended up just putting Bad Apple instead :P please feel free to change! maybe reference some of that stuff in the Q&A. or maybe you should keep it instead, perhaps.
Some changes made:
relToRootusesisAbsolute-- thought this was better than checking for "http" as the first four letters of the string- You can now set the MIME type of the media (doesn't assume based on file ext.), and set the
autoplay,muted, andloopattributes of the video/audio html tag
thanks! the changes greatly improve on #153 :)
I just learned about bad apple yesterday and I am definitely very amused 🤣 by this coincidence 🤯 and approve of the choice 🍎.
Instead of references in Q&A we could:
- add a link to this explainer as the example url for
nbVideoelement (two advantages: 1) we show the url can be both relative and a web url; 2) we can remove the 7MB video asset) - invert
nbAudioandnbVideosection inallblocks.nim(so that the audio comes before the "explainer")
Last thing is to ask if @HugoGranstrom did know about bad apple (he is definitely younger than me) and if he is ok with the choice.
Had no idea about Bad Apple, but I definitely applaude the choice 😂
add a link to this explainer as the example url for nbVideo element
afaik, its impossible to insert a Youtube video into a <video> tag without some external Javascript dependency. We should probably add a link to the explainer in the nbVideo section instead.
For the audio & video assets, those can be replaced by either of these two from archive.org.
Ah I guess you are right. This poses the question, should nbVideo be just a little wrapper for html video tag or also do the right thing (to embed a YouTube video we could use a iframe instead of JS right?) in case eg you put a link to YouTube?
I do not think we should get an answer in this PR, we could open a new issue if we feel like discussing this.
For the scope of the PR I would just add a link to the explainer for the moment. I think assets of a few MB are fine and there is no need to go with archive (which I guess might be slower to be reached? Or maybe not?)
sorry it took so long! should be ready to merge, no?
yep, looks good to me, thanks!