« first day (5034 days earlier)      last day (136 days later) » 

00:08
just for a muse
<!-- conway-life-webgpu.html -->

<style>
      canvas {
            position:absolute;
            left:0;
            top:0;
            width:100%;
            height:100%;
      }
      button {
            position:absolute;
            left:10px;
            top:10px;
            font-size:20px;
            padding:10px 20px;
            cursor:pointer;
      }
</style>

<canvas></canvas>
<button>stop</button>

<script type=module>

      if(!navigator.gpu)throw 'webgpu not supported';

      var adapter                     = await navigator.gpu.requestAdapter();
cant get it to run properly in jsbin and others
//  life.node.js

        require('http').createServer(request).listen(8005);
        console.log('listening 8005');

        function request(req,res){

              res.writeHead(200,{'content-type':'text/html'});
              var html    = require('fs').readFileSync('life.html');
              res.end(html);

        }//request
 
3 hours later…
02:52
|| status
I am currently alive!
@matt i might eventually
ok
it's in rust tho
oh
whats the front end like
02:53
Next.js/React
i did a fair bit of work using ffmpeg in the browser, its ok, slowish though
this is the half broken video conversion piece
fn generate_thumbnail(entry: &DirEntry, width: u32, height: u32) -> Result<RgbImage, VideoError> {
        ffmpeg_next::init().unwrap();
        let mut context = ffmpeg_next::format::input(&entry.path())?;
        let stream = context.streams().best(ffmpeg_next::media::Type::Video).ok_or(VideoError::FfmpegError(ffmpeg_next::Error::StreamNotFound))?;
        let codec = Context::from_parameters(stream.parameters())?;
        let mut decoder = codec.decoder().video()?;

        let mut decoded = VideoFrame::empty();
(if you're wondering, using the scaler to actually do resizing breaks it further, i just used a different library)
does it use the ffmpeg binary
it uses ffmpeg via ffi
ffi?
02:55
like using the c library
oh right, can you remember the name of library
i was looking into this library a while ago also github.com/gpac/mp4box.js
it's just ffmpeg
doesnt ffmpeg have an option to generate a thumbnail
yes, but i want to do it manually
(like the command line provides an interface, but it should be doing exactly what i am manually)
ah right, dont blame you, i like to do that also
 
5 hours later…
08:12
just for a muse
(async ()=>{

      var res     = new Response('<html></html>');
      var fetch   = (url,opts)=>new Promise(resolve=>resolve(res));

      var txt   = await fetch('http://localhost/index.html').then(res=>res.text());
      console.log(txt);

})();
 
13 hours later…
21:13
this was a bizarre, crazy one
ffmpeg in the browser, loaded from github
<style>
      body {
        font-family:arial;
      }
      img {
        border:1px solid blue;
      }
      canvas {
        border:1px solid green;
      }
</style>

<h3>ffmpeg in the browser, loaded from github</h3>
<h3>generate thumbnail</h3>
<h4 id=init>initialising...</h4>
<pre id=log></pre>

<script>

(async()=>{   console.clear();


      var url       = 'https://raw.githubusercontent.com/javascript-2020/stackoverflow/main/ffmpeg/';
      var fetch2    = file=>(console.log('fetch',file),fetch(url+file).then(res=>res.text()));
@user7886229, heres a bizarre example you might find interesting

« first day (5034 days earlier)      last day (136 days later) »