Giter VIP home page Giter VIP logo

web_video_server's Introduction

A web application created by tornado web framework.

Use nginx to proxy tornado app.

简单的web视频服务器。 需求:空闲机器存放视频资源,搭建一个web视频服务器可使局域网中其他pc或者手机、pad通过网页观看视频,从而节省硬盘空间。 实现方法: 本人web开发小白,在实现过程中首先了解到nginx本身可以处理mp4这种静态文件资源,通过编写html,然后浏览器直接打开html文件可以正常播放mp4视频,且可以拖拽进度条。但面临如何动态扫描特定目录并生成html页面的问题。由于之前听说过web框架(flask),而这些框架本身是python语言的,借助python语言可以实现扫描目录拿到文件列表,而这些web框架又支持模板渲染html页面,所以想到通过web框架实现。 先从flask开始,尝试了编写简单的web应用,最终结果可以完成播放任务,但发现拖拽进度条没有反应,有一定的功能缺陷。故改用tornado框架(主要是看到性能比较好,虽然项目可能没有那么高的性能需求,但还是用tornado了),编写完web框加后发现使用tornado的static_url能够处理静态资源,但处理方式总是先完全读取文件内容后再返回http响应,这样不仅导致硬盘处理有压力,也导致前端页面响应过慢,影响使用体验。 最终想到使用nginx反向代理tornado应用,tornado应用只返回html页面,而视频资源由nginx处理。最终实现web页面动态获取视频文件列表,点击后可以播放,而且支持拖拽进度条。 最终添加html5视频播放器videojs

Nginx反向代理tornado的配置请参考nginx.conf

web_video_server's People

Watchers

 avatar  avatar  avatar

Forkers

louielong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.