O'Reilly logo

Python Multimedia Beginner's Guide by Ninad Sathaye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - playing an audio: method 1

There are a number of ways to play an audio using Python and GStreamer. Let's start with a simple one. In this section, we will use a command string, similar to what you would specify using the command-line version of GStreamer. This string will be used to construct a gst.Pipeline instance in a Python program.

So, here we go!

  1. Start by creating an AudioPlayer class in a Python source file. Just define the empty methods illustrated in the following code snippet. We will expand those in the later steps.
    1 import thread 2 import gobject 3 import pygst 4 pygst.require("0.10") 5 import gst 6 7 class AudioPlayer: 8 def __init__(self): 9 pass 10 def constructPipeline(self): 11 pass 12 def connectSignals(self): ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required