title: Play html5 sound files with flask
body: <p>I would like to use a class <code>Track</code> to have a function <code>playsound()</code> and this should play the sound on a html template.</p>
  
  <p><strong>This is my class</strong> :</p>
  
  <pre><code>class Track:
  def __init__(self, name, path):
      self.name = name
      self.path = path
  
  def playsound(self):
      # does something
  </code></pre>
  
  <p>Now I know that I will need javascript and ajax as well probably. But I'm still new to the concept and I would like to see how I would go about achieving that. The sound file should play <code>onload</code> and should simply be invoked when you type:</p>
  
  <pre><code>songname = Track('name', 'music/filename.ogg')
  
  @app.route('/playSong')
  def playSong():
      return songname.play()
  </code></pre>
  
  <p>If there is no way this can be done in this way, or there is a much better way, I'd be happy to be enlightened. Thanks in advance!</p>