public interface MediaService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_DEVICE
The name of the property of MediaService the value of which
corresponds to the value returned by
getDefaultDevice(MediaType, MediaUseCase) . |
static java.lang.String |
ENABLE_FFMPEG_CODECS_PNAME
The name of the property which controls whether the libjitsi codecs
which depend on ffmpeg (currently mp3, h264 and amrwb) will be enabled.
|
static java.lang.String |
ENABLE_H264_FORMAT_PNAME
The name of the property which controls whether the h264 formats
will be registered in libjitsi even if the ffmpeg codec is missing.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to be notified about changes in
the values of the properties of this instance.
|
void |
addRecorderListener(Recorder.Listener listener)
Those interested in Recorder events add listener through MediaService.
|
EncodingConfiguration |
createEmptyEncodingConfiguration()
Returns a new EncodingConfiguration instance.
|
MediaStream |
createMediaStream(MediaDevice device)
Create a MediaStream which will use a specific
MediaDevice for capture and playback of media.
|
MediaStream |
createMediaStream(MediaType mediaType)
Initializes a new MediaStream of a specific MediaType.
|
MediaStream |
createMediaStream(StreamConnector connector,
MediaDevice device)
Creates a MediaStream that will be using the specified
MediaDevice for both capture and playback of media exchanged
via the specified StreamConnector.
|
MediaStream |
createMediaStream(StreamConnector connector,
MediaDevice device,
SrtpControl srtpControl)
Creates a MediaStream that will be using the specified
MediaDevice for both capture and playback of media exchanged
via the specified StreamConnector.
|
MediaStream |
createMediaStream(StreamConnector connector,
MediaType mediaType)
Initializes a new MediaStream instance which is to exchange
media of a specific MediaType via a specific
StreamConnector.
|
MediaStream |
createMediaStream(StreamConnector connector,
MediaType mediaType,
SrtpControl srtpControl)
Initializes a new MediaStream instance which is to exchange
media of a specific MediaType via a specific
StreamConnector.
|
MediaDevice |
createMixer(MediaDevice device)
Creates a new MediaDevice which uses a specific
MediaDevice to capture and play back media and performs mixing
of the captured media and the media played back by any other users of the
returned MediaDevice.
|
Recorder |
createRecorder(MediaDevice device)
Creates a new Recorder instance that can be used to record a
call which captures and plays back media using a specific
MediaDevice.
|
Recorder |
createRecorder(RTPTranslator translator)
Creates a new Recorder instance that can be used to record media
from a specific RTPTranslator.
|
RecorderEventHandler |
createRecorderEventHandlerJson(java.lang.String filename)
Creates a RecorderEventHandler instance that saves received
events in JSON format.
|
RTPTranslator |
createRTPTranslator()
Initializes a new RTPTranslator which is to forward RTP and RTCP
traffic between multiple MediaStreams.
|
SrtpControl |
createSrtpControl(SrtpControlType srtpControlType)
Initializes a new SrtpControl instance with a specific
SrtpControlType.
|
java.util.List<ScreenDevice> |
getAvailableScreenDevices()
Get available ScreenDevices.
|
EncodingConfiguration |
getCurrentEncodingConfiguration()
Returns the current EncodingConfiguration instance.
|
MediaDevice |
getDefaultDevice(MediaType mediaType,
MediaUseCase useCase)
Returns the default MediaDevice for the specified media
type.
|
ScreenDevice |
getDefaultScreenDevice()
Get default ScreenDevice device.
|
java.util.List<MediaDevice> |
getDevices(MediaType mediaType,
MediaUseCase useCase)
Returns a list containing all devices known to this service
implementation and handling the specified MediaType.
|
java.util.Map<MediaFormat,java.lang.Byte> |
getDynamicPayloadTypePreferences()
Returns a
Map that binds indicates whatever preferences the
media service implementation may have for the RTP payload type numbers
that get dynamically assigned to MediaFormat s with no static
payload type. |
MediaFormatFactory |
getFormatFactory()
Gets the MediaFormatFactory through which MediaFormat
instances may be created for the purposes of working with the
MediaStreams created by this MediaService.
|
VolumeControl |
getInputVolumeControl()
Gets the VolumeControl which controls the volume level of audio
input/capture.
|
MediaDevice |
getMediaDeviceForPartialDesktopStreaming(int width,
int height,
int x,
int y)
Get a MediaDevice for a part of desktop streaming/sharing.
|
java.awt.Point |
getOriginForDesktopStreamingDevice(MediaDevice mediaDevice)
Get origin for desktop streaming device.
|
VolumeControl |
getOutputVolumeControl()
Gets the VolumeControl which controls the volume level of audio
output/playback.
|
java.util.Iterator<Recorder.Listener> |
getRecorderListeners()
Gives access to currently registered Recorder.Listeners.
|
java.lang.String |
getRtpCname()
Returns the value which will be used for the canonical end-point
identifier (CNAME) in RTCP packets sent by this running instance of
libjitsi.
|
java.lang.Object |
getVideoPreviewComponent(MediaDevice device,
int preferredWidth,
int preferredHeight)
Creates a preview component for the specified device(video device) used
to show video preview from it.
|
boolean |
isPartialStreaming(MediaDevice mediaDevice)
If the MediaDevice corresponds to partial desktop streaming
device.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener to no longer be notified about
changes in the values of the properties of this instance.
|
void |
removeRecorderListener(Recorder.Listener listener)
Removes an existing Recorder.Listener from the list of listeners
interested in notifications from Recorders.
|
static final java.lang.String DEFAULT_DEVICE
getDefaultDevice(MediaType, MediaUseCase)
. The oldValue
and the newValue of the fired PropertyChangeEvent are
not to be relied on and instead a call to getDefaultDevice is to
be performed to retrieve the new value.static final java.lang.String ENABLE_FFMPEG_CODECS_PNAME
static final java.lang.String ENABLE_H264_FORMAT_PNAME
void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the PropertyChangeListener to be notified about
changes in the values of the properties of this instancevoid addRecorderListener(Recorder.Listener listener)
listener
- the new Recorder.Listener to be added to the
list of listeners interested in notifications from Recorders.EncodingConfiguration createEmptyEncodingConfiguration()
MediaStream createMediaStream(MediaDevice device)
device
- the MediaDevice to be used by the new instance for
capture and playback of mediaMediaStream createMediaStream(MediaType mediaType)
MediaDevice.getMediaType()
equals
mediaType.mediaType
- the MediaType of the new instance to be
initializedMediaStream createMediaStream(StreamConnector connector, MediaDevice device)
connector
- the StreamConnector the stream should use for
sending and receiving media or null if the stream is to not have
a StreamConnector configured at initialization time and a
StreamConnector is to be specified later ondevice
- the device to be used for both capture and playback of
media exchanged via the specified StreamConnectorMediaStream createMediaStream(StreamConnector connector, MediaType mediaType)
connector
- the StreamConnector the stream should use for
sending and receiving media or null if the stream is to not have
a StreamConnector configured at initialization time and a
StreamConnector is to be specified later onmediaType
- the MediaType of the media to be exchanged by
the new instance via the specified connectorMediaStream createMediaStream(StreamConnector connector, MediaDevice device, SrtpControl srtpControl)
connector
- the StreamConnector the stream should use for
sending and receiving media or null if the stream is to not have
a StreamConnector configured at initialization time and a
StreamConnector is to be specified later ondevice
- the device to be used for both capture and playback of
media exchanged via the specified StreamConnectorsrtpControl
- a control which is already created, used to control
the ZRTP operations.MediaStream createMediaStream(StreamConnector connector, MediaType mediaType, SrtpControl srtpControl)
connector
- the StreamConnector the stream should use for
sending and receiving media or null if the stream is to not have
a StreamConnector configured at initialization time and a
StreamConnector is to be specified later onmediaType
- the MediaType of the media to be exchanged by
the new instance via the specified connectorsrtpControl
- the SrtpControl to control the security of
the media exchangeMediaDevice createMixer(MediaDevice device)
device
- the MediaDevice which is to be used by the
returned MediaDevice to actually capture and play back mediaRecorder createRecorder(MediaDevice device)
device
- the MediaDevice which is used for media capture
and playback by the call to be recordedRecorder createRecorder(RTPTranslator translator)
translator
- the RTPTranslator for which to create a
RecorderRTPTranslator createRTPTranslator()
SrtpControl createSrtpControl(SrtpControlType srtpControlType)
srtpControlType
- the SrtpControlType of the new instancejava.util.List<ScreenDevice> getAvailableScreenDevices()
EncodingConfiguration getCurrentEncodingConfiguration()
MediaDevice getDefaultDevice(MediaType mediaType, MediaUseCase useCase)
mediaType
- a MediaType value indicating the kind of device
that we are trying to obtain.useCase
- MediaUseCase value indicating for the use-case of
device that we are trying to obtain.ScreenDevice getDefaultScreenDevice()
java.util.List<MediaDevice> getDevices(MediaType mediaType, MediaUseCase useCase)
mediaType
- the media type (i.e. AUDIO or VIDEO) that we'd like
to obtain the device list for.useCase
- MediaUseCase value indicating for the use-case of
device that we are trying to obtain.java.util.Map<MediaFormat,java.lang.Byte> getDynamicPayloadTypePreferences()
Map
that binds indicates whatever preferences the
media service implementation may have for the RTP payload type numbers
that get dynamically assigned to MediaFormat
s with no static
payload type. The method is useful for formats such as "telephone-event"
for example that is statically assigned the 101 payload type by some
legacy systems. Signalling protocol implementations such as SIP and XMPP
should make sure that, whenever this is possible, they assign to formats
the dynamic payload type returned in this Map
.Map
binding some formats to a preferred dynamic RTP
payload type number.MediaFormatFactory getFormatFactory()
VolumeControl getInputVolumeControl()
MediaDevice getMediaDeviceForPartialDesktopStreaming(int width, int height, int x, int y)
width
- width of the partheight
- height of the partx
- origin of the x coordinate (relative to the full desktop)y
- origin of the y coordinate (relative to the full desktop)java.awt.Point getOriginForDesktopStreamingDevice(MediaDevice mediaDevice)
mediaDevice
- media deviceVolumeControl getOutputVolumeControl()
java.util.Iterator<Recorder.Listener> getRecorderListeners()
java.lang.Object getVideoPreviewComponent(MediaDevice device, int preferredWidth, int preferredHeight)
device
- the video devicepreferredWidth
- the width we prefer for the componentpreferredHeight
- the height we prefer for the componentboolean isPartialStreaming(MediaDevice mediaDevice)
mediaDevice
- MediaDevicevoid removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the PropertyChangeListener to no longer be
notified about changes in the values of the properties of this instancevoid removeRecorderListener(Recorder.Listener listener)
listener
- the existing Listener to be removed from the
list of listeners interested in notifications from Recordersjava.lang.String getRtpCname()
RecorderEventHandler createRecorderEventHandlerJson(java.lang.String filename) throws java.io.IOException
filename
- the filename into which the created
RecorderEventHandler will save received events.java.io.IOException
- if a RecorderEventHandler could not be
created for filename.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.