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.
> 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.
For more options, visit https://groups.google.com/d/optout.