|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Defines methods for playing a media stream into a Terminal. A Player extracts data from a media stream container (MSC), transcodes the data as necessary for the telephony network, and streams the resultant data out to that network.
The play() method accepts one or an array of Strings
which identify the media streams to be played. Each media stream
may be encoded by any coder type supported by this player resource.
The Player interface is also used to send synthesize requests to a TTS server (see below). In that case it does not support an array of Strings but only a String defining the URI to the TTS server.
The Player interface is also used to send SMS-TL messages. In that case it does not support an array of Strings but only a String defining the SMS-TL mode.
This resource will be able to send faxes (see below).
In addition to the play method, a number of RTC actions
affect the operation of the player. These can be invoked through a
Run Time Control RTC,
A Player may optionally support additional processing features.
These features define parameters and runtime controls that affect
operation of an ongoing play operation.
The presence of these features is indicated by a true
value for the following attributes:
| Attribute: | indicates the ability to: |
| a_Pause | pause and resume in place |
| a_Speed | change the playback speed |
| a_Volume | increase and decrease the volume |
| a_Jump | jump forward and backward while playing |
Coding types for data objects are defined in CoderConstants.
The MSC to be played is identified by its String name. The String name is an identifier that may be interpreted as a path or URL (URI) for the MSC.
Note: The format of the String that identifies an MSC is not defined by this release of specification. The vendor-specific implementation of the MediaService (for example, the vendor of the server or resource) shall define the supported String formats.
For example, an implementation may support URLs or File pathnames;
in which case an application could use Strings of the form:
"file://node/dir/name" or "dir/dir/name"
If the MSC identifier is a file pathname, it is interpreted in the logical filename-space of the server. Applications and their prompts need to be installed with correct pathnames.
The Player has three states: Idle, Active, and Paused.
In the Idle state, the Player is performing no coding or
transmit operations. The state transitions to the Active
or Paused state when the play() method starts.
The state of the Player after play() starts is determined
by the Boolean value of the parameter p_StartPaused.
The state transitions to Active if p_StartPaused is false.
The state transitions to Paused if p_StartPaused is true.
In the Paused state, the player is not transmitting the media stream.
It retains its place in the MSC being played, and resumes from
the same place when the RTC action, rtca_Resume is received.
In the Active state, the Player is busy, actively transmitting the media stream from a MSC to its output media stream (the Terminal). The Player continues in this state until it reaches the end of the MSC list or until RTC actions tell it to pause or stop. In the Active state, the Player may receive RTC commands to change the speed or volume of the play operation. It may also receive commands to jump forward or backward in the MSC.
If a new play() is attempted while the Player is Active, the result
is determined by the value of the p_IfBusy parameter.
The alternative values for p_IfBusy are:
v_Queue:
This play is queued (default). It is played
when the previous plays have completed.v_Stop:
The current play and any queued plays are stopped,
(with event qualifier q_Stop).
This play begins immediately.v_Fail:
This play fails, with (getError()==Error.e_Busy)Player.a_Pause is true,
then the Player supports the pause and resume operations.
rtca_Pause sets the player state to Paused
and onPlayerEvent() is invoked if ev_Pause
is enabled in p_EnabledEvents.rtca_Resume sets the player state to Active,
continues to play the stream from its current offset,
and onPlayerEvent() is invoked if ev_Resume
is enabled in p_EnabledEvents.a_Pause is false, then
then the effects of the RTC actions, parameters, and methods
discussed in this section are not defined.
The units by which speed may be adjusted are percentage change from
the normal speed.
If the attribute Player.a_Speed is true,
then the player supports the following features:
rtca_SpeedUp and rtca_SpeedDown
RTC actions cause the playback speed
to be adjusted one quantum up or down respectively.
rtca_ToggleSpeed RTC action changes the speed to
the normal value.
If the current playback speed is at the default normal value, the
rtca_ToggleSpeed RTC action changes the speed to the
last adjusted value.
ev_Speed is delivered to
PlayerListener.onSpeedChange. This event
may be enabled or disabled by the p_EnabledEvents parameter.
a_Speed is false, then
then the effects of the RTC actions, parameters, and methods
discussed in this section are not defined.
If the value of attribute a_Volume is true
then the Player supports the following features:
rtca_VolumeUp and rtca_VolumeDown
RTC actions cause the playback volume to be adjusted one quantum
up or down respectively.
The size of the quantum is governed by the parameter
p_VolumeChange, measured in dB from the normal volume.
rtca_ToggleVolume RTC action changes the volume to the
normal value.
If the current playback volume is at the default normal value, the
rtca_ToggleVolume RTC action changes the volume to the
last adjusted value.
ev_Volume is delivered to
PlayerListener.onVolumeChange. This event
may be enabled or disabled by the p_EnabledEvents parameter.
If the value of attribute a_Volume is false,
then the effects of the RTC actions, parameters, and methods
discussed in this section are not defined.
If a player resource supports a_Jump attribute, then
the following features are supported:
A Jump method or RTC action that goes past the end of the current MSC continues into the next MSC in the MSC list if the coders for the MSCs support the same time increment. If the next MSC in sequence has a different coder type, the current location is set to the beginning of that MSC.
If the value of attribute a_Jump is false,
then the effects of the RTC actions, parameters, and methods
discussed in this section are not defined.
streamID parameter is the Audio Service in form
rtsp://audioservice
optArgs hashtable, referenced
by the parameter TTSConstants.p_TTSData
offset parameter is ignored
streamID)
is not supported.
TTSConstants.
The onPlayerEvent() callback is used to deliver the same PlayerEvents as for a normal play,
but the events are extended to implement TTSPlayerEvent.
// AudioService URL
String ttsAudioService="rtsp://ttsAudioService";
// the parameter dictionary
Hashtable optArgs = new Hashtable();
// The message to be translated into audio
String message="Hello World";
// the message is set into an optArg dictionary
optArgs.put(p_TTSData, message);
// start playing
try {
// send the play request to the audio service
mediagroup.play(ttsAudioService,myRtcs,optArgs);
} catch (Exception e) {
// exception processing etc.
}
TTSConstants.p_TextType
should be set in the optArgs to "application/synthesis+ssml".
SSML tagged text can contain tags to change the voice type, prosody etc.
These can also be set by using various parameters passed in optArgs such
as p_Speaker, p_SpeakerGender, p_SpeakerCatagory etc.
Refer to TTSConstants for full details.
It is also possible to set arbitary MRCP SPEAK message parameters using the optArgs. Any entry that has a String type key, and a String type value, is placed "as-is" into the MRCP header in the form key : value. This should only be used by advanced users after referring to the MRCP RFC.
streamID parameter is the SMS mode in form
sms-tl://
optArgs hashtable, referenced
by the parameter SMSPlayerConstants.p_DLL_MessageType
The SMS-TL message to be send is passed in the optArgs hashtable, referenced
by the parameter SMSPlayerConstants.p_TL_Data in case of v_DLL_INFO_REQ
DLL message type value
offset parameter is ignored
streamID)
is not supported.
SMSPlayerConstants.p_DLL_T10Timeout, SMSPlayerConstants.p_DLL_T11Timeout,
SMSPlayerConstants.p_DLL_T12Timeout, SMSPlayerConstants.p_DLL_RequiredTestErrorCause
.
The p_DLL_TxTimeout allows to set the Tx Timeout used by the DLL protocol
The p_DLL_RequiredTestErrorCause allows to generate a DLL error for test purpose
The list of parameters is given by SMSPlayerConstants.
The result of the SMS play() operation is delivered in an
SMSPlayerEvent to the onPlayerEvent callback
of the ResourceEventListener.
If the SMS play was successful, then an eventId equal to
SMSRecorderConstants.ev_SMS is received.
Refer to SMSPlayerConstants for full details on these symbols and their meaning.
// SMS Service
String smsService="sms-tl://";
// the parameter dictionary
Hashtable optArgs = new Hashtable();
// The message to be send
byte[] message= { 'E', 'n', 'c', 'o', 'd', 'e', 'd', ' ', 'T', 'L', ' ', 'M', 'S', 'G' };
// the message is set into an optArg dictionary
optArgs.put(SMSPlayerConstants.p_DLL_MessageType, SMSPlayerConstants.v_DLL_INFO_REQ);
optArgs.put(SMSPlayerConstants.p_TL_Data, message);
// start playing
try {
// send the play request to the SMS service
mediagroup.play(smsService,myRtcs,optArgs);
} catch (Exception e) {
// exception processing etc.
}
AsyncMediaGroup should be brought by loopCP with ConfigSpec.basicFaxConfig.
streamID parameter is the 20 printable characters fax ID, prefixed by
fax://.
offset parameter is ignored
streamID) is NOT supported.
parameters are passed in the params hashtable to setup the local fax characteritics.
params.put(FaxConstants.p_PagesEncoding ,FaxConstants.v_TIFF); params.put(FaxConstants.p_TiffPath ,"/tmp/test/fax/coarse_a4_2.tif"); params.put(FaxConstants.p_DeTiffPrefix ,"/tmp/test/fax/"+uniqueSessionId+"_"); params.put(FaxConstants.p_DeTiffSuffix ,".fax"); params.put(FaxConstants.p_VerticalResolution ,FaxConstants.v_Fine_196lpi); params.put(FaxConstants.p_PageWidth ,FaxConstants.v_2048pixelsIn255mm); params.put(FaxConstants.p_PageLength ,FaxConstants.v_B4_364mm); params.put(FaxConstants.p_FaxTimeOut ,new Integer(900000));//15 minutes params.put(FaxConstants.p_MaxPageToReceive ,new Integer(5)); params.put(FaxConstants.p_EnablePolling ,Boolean.FALSE); params.put(FaxConstants.p_CapabilityToReceive ,Boolean.FALSE); // we have made an outgoing call, willing to send fax : params.put(FaxConstants.p_Role ,FaxConstants.v_Caller); // start sending whatever pages in the Tiff-F container : String servicePrefixPlusFaxID = FaxConstants.v_Prefix+"hp OC MP 2.4C2 fax"; mediagroup.play(servicePrefixPlusFaxID, -1, myRtcs, params);The result of the Fax
play() operation is delivered in a
FaxEvent to the
onPlayerEvent()
or
onRecorderEvent()
callback of the ResourceEventListener.
Note : the regular direct send is delivered with 2.4C2 EA.
params.put(FaxConstants.p_PagesEncoding ,FaxConstants.v_TIFF); params.put(FaxConstants.p_TiffPath ,"/tmp/test/fax/coarse_a4_2.tif"); params.put(FaxConstants.p_DeTiffPrefix ,"/tmp/test/fax/"+uniqueSessionId+"_"); params.put(FaxConstants.p_DeTiffSuffix ,".fax"); params.put(FaxConstants.p_VerticalResolution ,FaxConstants.v_Normal_98lpi); params.put(FaxConstants.p_PageWidth ,FaxConstants.v_1728pixelsIn215mm); params.put(FaxConstants.p_PageLength ,FaxConstants.v_A4_297mm); params.put(FaxConstants.p_PageResolution ,FaxConstants.v_Page_Resolution_0200_0100); params.put(FaxConstants.p_FileType ,FaxConstants.v_T4_1D_ModifiedHuffman); params.put(FaxConstants.p_FaxTimeOut ,new Integer(900000));//15 minutes params.put(FaxConstants.p_MaxPageToReceive ,new Integer(5)); // parameters above are like for the regular direct send. // we receive an incoming call, and are sending : params.put(FaxConstants.p_Role ,FaxConstants.v_Answerer);// as for the regular direct receive params.put(FaxConstants.p_CapabilityToReceive ,Boolean.FALSE);// as for the regular direct send // we do not have any page to receive, we just send : params.put(FaxConstants.p_EnablePolling ,Boolean.TRUE);// unlike the regular direct sendThe
play() method will be called the same way.
Note : the reversed polling mode is delivered within late 2.4C2.
| Field Summary |
| Fields inherited from interface hp.telephony.media.ResourceConstants |
e_Disconnected, e_OK, FOREVER, q_Duration, q_RTC, q_Standard, q_Stop, rtcc_Disconnected, rtcc_TriggerRTC, v_Forever |
| Fields inherited from interface hp.telephony.media.CoderConstants |
p_AMR_SDPelement, p_channels, p_crc, p_G723_annexa, p_G723_bitrate, p_G729_annexb, p_interleaving, p_maxptime, p_modechangeneighbor, p_modechangeperiod, p_modeset, p_octetalign, p_ptime, p_robustsorting, v_ADPCM_16kG726, v_ADPCM_24k, v_ADPCM_32k, v_ADPCM_32kG726, v_ADPCM_32kOKI, v_ADPCM_44k, v_ALawPCM_48k, v_ALawPCM_64k, v_ALawPCM_88k, v_AMR, v_AMR_WB, v_G723_1b, v_G723_53, v_G723_63, v_G723_no_vad, v_G723_yes, v_G729_no_vad, v_G729_yes, v_G729a, v_GSM, v_Linear16Bit_64k, v_Linear8Bit_48k, v_Linear8Bit_64k, v_Linear8Bit_88k, v_MuLawPCM_48k, v_MuLawPCM_64k, v_MuLawPCM_88k |
| Method Summary | |
void |
play(String[] streamIDs,
int offset,
RTC[] rtc,
Dictionary optargs)
Play a sequence of MSCs (Media Stream Containers) identified by the streamIDs. |
void |
play(String streamIDs,
int offset,
RTC[] rtc,
Dictionary optargs)
Play a single MSC (Media Stream Container) named by streamID. |
| Method Detail |
public void play(String[] streamIDs,
int offset,
RTC[] rtc,
Dictionary optargs)
throws MediaResourceException,
AccessControlException
This method cannot be used for sending TTS synthesize requests. Sequences of MSCs are not supported for this type of requests.
This method cannot either be used for SMS, nor for fax.
This method returns when the MSC list is started.
This method is non-blocking. The result is passed in a
PlayerEvent event through the ResourceEventListener Interface.
The condition that caused the play to stop is included in the
completion event. RTC actions can alter the course of the play
without the intervention of the application.
Optional arguments can alter the characteristics of the play.
Exceptions are thrown if pre- or post- conditions are not satisfied
Pre-conditions:
Post-conditions:
getQualifier():q_EndOfData: All MSCs named in this MSC list
have been played.q_Stop: play was stopped by the
stop() method
or because (p_IfBusy=v_Stop)q_RTC: play was stopped by
Player.rtca_Stop
streamIDs - a String[] naming the MSC list to be played.offset - number of milliseconds into the MSC list at
which play is to start, offset may span several items in streamIDs.rtc - Array of RTC that effect this play.optargs - a Dictionary of optional arguments.
MediaResourceException - if requested operation fails.
AccessControlException - if access to resource is refusedResourceEventListener.onPlayerEvent(PlayerEvent)
public void play(String streamIDs,
int offset,
RTC[] rtc,
Dictionary optargs)
throws MediaResourceException,
AccessControlException
play() with a String[] of length one,
containing the given streamID.
This method should be used for sending TTS synthesize, Fax and SMS requests.
This method is non-blocking. The result is passed in a
PlayerEvent event through the ResourceEventListener Interface
streamIDs - a String naming the MSC to be played or the TTS
Audio Service URI in form "rtsp://audioservice"
"sms-tl://"
"fax://".offset - int number milliseconds into the MSC (ignored for
TTS synthesize, fax or SMS requests) at which play is to start. Not supported for
file with encoding format: v_ADPCM_32k, v_ADPCM_32kOKI, v_ADPCM_16kG726 and v_ADPCM_32kG726.rtc - Array of RTC that effect this play.optargs - a Dictionary of optional arguments.
MediaResourceException - if requested operation fails
AccessControlException - if access to resource is refusedResourceEventListener.onPlayerEvent(PlayerEvent)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||