Active Topics

 


Reply
Thread Tools
Posts: 20 | Thanked: 16 times | Joined on Jun 2010
#1
Greetings,

I'm trying to write an alarm clock application in python using pyqt.
I've managed to get audio files to play, using mplayer at the moment. However, there's one quite annoying problem: Whenever the power button is pressed, the playback pauses for about a second, and then continues in most cases. Even more annoying, sometimes mplayer seems to choke on the forced pause and doesn't continue playing at all.

I was trying to use gstreamer instead, but the simple pygst program from the official pygst tutorial seems to exhibit the same behaviour, i.e. it pauses for a second when the power button is pressed.

As the official N900 media player also uses gstreamer afaik and doesn't pause when the power button is pressed, I guess there is a way to prevent this from happening.
Any help would be greatly appreciated.

Regards,
Eagle_Linux
 
Posts: 20 | Thanked: 16 times | Joined on Jun 2010
#2
121 Views and still no answer, damn

Doesn't anyone has an idea at least what could cause that behavior?
As far as I noticed, other "homebrew" programs like pannucci and someplayer show the same problem. Is there no way to get around that? Or am I the only one experiencing the pausing of any playback when the power button is pressed?

Here's the code I used to test gstreamer:

Code:
#!/usr/bin/env python

import gst
import gobject

player = gst.element_factory_make("playbin2", "player")
vis = gst.element_factory_make("goom","vis")
videosink = gst.element_factory_make("fakesink", 'videosink')

videosink.set_property('async', False)

audiosink = gst.element_factory_make("autoaudiosink", 'audiosink')
audiosink.set_property('async-handling', True)

player.set_property("vis-plugin", vis)
player.set_property("video-sink", videosink)
player.set_property("audio-sink", audiosink)
player.set_property("uri", 'file:///home/user/MyDocs/test.mp3') #exchange with your own file
player.set_state(gst.STATE_PLAYING)
gobject.MainLoop().run()
The file plays fine, but pauses/is silenced for a second if I press the power button, then continues. This is slowly driving me mad, as I often use the power button to unlock my N900, not the lock slider.

Regards,
Eagle_Linux
 
pelago's Avatar
Posts: 2,121 | Thanked: 1,540 times | Joined on Mar 2008 @ Oxford, UK
#3
I'm no expert, but I've read somewhere that the pause doesn't happen if you use MAFW to play the sound. This is the framework that the Nokia-supplied Media Player uses, which as you will have noticed, doesn't have that problem when you press the power button. There are also often stutters with non-MAFW apps (like Panucci, as you mention) when you use the right-hand side lock slider and when you rotate the device, by the way.

Last edited by pelago; 2011-06-29 at 10:50.
 

The Following User Says Thank You to pelago For This Useful Post:
Posts: 20 | Thanked: 16 times | Joined on Jun 2010
#4
Thanks a bunch, I'll look into MAFW and its python bindings now. Seems like just the solution I was slooking for, as I was going to do it "the maemo way" anyway, and already assumed that I needed a different way to play audio for that.
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:26.