Tuesday, January 4, 2011

New Quidget: MediaPlayerBox adds video to your app in a few lines

I've created a new quickly-widget to make it dead simple to add a video or sound file to a Quickly application. All you need to do is create a MediaPlayerBox, add it to your app, set the uri property to tell it what file to play, and call "play()". 5 lines to playing a video:
        self.player = MediaPlayerBox(True)
self.player.show()
self.ui.vbox1.pack_start(self.player)
self.player.uri = file_to_play
self.player.play()
By passing in True when I created the MediaPlayerBox, that told it to display controls. You can also control whether controls are displayed by setting the controls_visible property:
        self.player.controls_visible = True

It's got other functions that you would expect:
        self.player.pause()
self.player.stop()

And other useful properties too. For example, you can get the duration of the current media file, and you can get and set the current position. So you could seek to halfway through the media file like this:
        dur = self.player.duration
self.player.position = dur/2

MediaPlayerBox is really just a thin wrapper around the gstreamer's playbin, so you still have all the power of gstreamer if you end up needing to go there. You can just use the playbin property and go to town if it comes to it.

But MediaPlayerBox is focused on simplicity, just getting a video or song playing n your app esasily.

MediaPlayerBox is currently in a branch, so you can grab it and try it out.

8 comments:

  1. Excellent, this is something i needed during the last UDS. When attending remotely, you have to fight with tons of apps. A browser (for blueprints, the schedule, the icecast links, the video feeds for the plenaries, the miro channel), with gwibber, totem, gobby, etc. So I wanted to merge all those into a quickly app. I investigated the various bits needed but UDS ended before i even got a chance to start coding :P

    ReplyDelete
  2. So nice and great blog post about media it's also helpful information all of us so thanks a lot for sharing this tips with us
    clipping path service

    ReplyDelete
  3. Myotherapy, also known as massage therapy, is the art of manipulating and kneading a person's soft-tissues or muscles in order to improve their health or well being. Visit body massage spa near me

    ReplyDelete
  4. Pulsed Compression: Intermittent cycles female to male massage in hyderabadof pressure and release are applied to enhance blood flow and lymphatic drainage.

    ReplyDelete
  5. Cupping therapy supporters believe full service massage in hyderabad that wet cupping removes harmful substances and toxins from the body to promote healing. But that’s not proven.

    ReplyDelete
  6. Cross an ankle over your shin either female to male spa near me 24 hours under or above the knee. Or if above your knee, place a supporting foot under the supporting knee

    ReplyDelete