Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running video streaming with lighttpd & mod_h264 on CentOS. Now, I want to set to client can only watch the movie for the first x minutes. Example: 10 minutes. Who can give me a solution for this? Thanks !

share|improve this question

1 Answer 1

You can set the start and end parameters as part of the url

http://www.example.com/video.mp4?start=15&end=600

Which should start the video at 0 and let it run for 10 minutes.

It may be better to use a preview link and some server side rewriting though as the above could easily be adjusted manually.

Enable url rewriting by having "mod_rewrite" as part of the server.modules.

Add this

url.rewrite = (
"(.*)/preview$" => "$1?start=0&end=600"
)

which, given a url like

 http://www.example.com/video.mp4/preview

will provide the first 10 minutes of the file.

share|improve this answer
    
Thanks to @lain, But How to hidden this "start=0&end=600" or /preview or generate new link for prevent hotlink? –  longser Aug 25 '12 at 13:47
    
@longser: I already answered that - Make your preview URL end in /preview and then use the url.rewrite rule I provided. –  Iain Aug 25 '12 at 13:54
    
@lain I think what he is asking is how can you prevent someone from hitting the url /video.mp4?start=15&end=600 directly. I don't see where the solution outlined would do this, but maybe I am missing something. –  BrianV Nov 17 '12 at 13:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.