[Pyobjc-dev] QTKit.QTMovie .play() question
Brought to you by:
ronaldoussoren
|
From: Armando R. <air...@gm...> - 2009-02-13 02:12:24
|
I'm trying to play an mp3 file use QTMovie's .play() method, and no
matter what I've tried I only get approximately 2 seconds of output.
Is there something that I'm missing? If I uncomment the print
movie.currentTime() call, I continue to receive the current position
of the file, but no sound.
Here is the code I'm trying:
================
#!/usr/bin/env python
from QTKit import QTMovie
from AppKit import NSSound
movie, error = QTMovie.movieWithFile_error_("Happy.mp3", None)
if movie:
print "QTMovie Media Length
is",movie.duration().timeValue/movie.duration().timeScale,"Seconds."
movie.play()
while movie.isPlaying():
# print movie.currentTime()
pass
else:
print "Error Playing Media"
#sound = NSSound.alloc().initWithContentsOfFile_byReference_("test.mp3", True)
##sound.retain()
#if sound:
# print "NSSound Media Length is",sound.duration(),"Seconds."
# sound.setVolume_(100.0)
# sound.play()
# while sound.isPlaying():
# print sound.currentTime()
================
The commented section that uses NSSound works fine, and plays the mp3
to the end.
I need to use QTKit because I'll be generating clips from the source
audio and exporting to new files.
Thanks for any help.
Armando Rivera
--
"Programming is like Poetry. Sometimes the words just escape you..."
-me, to my manager.
|