Functions |
janus_plugin * | create (void) |
int | janus_streaming_init (janus_callbacks *callback, const char *config_path) |
void | janus_streaming_destroy (void) |
int | janus_streaming_get_api_compatibility (void) |
int | janus_streaming_get_version (void) |
const char * | janus_streaming_get_version_string (void) |
const char * | janus_streaming_get_description (void) |
const char * | janus_streaming_get_name (void) |
const char * | janus_streaming_get_author (void) |
const char * | janus_streaming_get_package (void) |
void | janus_streaming_create_session (janus_plugin_session *handle, int *error) |
struct janus_plugin_result * | janus_streaming_handle_message (janus_plugin_session *handle, char *transaction, char *message, char *sdp_type, char *sdp) |
void | janus_streaming_setup_media (janus_plugin_session *handle) |
void | janus_streaming_incoming_rtp (janus_plugin_session *handle, int video, char *buf, int len) |
void | janus_streaming_incoming_rtcp (janus_plugin_session *handle, int video, char *buf, int len) |
void | janus_streaming_hangup_media (janus_plugin_session *handle) |
void | janus_streaming_destroy_session (janus_plugin_session *handle, int *error) |
char * | janus_streaming_query_session (janus_plugin_session *handle) |
janus_streaming_mountpoint * | janus_streaming_create_rtp_source (uint64_t id, char *name, char *desc, gboolean doaudio, char *amcast, uint16_t aport, uint8_t acodec, char *artpmap, char *afmtp, gboolean dovideo, char *vmcast, uint16_t vport, uint8_t vcodec, char *vrtpmap, char *vfmtp) |
janus_streaming_mountpoint * | janus_streaming_create_file_source (uint64_t id, char *name, char *desc, char *filename, gboolean live, gboolean doaudio, gboolean dovideo) |
janus_streaming_mountpoint * | janus_streaming_create_rtsp_source (uint64_t id, char *name, char *desc, char *url, gboolean doaudio, gboolean dovideo) |
void | janus_streaming_message_free (janus_streaming_message *msg) |
void * | janus_streaming_watchdog (void *data) |
Janus Streaming plugin.
- Author
- Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om
- Copyright
- GNU General Public License v3
This is a streaming plugin for Janus, allowing WebRTC peers to watch/listen to pre-recorded files or media generated by another tool. Specifically, the plugin currently supports three different type of streams:
- on-demand streaming of pre-recorded media files (different streaming context for each peer);
- live streaming of pre-recorded media files (shared streaming context for all peers attached to the stream);
- live streaming of media generated by another tool (shared streaming context for all peers attached to the stream).
For what concerns types 1. and 2., considering the proof of concept nature of the implementation the only pre-recorded media files that the plugins supports right now are raw mu-Law and a-Law files: support is of course planned for other additional widespread formats as well.
For what concerns type 3., instead, the plugin is configured to listen on a couple of ports for RTP: this means that the plugin is implemented to receive RTP on those ports and relay them to all peers attached to that stream. Any tool that can generate audio/video RTP streams and specify a destination is good for the purpose: the examples section contains samples that make use of GStreamer (http://gstreamer.freedesktop.org/) but other tools like FFmpeg (http://www.ffmpeg.org/), LibAV (http://libav.org/) or others are fine as well. This makes it really easy to capture and encode whatever you want using your favourite tool, and then have it transparently broadcasted via WebRTC using Janus.
Streams to make available are listed in the plugin configuration file. A pre-filled configuration file is provided in conf/janus.plugin.streaming.cfg
and includes a stream of every type.
To add more streams or modify the existing ones, you can use the following syntax:
[stream-name]
type = rtp|live|ondemand|rtsp
rtp = stream originated by an external tool (e.g., gstreamer or
ffmpeg) and sent to the plugin via RTP
live = local file streamed live to multiple listeners
(multiple listeners = same streaming context)
ondemand = local file streamed on-demand to a single listener
(multiple listeners = different streaming contexts)
rtsp = stream originated by an external RTSP feed (only
available if libcurl support was compiled)
id = <unique numeric ID>
description = This is my awesome stream
is_private = yes|no (private streams don't appear when you do a 'list' request)
filename = path to the local file to stream (only for live/ondemand)
secret = <optional password needed for manipulating (e.g., destroying
or enabling/disabling) the stream>
audio = yes|no (do/don't stream audio)
video = yes|no (do/don't stream video)
The following options are only valid for the 'rtp' type:
audioport = local port for receiving audio frames
audiomcast = multicast group port for receiving audio frames
audiopt = <audio RTP payload type> (e.g., 111)
audiortpmap = RTP map of the audio codec (e.g., opus/48000/2)
audiofmtp = Codec specific parameters, if any
videoport = local port for receiving video frames (only for rtp)
videomcast = multicast group port for receiving video frames
videopt = <video RTP payload type> (e.g., 100)
videortpmap = RTP map of the video codec (e.g., VP8/90000)
videofmtp = Codec specific parameters, if any
The following options are only valid for the 'rstp' type:
url = RTSP stream URL (only if type=rtsp)
Streaming API
The Streaming API supports several requests, some of which are synchronous and some asynchronous. There are some situations, though, (invalid JSON, invalid request) which will always result in a synchronous error response even for asynchronous requests.
list
, create
, destroy
, recording
, enable
and disable
are synchronous requests, which means you'll get a response directly within the context of the transaction. list
lists all the available streams; create
allows you to create a new mountpoint dynamically, as an alternative to using the configuration file; destroy
removes a mountpoint and destroys it; recording
instructs the plugin on whether or not a live RTP stream should be recorded while it's broadcasted; enable
and disable
respectively enable and disable a mountpoint, that is decide whether or not a mountpoint should be available to users without destroying it.
The watch
, start
, pause
, switch
and stop
requests instead are all asynchronous, which means you'll get a notification about their success or failure in an event. watch
asks the plugin to prepare the playout of one of the available streams; start
starts the actual playout; pause
allows you to pause a playout without tearing down the PeerConnection; switch
allows you to switch to a different mountpoint of the same kind (note: only live RTP mountpoints supported as of now) without having to stop and watch the new one; stop
stops the playout and tears the PeerConnection down.
Actual API docs: TBD.
Plugins