# -*- coding: utf-8 -*- import psycopg2 import codecs from importlib import import_module import os from flask import Flask, render_template, Response # Raspberry Pi camera module (requires picamera package) # from camera_pi import Camera app = Flask(__name__, static_folder='', static_url_path='') @app.route('/', methods=['GET', 'POST']) def index(): print "xx" print os.path.abspath('.') print os.getcwd() """Video streaming home page.""" return render_template('a.html') @app.route('/<path:filename>', methods=['GET', 'POST']) def static_handler(path, filename): print "name",path, filename html=''.join(file(filename).readlines()) return html ''' @app.route('/video_x') def video_x(): def generate(): path = 'F:/dao.mp4' with open(path, 'rb') as fmp3: data = fmp3.read(1024) while data: yield data data = fmp3.read(1024) return Response(generate(), mimetype="multipart/x-mixed-replace; boundary=frame") @app.route('/v/<filename>') ''' def get_file(filename): print filename from flask import send_from_directory return send_from_directory("f:\\",filename) if __name__ == '__main__':
app.run(host='')
<html> <head> <script type="text/javascript" src="/static/jwplayer/jwplayer.js"></script> </head> <body> <div id="container">Loading the player ...</div> <script type="text/javascript"> jwplayer.key="iP+vLYU9H5KyhZeGt5eVuJJIoULUjltoaMeHXg=="; jwplayer("container").setup({ flashplayer: "/jwplayer/jwplayer.flash.swf", file: "/static/video/htpy.mp4", image: "/static/test.jpg", height: 360, width:640, stretching : 'fill', streamer:"start", provider:"http", title: 'Beautiful Woman', description: 'This is the most beautiful woman in the world, do you agree?' }); </script> </body> </html>