NAME

POE::Component::MPG123

SYNOPSIS

use POE qw(Component::MPG123);
my $alias = 'mp3weazel';

POE::Component::MPG123->spawn( alias => $alias );

$poe_kernel->run();

DESCRIPTION

POE Component for accessing and working with mpg123, an mp3 player.

PoCo::MPG123's spawn() method takes one named parameter:

alias
alias => $alias

alias is the name of a session to which the callbacks below will be posted. This defaults to console.

Available events

All events are posted to a session named mpg123.

play
$kernel->post( mpg123 => play => $filename );

Load and play the mp3 found at $filename. The parameter must either be an existing mp3 file or the full url to an mp3 stream.

stop
$kernel->post( mpg123 => 'stop' );

Stop playing the current track and unload it. This is like pressing stop on your CD player, not your cassette tape deck. The track is actually unloaded and you cannot continue from where you left off.

pause
$kernel->post( mpg123 => 'pause' );

Pause or unpause the current track.

quit
$kernel->post( mpg123 => 'quit' );

Stop playing the current track and shut down the mpg123 process.

Callbacks

As noted above, all callbacks are either posted to the session alias given to spawn() or console.

status

Fired during playback. ARG0 is the number of frames played up till now. ARG1 is the number of frames remaining to be played. ARG2 is the number of seconds played. ARG3 is the number of seconds remaining in the track.

song_info

Fired when a song is loaded. ARG0 is a hash ref containing either ID3 tag information or the filename (if there is no ID3 tag). The type element of the hash is set to id3 in the former case and filename in the latter case. For type id3, the hash elements are title, artist, album, year, comment, and genre. For type filename, the hash elements are filename.

file_info

Fired when a song is loaded. ARGO is a hash ref containing information about the mp3 file/stream itself. Hash elements are type, layer, samplerate, mode, mode_extension, bpf, channels, copyright, crc, emphasis, bitrate, extension, and lsf.

song_stopped

Fired when a song stops. No args.

song_paused

Fired when a song becomes paused. No args.

song_resumed

Fired when a song resumes playback. No args.

player_quit

Fired when mpg123 goes away, either as the result of something stupid happening in mpg123 itself or as a result of a quit event. Suggested use is to either quit gracefully or create a new player.

debug

Fired when there is random not-useful-to-normal-people information. ARG0 is a string containing the debug message. Not recommended for production use.

AUTHOR

Matt Cashner (eek+poe@eekeek.org)

Rocco Caputo (troc@netrus.net)

DATE

$Date: 2001/08/06 23:23:35 $

VERSION

0.01

LICENSE AND COPYRIGHT

Copyright (c) 2000-2001 Matt Cashner and Rocco Caputo. This product is distributed under the MIT License. A copy of this license was included in a file called LICENSE. If for some reason, this file was not included, please see http://www.opensource.org/licenses/mit-license.html to obtain a copy of this license.

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 273:

'=item' outside of any '=over'

Around line 300:

You forgot a '=back' before '=head2'

Around line 305:

'=item' outside of any '=over'

Around line 352:

You forgot a '=back' before '=head1'