title: How can I play audio stream without saving it into the file with pyglet?
body: <p>Now I have these libraries: <strong>requests</strong>, <strong>pyglet</strong>, <strong>pyaudio</strong></p>
  
  <p>How can I play an audio stream using ones, for example, from <a href="http://ic7.101.ru:8000/c15_3" rel="nofollow noreferrer">this</a> site without saving it into the file(using buffering)?</p>
  
  <p>There is a confusing information in documentation of this library about a StreamingSource class</p>
  
  <p>When I push the information in bytes in StreamingSource object(source.get_audio_data(DATA)) and after that I push this one into a Player(pyglet.media.Player()) it throws an exception, that says that the StreamingSource hasn't attribute duration</p>
  
  <p>Code:</p>
  
  <pre><code>import pyglet, requests
  
  req = requests.get('http://ic7.101.ru:8000/c15_3', stream=True)
  
  player = pyglet.media.Player()
  
  source = pyglet.media.StreamingSource()
  
  CHUNK = 1024
  
  for num, chunk in enumerate(req.iter_content(CHUNK)):
      if num == 1000:
          break
      source.get_audio_data(chunk)
      if num == 100:
          player.queue(source)
          player.play()
          pyglet.app.run()
  pyglet.clock.schedule_once(lambda dt: pyglet.app.exit(), source.duration)
  </code></pre>
  
  <p>Traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/user/.PyCharmCE2017.1/config/scratches/scratch.py", line 16, in &lt;module&gt;
      player.queue(source)
    File "/usr/local/lib/python3.5/dist-packages/pyglet/media/__init__.py", line 978, in queue
      group.queue(source)
    File "/usr/local/lib/python3.5/dist-packages/pyglet/media/__init__.py", line 698, in queue
      self.duration += source.duration
  TypeError: unsupported operand type(s) for +=: 'float' and 'NoneType'
  </code></pre>