aboutsummaryrefslogtreecommitdiffstats
path: root/mobility
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2011-02-24 17:33:45 -0300
committerLauro Neto <lauro.neto@openbossa.org>2011-02-24 17:33:45 -0300
commitacbb7b783e1f8c7d0ab86ba341d91fb1624493db (patch)
tree2d1666f6861d71a2b6969fb3d98abf4ce0e2ef9f /mobility
parenta7cce6ae611302b9f946e2f693d13a1281345ffe (diff)
Adding simple example that plays a .wav
Diffstat (limited to 'mobility')
-rw-r--r--mobility/audiooutput/simpleplayer.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/mobility/audiooutput/simpleplayer.py b/mobility/audiooutput/simpleplayer.py
new file mode 100644
index 0000000..f65b0b3
--- /dev/null
+++ b/mobility/audiooutput/simpleplayer.py
@@ -0,0 +1,39 @@
+
+import sys
+
+from PySide.QtCore import QUrl
+from PySide.QtGui import QApplication, QPushButton, QMainWindow
+from QtMobility.MultimediaKit import QMediaPlayer
+
+class AudioTest(QMainWindow):
+
+
+ def __init__(self, filename):
+ QMainWindow.__init__(self)
+
+ self.playButton = QPushButton('Play!')
+ self.source = QUrl.fromLocalFile(filename)
+ self.player = QMediaPlayer()
+
+ self.player.setMedia(self.source)
+
+ self.playButton.clicked.connect(self.play)
+
+ self.setCentralWidget(self.playButton)
+ self.playButton.show()
+
+ def play(self):
+ self.player.play()
+
+def main():
+
+ app = QApplication([])
+ app.setApplicationName('Simple Audio player')
+
+ window = AudioTest(sys.argv[1])
+ window.show()
+
+ return app.exec_()
+
+if __name__ == '__main__':
+ main()