Net::Icecast::Source - Icecast streaming source


Net-Icecast-Source documentation  | view source Contained in the Net-Icecast-Source distribution.

Index


NAME

Top

Net::Icecast::Source - Icecast streaming source

SYNOPSIS

Top

	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

Top

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

Top

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


Net-Icecast-Source documentation  | view source Contained in the Net-Icecast-Source distribution.