On Fri, Sep 24, 2010 at 7:26 AM, Rony gnulinuxist@gmail.com wrote:
On Thursday 23 September 2010 03:29 PM, Nitesh Mistry wrote:
AND with mpg123, I don't need to run it with sudo or in root's cron. Simply adding 'mpg123<song.mp3>' to my user's cron works even when I am not logged in.
Great. I tried it again in user but I still need to be logged in to at least one session, console or gui. The funny part is that if I log out, the song stops there and continues after I log in again.
Hiya all
I think the culprit here is the permissions system. Usually, Systems like PackageKit assign permissions to various devices to allow normal user access without having to manually add users to various groups. If you remember the good old days, we used to add users to the 'audio' group to allow them to play audio, and to the 'tty' group to allow them to access serial ports, etc. On Modern distro's when a user logs in, the permissions of the relevant devices are updated to allow that user to access it, using filesystem ACL's. That way, as long as your login is at a local console, you get access to all physically connected hardware IO devices, subject to certian rules..
This is why your programs are playing audio as long as you are logged in somewhere or the other, but refuse to play when you are logged out. It's nothing but a simple permission denied issue.
The quickest solution to this would be to use root's crontab, but that will make any self-respecting sysadmin want to shoot you in the head :) The other option is to modify your Udev config to create all audio devices with the appropriate permissions so that your user who runs the cron jobs is given access to the device by default, without waiting for the login process to grant access. For example, on Fedora, modifying the '/lib/udev/rules.d/40-alsa.rules' or the '/etc/udev/rules.d/90-alsa.rules' should allow you to create the appropriate ACL Entries automatically, so that audio device acccess is never denied to the said user.
Once this is done, you can use any tool that takes your fancy(mplayer, cvlc, mpg123, mpg321, ogg123, madplay, aplay, sox( the granddaddy of tyem all)), and it sould work fine. My personal prefference though is mplayer, since it handles anything i throw at it, and when i play in a GUI environment, it allows me to use vdpau on my GPU.
Hope this helps.
Regards R. K. Rajeev
--
As a proper list etiquette... Please trim your replies. Post your replies below the relevant original text, leaving a line space. Do not re-use old messages to write new ones.
Regards,
Rony.