title: HLS Live Stream API in Python serving files from the disk
body: <p>I have a camera which captures videos and then i use FFMPEG to segment those videos for HTTP Live Streaming and generate an m3u8 file and their corresponsing ts files</p>
  
  <p>I have all the *.ts files and *.m3u8 files created in my local folder and i would like to serve those files to the client using an API</p>
  
  <p>I have created a Flask application in Python</p>
  
  <p>Flask API. </p>
  
  <pre><code>@app.route('/videos/&lt;file_name&gt;')
  def live_stream(file_name): 
      return send_from_directory("D:\\public", file_name)
  </code></pre>
  
  <p>HTML Code</p>
  
  <pre><code>&lt;html&gt;
     &lt;body&gt;
        &lt;video width="400" controls&gt;
           &lt;source src="http://127.0.0.1:5000/videos/toystory.m3u8" type="video/mp4"&gt;
        &lt;/video&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Sample m3u8 file. As you can see there is no End tag since i keep on appending new ts files to this m3u8 file to support live streaming</p>
  
  <pre><code>#EXTM3U
  #EXT-X-VERSION:3
  #EXT-X-TARGETDURATION:64
  #EXT-X-MEDIA-SEQUENCE:0
  #EXTINF:64.397667,
  toystory0.ts
  </code></pre>
  
  <p>Couple of issues that i had:</p>
  
  <ol>
  <li>Is there a python library which i can use which provides me a way to serve HLS stream from the files stored on disk</li>
  <li>Even though the file is sent across as per my fiddler output i don't see the video on the browser</li>
  </ol>