[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Streaming with the Movie module
- To: pygame-users@seul.org
- Subject: [pygame] Streaming with the Movie module
- From: Lane LiaBraaten <lliabraa@isrparc.org>
- Date: Thu, 6 Nov 2003 16:48:28 +0000
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Thu, 06 Nov 2003 16:49:41 -0500
- In-reply-to: <200310281214.40222.lliabraa@isrparc.org>
- Organization: ISR
- References: <200310281214.40222.lliabraa@isrparc.org>
- Reply-to: pygame-users@seul.org
- Sender: owner-pygame-users@seul.org
- User-agent: KMail/1.4.1
I am trying to get pyGame to play an mpeg that I am 'streaming' across a
socket. The script reads 100KB chunks from the socket and writes it to a
file (download.mpg). After the first chunk is read, the script starts
playing the movie from the file. The problem is that the movie only plays
for a short time (it looks like only the first chunk is played).
Does anyone know what is going on here and/or what I can do to get the whole
file to play (as I send it across the socket)?
TIA,
LGL
btw, python2.2 on redhat linux 7.3 and pygame 1.5.6 and source below...
#---------------------------------------------------------------------
init=0
receiving=1
self.mpegFile=open('download.mpg','wba')
while receiving:
try:
chunk=self.clt_sock.recv(1024*100)
self.mpegFile.write(chunk)
if init==0:
movPos=Rect(20,60,320,240)
self.mov = Movie('download.mpg')
self.mov.set_display(self.screen, movPos)
self.mov.play()
init=1
except:
receiving=0
print "No chunks on socket"
time.sleep(1.0)
print "Socket stopped reading"
self.mpegFile.close()
#---------------------------------------------------------------------