The new Java project studies online notes -day13 (V)

3.2 download Video.js 
Video.js:  https://github.com/videojs/video.js 
videojs-contrib-HLS:  https://github.com/videojs/videojs-contrib-hls#installation
(videojs-contrib- hls hls is a widget displays a)
the use of the document: http://docs.videojs.com/tutorial-videojs_.html
this tutorial uses video.js 6.7.3 version, videojs-contrib-hls 5.14.1 version.
Download the top two documents, in order to test demand will put plugins directory portal.

 
The introduction of video link on this page, the video address points video.xuecheng.com 
2, video.xuecheng.com load balancing process transferring the video request to the media server
  based on the process of the top, we installed Nginx on the media server, and configure as follows:
 

[AppleScript]  plain text view  Copy the code

?

1

2

3

4

5

6

7

8

9

#学成网媒体服务 server { listen 

     90;   

  server_name  localhost;  

     #视频目录 

    location /video/ {   

  alias

  F:/develop/video/;  

       }  

   }


3.3.2 Media server proxy 
media server is more than one, to achieve load balancing by proxy, using Nginx as a proxy media server, the proxy server as a domain name server video.xuecheng.com.
Configuring video.xuecheng.com Web Hosting: Note: developing a proxy server and a media server on the same server, use the same Nginx.
 

[AppleScript]  plain text view  Copy the code

?

01

02

03

04

05

06

07

08

09

10

11

12

13

14

#学成网媒体服务代理 map $http_origin $origin_list{ 

   default [url]http://www.xuecheng.com[/url]; 

   "~[url]http://www.xuecheng.com[/url]" [url]http://www.xuecheng.com[/url]; 

   "~[url]http://ucenter.xuecheng.com[/url]" [url]http://ucenter.xuecheng.com[/url]; } #学成网媒体服务代理 server { listen   

   80;     

server_name video.xuecheng.com;  

        location /video {   

    proxy_pass http://video_server_pool;   

        add_header Access‐Control‐Allow‐Origin $origin_list;      

   #add_header Access‐Control‐Allow‐Origin *;    

     add_header Access‐Control‐Allow‐Credentials true;    

       add_header Access‐Control‐Allow‐Methods GET;   

      }     

      }


cors跨域参数: Access-Control-Allow-Origin:允许跨域访问的外域地址

通常允许跨域访问的站点不是一个,所以这里用map定义了多个站点。
  如果允许任何站点跨域访问则设置为*,通常这是不建议的。
Access-Control-Allow-Credentials: 允许客户端携带证书访问 Access-Control-Allow-Methods:允许客户端跨域访问的方法
  video_server_pool的配置如下:
 

[AppleScript] 纯文本查看 复制代码

?

1

2

3

4

#媒体服务

    upstream video_server_pool{  

   server 127.0.0.1:90 weight=10;     

    }  

Guess you like

Origin blog.csdn.net/czbkzmj/article/details/91045996