NAME
RTSP::Client - High-level client for the Real-Time Streaming Protocol
SYNOPSIS
use RTSP::Client;
my $client = new RTSP::Client(
port => 554,
client_port_range => '6970-6971',
transport_protocol => 'RTP/AVP;unicast',
address => '10.0.1.105',
media_path => '/mpeg4/media.amp',
);
$client->open or die $!;
$client->play;
$client->pause;
$client->stop;
my $sdp = $client->describe;
my @allowed_public_methods = $client->options_public;
$client->teardown;
DESCRIPTION
This module provides a high-level interface for communicating with an RTSP server. RTSP is a protocol for controlling streaming applications, it is not a media transport or a codec. It supports describing media streams and controlling playback, and that's about it.
In typical usage, you will open a connection to an RTSP server and send it the PLAY method. The server will then stream the media at you on the client port range using the specified transport protocol. You are responsible for listening on the client port range and handling the actual media data yourself, actually receiving a media stream or decoding it is beyond the scope of RTSP and this module.
EXPORT
No namespace pollution here!
ATTRIBUTES
- session_id
-
RTSP session id. It will be set on a successful OPEN request and added to each subsequent request
- client_port_range
-
Ports the client receives data on. Listening and receiving data is not handled by RTSP::Client
- media_path
-
Path to the requested media stream
e.g. /mpeg4/media.amp
- transport_protocol
-
Requested transport protocol, RTP by default
- address
-
RTSP server address. This is required.
- port
-
RTSP server port. Defaults to 554
- connected
-
Is the client connected?
- print_headers
-
Print out debug headers
- debug
-
Print debugging information (request status)
METHODS
- open
-
This method opens a connection to the RTSP server and does a SETUP request. Returns true on success, false with $! possibly set on failure.
- play
-
A PLAY request will cause one or all media streams to be played. Play requests can be stacked by sending multiple PLAY requests. The URL may be the aggregate URL (to play all media streams), or a single media stream URL (to play only that stream). A range can be specified. If no range is specified, the stream is played from the beginning and plays to the end, or, if the stream is paused, it is resumed at the point it was paused.
- pause
-
A PAUSE request temporarily halts one or all media streams, so it can later be resumed with a PLAY request. The request contains an aggregate or media stream URL.
- record
-
The RECORD request can be used to send a stream to the server for storage.
- teardown
-
A TEARDOWN request is used to terminate the session. It stops all media streams and frees all session related data on the server.
- options_public
-
An OPTIONS request returns the request types the server will accept.
This returns an array of allowed public methods.
- describe
-
The reply to a DESCRIBE request includes the presentation description, typically in Session Description Protocol (SDP) format. Among other things, the presentation description lists the media streams controlled with the aggregate URL. In the typical case, there is one media stream each for audio and video.
This method returns the actual DESCRIBE content, as SDP data
- request_status
-
Get the status code of the last request (e.g. 200, 405)
- request($method)
-
Sends a $method request, returns success
SEE ALSO
RTSP::Lite, http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol
AUTHOR
Mischa Spiegelmock <revmischa@cpan.org>
ACKNOWLEDGEMENTS
This is based entirely on RTSP::Lite by Masaaki Nabeshima.
COPYRIGHT AND LICENSE
Copyright (C) 2010 by Mischa Spiegelmock
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.