The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Icecast::Source - Icecast streaming source

SYNOPSIS

        use Net::Icecast::Source;
        my $source = new Net::Icecast::Source(
                username => 'revmischa',
                password => 'hackthegibson',
                server => '128.128.64.64',
                port => '8000',
                mount_point => '/source',
                mime_type => 'audio/mpeg',
                meta => {
                        name => 'lol dongs radio fun land',
                        description => 'party time all day',
                        aim => 'lindenstacker',
                        url => 'http://icecast.org',
                },
        );

        # attempt to connect to the streaming server
        $source->connect
                or die "Unable to connect to server: $!\n";
                
        # attempt to log in to the specified mountpoint
        $source->login
                or die "Incorrect username/password\n";

        # stream mp3
        my $sample;
        open $sample, "sample.mp3" or die $!;
        $source->stream_fh($sample);
        close $sample;
        
        # done, clean up
        $source->disconnect
        

DESCRIPTION

Net::Icecast::Source is a simple module designed to make it easy to build programs which stream audio data to an Icecast2 server to be relayed.

CONSTRUCTOR

new (%opts)

Create a new source instance. Options are: username, password, server, port, mount_point, meta, mime_type

connect

Connect to the server, use this before logging in. Returns success/failure

login

Log in to the mount point and send metadata. Returns if login was successful or not

stream_fh($filehandle)

Read from $filehandle until EOF, passing through the raw data to the icecast server.

disconnect

Closes all sockets and disconnects

1 POD Error

The following errors were encountered while parsing the POD:

Around line 64:

=over without closing =back