Streaming flv video to JW FLV media player 4.0

Hi,

Using this flash player in version 4.0:
http://www.jeroenwijering.com/?item=JW_FLV_Player

I have a problem when scrubbing. I think it is because, JW has updated
his code to send the following request:
myvideo.flv?start=2659763&width=280&client=FLASH%20MAC%209,0,124,0&version=4.0%20$Rev:%2030%20

And I guess that Nginx doesn’t like such a request, because what
happens when scrubbing, is that the video starts back at the
beginning. Surprisingly, the buffering occurs at the correct spot of
the scrub, but the video starts at the beginning of the file. I
suspect that Nginx sends back to the flash player the full request (or
at least a corrupted starting point) and therefore the player doesn’t
know where to start, and so it starts at the beginning of the file.

In the previous version 3.16, the request would have only been:
myvideo.flv?start=2659763

So I have edited the source code of JWFLV to only append the start
parameter, and it works. But actually I would like to keep some of the
appended parameters and still have nginx work. Could this be handled
by a rewrite rule? How does Nginx actually treats the requests when
using the flv module?

I tried the following directives with no success, it keeps looping
back at the beginning:

rewrite ^/(videos)/([\w|-]+.flv?start=\d+).* /$1/$2 last;
location ~ ^/videos/[\w|-]+.flv {
root /public;
flv;
}

Why is my rewrite rule not working as expected? My video still doesn’t
want to scrub correctly.

Using the following config:

location ~ ^/videos/[\w|-]+.flv.* {
rewrite ^/(videos)/([\w|-]+.flv?start=\d+).* /$1/$2 break;
root /public;
flv;
}

Using my regexp tool, I get the following:

Request:
/videos/video.flv?start=3850792&width=280&client=FLASH%20MAC%209,0,124,0&version=4.0%20$Rev:%2030%20$

Gets rewritten as:
/videos/video.flv?start=3850792

Am I not understanding how Nginx rewrite and location work?

On Fri, Jul 04, 2008 at 01:30:57PM +0200, Thomas wrote:


Using my regexp tool, I get the following:

Request:
/videos/video.flv?start=3850792&width=280&client=FLASH%20MAC%209,0,124,0&version=4.0%20$Rev:%2030%20$

Gets rewritten as:
/videos/video.flv?start=3850792

Am I not understanding how Nginx rewrite and location work?

rewrite does work not with a query string.

Try the attached patch: it allows several values in query string.

Fantastic Igor! It works.

Will you merge it in the stable version of Nginx or do you want to
keep it as a separate patch?

Hello!

On Fri, Jul 04, 2008 at 03:50:09PM +0400, Igor S. wrote:

flv;

Am I not understanding how Nginx rewrite and location work?

rewrite does work not with a query string.

Try the attached patch: it allows several values in query string.

[…]

  •        start = ngx_atoof(p, r->args.len - (p - r->args.data));
    
  •        for (n = p; n < r->args.data + r->args.len; n++) {
    
  •            if (*n == '&') {
    

I believe adding check for ‘;’ too is a good idea.

Maxim D.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs