Express should serve video files just fine with static middleware and with
support of ranges.
It looks like your problem is on client side.


2014-05-11 6:33 GMT+03:00 Jake Wolpert <[email protected]>:

> I thought I could get away without streaming at first. Some browsers only
> like streaming, so I read up on it, started streaming and it works in every
> browser I tested (ff,chrome,safari,IE10+, IOS safari)
>
> The code I shared is what I use on my site.
>
> What do you mean by "other web components"? HTML markup? Is this a web
> page?
>
> Jake
>
> On May 10, 2014, at 1:02 PM, José G. Quenum <[email protected]> wrote:
>
> No I'm not streaming the video. I just declared the path in the video tag.
> Should I stream it? Could I get some examples?
> Btw, the view displaying the video contains other web components. How
> should I couple it with the streaming.
> Thanks
>
> --- José
>
> On 10 May 2014, at 6:46 PM, Jake Wolpert <[email protected]> wrote:
>
> Are you streaming the video? Do you see errors in the error console?
>
> The key to videos is to respect the *request.headers.range.*
>
> as in
> function send(err,data){
> if (err)
> return send404(fileName)
> cache.put(fileName,data,600000) // 10 minutes
>  var range = *request.headers.range* // bytes=0-1
> if (!range){
> response.writeHead(200, {
>  "Content-Type": mimeType,
> "X-UA-Compatible": "IE=edge;chrome=1",
> 'Content-Length': data.length
>  });
> response.end(data)
> }else{
> var total = data.length,
>  split = range.split(/[-=]/),
> ini = +split[1],
> end = split[2]?+split[2]:total-1,
>  chunkSize = end - ini + 1
> response.writeHead(206, {
> "Content-Range": "bytes " + ini + "-" + end + "/" + total,
>  "Accept-Ranges": "bytes",
> "Content-Length": chunkSize,
> "Content-Type": mimeType
>  })
> response.end(data.slice(ini, chunkSize+ini))
> }
> }
>
> On May 10, 2014, at 4:57 AM, Ghislain Quenum <[email protected]> wrote:
>
> I am developing an app where I'd like to show a video. The app is being
> developed with node.js and express 4. So I grabbed the videos module and
> added the html5 video tag in the view as follows:
>
> <video id="vidid" class="video-js vjs-default-skin" controls autoplay="none" 
> preload="auto" width="600" height="400">
>     <source src="path/to/video" type="video/mp4">
> </video>
>
>
>
> Note that for the path of the video, I declared the public folder as where
> all static assets should be served from. Then I created a videos folder
> under public and put the file in there. I also made sure I called the play
> function on the video in my script. Although the UI displays fine, the
> video does not load at all. I can't figure out why. Does anyone have any
> idea? Btw, I am testing it on Safari 7.0.3 Thanks in advance
>
> José
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/CAGXCHEmFmJS_-WoEHjFuJo-%2BjHY94WP5vgJ4197ekrc7wU%2B0DQ%40mail.gmail.com<https://groups.google.com/d/msgid/nodejs/CAGXCHEmFmJS_-WoEHjFuJo-%2BjHY94WP5vgJ4197ekrc7wU%2B0DQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/EEA59255-A383-4FC9-94AC-D38C735A97A9%40gmail.com<https://groups.google.com/d/msgid/nodejs/EEA59255-A383-4FC9-94AC-D38C735A97A9%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/E9075FAF-EC38-41CC-9B0F-34352E81AC70%40gmail.com<https://groups.google.com/d/msgid/nodejs/E9075FAF-EC38-41CC-9B0F-34352E81AC70%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>  --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/931D3E3C-499B-4973-88BE-C7A0CBF0FB67%40gmail.com<https://groups.google.com/d/msgid/nodejs/931D3E3C-499B-4973-88BE-C7A0CBF0FB67%40gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAP8%3DUyR1LYmW1v6vjhvphxdNGWu3fzh7WzAbNT%2BxZH%3DgrPVHLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to