nimib icon indicating copy to clipboard operation
nimib copied to clipboard

Add nbVideo & nbAudio (revive #153)

Open neroist opened this issue 1 year ago • 5 comments

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:

  • relToRoot uses isAbsolute -- 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, and loop attributes of the video/audio html tag

neroist avatar Jun 26 '24 05:06 neroist

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 nbVideo element (two advantages: 1) we show the url can be both relative and a web url; 2) we can remove the 7MB video asset)
  • invert nbAudio and nbVideo section in allblocks.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.

pietroppeter avatar Jun 30 '24 17:06 pietroppeter

Had no idea about Bad Apple, but I definitely applaude the choice 😂

HugoGranstrom avatar Jul 01 '24 12:07 HugoGranstrom

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.

neroist avatar Jul 03 '24 08:07 neroist

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?)

pietroppeter avatar Jul 05 '24 06:07 pietroppeter

sorry it took so long! should be ready to merge, no?

neroist avatar Jul 08 '24 12:07 neroist

yep, looks good to me, thanks!

pietroppeter avatar Jul 10 '24 17:07 pietroppeter