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 2

We have already developed code for playing an audio. Let's now tweak the method AudioPlayer.constructPipeline to build the gst.Pipeline using different element objects.

  1. Rewrite the constructPipeline method as follows. You can also download the file PlayingAudio.py from the Packt website for reference. This file has all the code we discussed in this and previous sections.
    1 def constructPipeline(self): 2 self.player = gst.Pipeline() 3 self.filesrc = gst.element_factory_make("filesrc") 4 self.filesrc.set_property("location", 5 "C:/AudioFiles/my_music.mp3") 6 7 self.decodebin = gst.element_factory_make("decodebin", 8 "decodebin") 9 # Connect decodebin signal with a method. 10 # You can move this call to ...

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