1

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 !

Chida
  • 2,491
  • 1
  • 17
  • 29
longser
  • 11
  • 1

1 Answers1

4

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.

user9517
  • 115,471
  • 20
  • 215
  • 297
  • 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. – user9517 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