Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stream video in nodejs

I'm trying to stream a video from my server but it doesn't work or I may do it wrong :

My routes are defined like :

var fs = require('fs');

router.get('/', function(req, res) {
  fs.readdir(__dirname + '/../public/videos', function(err, data){
      res.render('videos', {files: data});
  });
});

router.get('/:file', function(req, res) {
  res.render('videofile', {file: req.params.file});
});

In my jade template file I have for video.jade :

ul
  for file in files
    li
      p
       a(href=file)= file

Actually it lists all videos in my video repertory.

and then for videofile.jade

video
  source(src=file type="video/webm")

I want it to work on my iOS device but it doesn't ( it stays on the same page)

like image 450
Terry Rapt Avatar asked Oct 22 '15 09:10

Terry Rapt


1 Answers

iOS does not support webm. H.264/AAC/MP3 codecs in an mp4 container is the "correct" format.

like image 160
szatmary Avatar answered Oct 01 '22 06:10

szatmary