1

I'm really new to video streaming, It confuse me

front end:Video.js

<video id="example_video_1" controls="" preload="auto" width="854" height="480" poster="/thumb/1405003437328.mp4-thumbnail-1-undefinedxundefined.jpg" data-setup="{&quot;example_option&quot;:true}" class="video-js vjs-default-skin">
  <source src="/stream/53bea6ad7ff1919812067e74">
</video>

I have two routes for this video

first route

 /video/video._id/videoname.mp4
 I use this route to render the video streaming html which include a video tag

 exports.get = function(req, res) {
    Video.findById(req.params._id, function(err, video) {
        if (err) {
            res.send(500, {
                error: err
            })
        }
        res.render('video', {
            video: video
        })
    })
 }

second route

 /stream/video._id
 I use this video for streaming

 exports.stream = function(req, res) {
     Video.findById(req.params._id, function(err, video) {
        if (err) {
            throw err
        }
        console.log(video)
        var videopath = path.join(__dirname, '../../userUpload/', video.src);
        console.log(videopath)

        res.contentType('flv');
    // make sure you set the correct path to your video file storage

        var proc =new  ffmpeg({source: videopath})
            // use the 'flashvideo' preset (located in /lib/presets/flashvideo.js)
            .usingPreset('flashvideo')
            // setup event handlers
            .on('end', function() {
                console.log('file has been converted succesfully');
            })
            .on('error', function(err) {
                console.log('an error happened: ' + err.message);
            })
            // save to stream
            .writeToStream(res, {
                end: true
            });
        })
    }

I use fluent-ffmpeg to streaming video ,above code is in its examples

when the first route is served it will request the /stream/video._id route, but when I hit the play button on the web nothing happened ,please help me understanding video streaming!

thanx

paynestrike
  • 4,348
  • 14
  • 46
  • 70
  • 1
    Here you can find some resources http://stackoverflow.com/questions/4241992/video-streaming-over-websockets-using-javascript – Silom Jul 14 '14 at 14:09
  • It seems like you are using some sort of flash video and not html5 video. – NatureShade Jul 18 '14 at 13:12

0 Answers0