[PyQt] Playing an ogg file with QtMultimedia?

Florian Bruhin me at the-compiler.org
Fri Sep 4 08:56:05 BST 2015


Hi,

(also Cc-ing the list again as I don't think it was intended to send
this off-list)

* Brandon Keith Biggs <brandonkeithbiggs at gmail.com> [2015-09-04 09:31:41 +0200]:
> Here is what I have, but it is silent and there is no error:
> 
>         self.player = QtMultimedia.QMediaPlayer(self)
>         self.s = QtMultimedia.QMediaContent(QUrl("sounds/my_sound.ogg"))

This should probably be QUrl.fromLocalFile(...) instead.

>         self.player.setMedia(self.s)
>         self.player.play()
> 
> Could there be some kind of dll that I need to put in my PyQt5 dir?

If a DLL was missing, Qt would probably terminate/abort.

Some things to check:

- .error()/.errorString()
- .volume() (in the example they do .setVolume(50))

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150904/55f561c7/attachment.sig>


More information about the PyQt mailing list