Packagecom.acapela.vaas.advanced
Classpublic class Player
InheritancePlayer Inheritance flash.events.EventDispatcher

Like Synthesizer it performs the core functions of the service but it adds MP3 sound playback synchronized with words, mouth and bookmarks positions.

Compared to the Synthesizer class, it integrates:

However it is ONLY COMPLIANT WITH MP3 SOUND FILE TYPE !

You will have :

  • the sound corresponding to the message, once it is started to download. If you active these positions managers, you will have the sound once it is completly generated.
  • the access to word positions, bookmark positions and mouth position on time with sound playing.
  • the information of the sound if the message has been generated in format mp3.

You can access to a ready to use Player instance through the player property of the Connector class.

br/> See also related documents: Overview and Basic/Advanced comparison

See also



Public Properties
 PropertyDefined by
  streamingEnabled : Boolean
By default the player uses streaming whenever possible (i.e: when no synchro for positions is requested).
You can disable it by setting streamingEnabled to false.
Player
Public Methods
 MethodDefined by
  
Player(connector:Connector)
Player
  
pause():void
Pauses the sound that is playing
Player
  
play(msg:Message):void
This function will give a service generating a message text to speech.
Player
  
replay(sound_id:String = null):void
This function will give a service complete retrieving a message identified by its ID.
Player
  
resume():void
Resumes the sound that is paused.
Player
  
stop():void
Stops the sound that is playing.
Player
Events
 EventSummaryDefined by
   Dispatched when a message was successfully played/replayed.Player
   Dispatched when the playback of the sound corresponding to the event is buffering.Player
   Dispatched when the playback of the sound corresponding to the event has finished playing.Player
   Dispatched when the playback of the sound corresponding to the event is about to start.Player
   Dispatched at the right moment with sound playing, which is obtained by the call of play(msg:Message) or replay(sound_id:String=null).Player
   Dispatched while a message is played to notify the application of the mouth properties associated to the speech.Player
   Dispatched while a message is played to notify the application of the words currently spoken.Player
Property detail
streamingEnabledproperty
streamingEnabled:Boolean  [read-write]

By default the player uses streaming whenever possible (i.e: when no synchro for positions is requested).
You can disable it by setting streamingEnabled to false.

Implementation
    public function get streamingEnabled():Boolean
    public function set streamingEnabled(value:Boolean):void
Constructor detail
Player()constructor
public function Player(connector:Connector)

Parameters
connector:Connector
Method detail
pause()method
public function pause():void

Pauses the sound that is playing

play()method 
public function play(msg:Message):void

This function will give a service generating a message text to speech.

The result will be the sound and the dispatched events when the request will be treated.
This event could be:

  • SOUND_START event when when message is generated and the corresponding sound has startd playing
  • SOUND_BUFFERING event when the sound is buffering.
  • SOUND_END event when the sound has finished playing
  • SYNCHRO_WORD_POSITION event when a word-position is available
  • SYNCHRO_BOOKMARK_POSITION event when a bookmark-position is available
  • SYNCHRO_MOUTH_POSITION event when a mouth-position is available
  • an error event when the operation failed.

If there are not the listeners for the positions manager, the sound will be automatic played in streaming: synthesized, compressed and sent on the fly to be played as quickly as possible.
Otherwise, the sound will be completly generated and the played. Parameters
msg:MessageMessage(Ext) instance containing at least the voice and the text to use for generation process.
replay()method 
public function replay(sound_id:String = null):void

This function will give a service complete retrieving a message identified by its ID.

If the sound file still exists, the service will directy communicate its location.
If it was deleted, the service will try to regenerate it using the text and the voice name that was stored during the first generation.
If regeneration succeed, the service will send the sound of message, otherwise an error event is dispatched by the Connector.

Basically the result is the same as with the play function documented above.

Parameters
sound_id:String (default = null) — id of the message to retrieve. If this value is null, player will try to play the last sound that has been generated or retrieved.
resume()method 
public function resume():void

Resumes the sound that is paused.

stop()method 
public function stop():void

Stops the sound that is playing. The sound will be restarted from the beginning.

Event detail
messageObtainedevent 
Event object type: com.acapela.vaas.advanced.events.MessageEvent
MessageEvent.type property = com.acapela.vaas.advanced.events.MessageEvent.MESSAGE_OBTAINED

Dispatched when a message was successfully played/replayed. You can access to the corresponding Message instance using message property of this event.

The MessageEvent.MESSAGE_OBTAINED constant defines the value of the type property of an messageObtained event object.

This event has the following properties:
PropertyDescription
bubblesfalse
cancelablefalse
messageThe message corresponding to this event
targetThe Synthesizer or Player instance that generated it.

soundBufferingevent  
Event object type: com.acapela.vaas.advanced.events.SoundEvent
SoundEvent.type property = com.acapela.vaas.advanced.events.SoundEvent.SOUND_BUFFERING

Dispatched when the playback of the sound corresponding to the event is buffering.

The SoundEvent.SOUND_BUFFERING constant defines the value of the type property of an soundBuffering event object.

This event has the following properties:

PropertyDescription
soundThe Sound instance corresponding to this event
bubblesfalse
cancelablefalse
targetThe Player instance that generated it.

soundPlayEndedevent  
Event object type: com.acapela.vaas.advanced.events.SoundEvent
SoundEvent.type property = com.acapela.vaas.advanced.events.SoundEvent.SOUND_PLAY_ENDED

Dispatched when the playback of the sound corresponding to the event has finished playing.

The SoundEvent.SOUND_PLAY_ENDED constant defines the value of the type property of an soundPlayEnded event object.

This event has the following properties:

PropertyDescription
soundThe Sound instance corresponding to this event
bubblesfalse
cancelablefalse
targetThe Player instance that generated it.

soundPlayStartedevent  
Event object type: com.acapela.vaas.advanced.events.SoundEvent
SoundEvent.type property = com.acapela.vaas.advanced.events.SoundEvent.SOUND_PLAY_STARTED

Dispatched when the playback of the sound corresponding to the event is about to start.

The SoundEvent.SOUND_BUFFERING constant defines the value of the type property of an soundBuffering event object.

This event has the following properties:

PropertyDescription
soundThe Sound instance corresponding to this event
bubblesfalse
cancelablefalse
targetThe Player instance that generated it.

synchroBookmarkPositionevent  
Event object type: com.acapela.vaas.advanced.events.BookmarkPositionEvent
BookmarkPositionEvent.type property = com.acapela.vaas.advanced.events.BookmarkPositionEvent.SYNCHRO_BOOKMARK_POSITION

Dispatched at the right moment with sound playing, which is obtained by the call of play(msg:Message) or replay(sound_id:String=null). You can access to the corresponding BookmarkPosition instance using currentBookmarkPosition property of this event.

The BookmarkPositionEvent.SYNCHRO_BOOKMARK_POSITION constant defines the value of the type property of an synchroBookmarkPosition event object.

This event has the following properties:

PropertyDescription
ida Number representing the id of the bookmark position.
i.e: the value contained in the associated tag.
positionthe the complete BookmarkPosition instance associated to this event.
bubblesfalse
cancelablefalse
targetThe Player instance or the other object instance that generated it.

synchroMouthPositionevent  
Event object type: com.acapela.vaas.advanced.events.MouthPositionEvent
MouthPositionEvent.type property = com.acapela.vaas.advanced.events.MouthPositionEvent.SYNCHRO_MOUTH_POSITION

Dispatched while a message is played to notify the application of the mouth properties associated to the speech.

You can access to the corresponding MouthPosition instance using position property of this event.

The MouthPositionEvent.SYNCHRO_MOUTH_POSITION constant defines the value of the type property of an synchroMouthPosition event object.

The synchroMouthPosition event is suitable to animate the mouth of an avatar for example.

This event has the following properties:

PropertyDescription
mouthHeighta Number representing the height of the mouth or lips.
mouthWidtha Number representing the width of the mouth or lips.
mouthUpturna Number representing the mouth turns up at the corners
(that is, how much it smiles).
jawOpena Number representing the upper jaw oppening.
teethUpperVisiblea Number representing the upper teeth visibility.
teethLowerVisiblea Number representing the upper teeth visibility.
tonguePosna Number representing the tongue position.
lipTensiona Number representing the lip tension.
positionthe the complete MouthPosition instance associated to this event.
bubblesfalse
cancelablefalse
targetThe Player instance or the other object instance that generated it.

synchroWordPositionevent  
Event object type: com.acapela.vaas.advanced.events.WordPositionEvent
WordPositionEvent.type property = com.acapela.vaas.advanced.events.WordPositionEvent.SYNCHRO_WORD_POSITION

Dispatched while a message is played to notify the application of the words currently spoken. You can access to the corresponding WordPosition instance using position property of this event.

The WordPositionEvent.SYNCHRO_WORD_POSITION constant defines the value of the type property of an synchroWordPosition event object. The synchroWordPosition event is suitable for subtitling as an example.

This event has the following properties:

PropertyDescription
worda String representing the word corresponding to the event.
startPosa Number representing the start position of the word in the text.
endPosa Number representing the end position of the word in the text.
positionthe the complete WordPosition instance associated to this event.
bubblesfalse
cancelablefalse
targetThe Player instance or the other object instance that generated it.