nginx & flv

1. install nginx
sudo apt-get install nginx

2. setup nginx to support flv streaming
edit  /etc/nginx/sites-enabled/default like this
server {
  listen   80 default;
  server_name  localhost;

  access_log  /var/log/nginx/localhost.access.log;

  location / {
    root   /var/www/nginx-default;
    index  index.html index.htm;
  }

  location /doc {
    root   /usr/share;
    autoindex on;
    allow 127.0.0.1;
    deny all;
  }
  location /images {
    root   /usr/share;
    autoindex on;
  }

  location ~ \.flv$ {
    root /var/www/nginx-default;
    flv;
  }
}

3. test.html
<html>
<body>

<h1>Adobe Flash Player</h1>


<object width="640" height="480">
  <param name="movie" value="JWPlayer.swf"/>
  <param name="allowFullScreen" value="true"/>
  <param name="allowscriptaccess" value="always"/>
  <param name='flashvars' value="file=1.f4v">
  <embed src="JWPlayer.swf" flashvars="file=1.f4v" width="640" height="480" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true">
  </embed>
</object>

</body>
</html>





test2.html
<html>
    
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>

<body>  

<h1>Adobe Flash Player</h1> 
<div id='player'>This div will be replaced by the JW Player.</div>
 
<script type='text/javascript' src='./jwplayer.js'></script>
 
<script type='text/javascript'>
 jwplayer('player').setup({
 'flashplayer': './JWPlayer.swf',
 'width': '640',
 'height': '480',
 'controlbar': 'bottom',
 'file': encodeURI("./videos/   /123.flv")
 });
 </script>

</body>
</html> 

Note:
       1) please download JWPlayer.swf from http://www.longtailvideo.com/players/jw-flv-player/
             and put 'player.swf'   'jwplay.js' to your web root directory, rename 'player.swf' as 'JWPlayer.swf'

좋은 웹페이지 즐겨찾기