| Package | com.acapela.vaas.advanced |
| Class | public class Player |
| Inheritance | Player flash.events.EventDispatcher |
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:
You will have :
You can access to a ready to use Player instance through the player property of the Connector class.
See also
| Property | Defined 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 | ||
| Method | Defined by | ||
|---|---|---|---|
|
| Player | ||
|
pause():void
Pauses the sound that is playing
| Player | ||
|
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 | ||
| Event | Summary | Defined 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 | |||
| streamingEnabled | property |
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.
public function get streamingEnabled():Boolean
public function set streamingEnabled(value:Boolean):void
| Player | () | constructor |
| pause | () | method |
public function pause():voidPauses the sound that is playing
| play | () | method |
public function play(msg:Message):voidThis 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 playingSOUND_BUFFERING event when the sound is buffering.SOUND_END event when the sound has finished playingSYNCHRO_WORD_POSITION event when a word-position is availableSYNCHRO_BOOKMARK_POSITION event when a bookmark-position is availableSYNCHRO_MOUTH_POSITION event when a mouth-position is availableerror event when the operation failed.msg:Message — Message(Ext) instance containing at least the voice and the text to use for generation process.
|
| replay | () | method |
public function replay(sound_id:String = null):voidThis 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.
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():voidResumes the sound that is paused.
| stop | () | method |
public function stop():voidStops the sound that is playing. The sound will be restarted from the beginning.
| messageObtained | event |
com.acapela.vaas.advanced.events.MessageEvent
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.
| Property | Description |
|---|---|
| bubbles | false |
| cancelable | false |
| message | The message corresponding to this event |
| target | The Synthesizer |
| soundBuffering | event |
com.acapela.vaas.advanced.events.SoundEvent
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:
| Property | Description |
|---|---|
| sound | The Sound instance corresponding to this event |
| bubbles | false |
| cancelable | false |
| target | The Player instance that generated it. |
| soundPlayEnded | event |
com.acapela.vaas.advanced.events.SoundEvent
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:
| Property | Description |
|---|---|
| sound | The Sound instance corresponding to this event |
| bubbles | false |
| cancelable | false |
| target | The Player instance that generated it. |
| soundPlayStarted | event |
com.acapela.vaas.advanced.events.SoundEvent
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:
| Property | Description |
|---|---|
| sound | The Sound instance corresponding to this event |
| bubbles | false |
| cancelable | false |
| target | The Player instance that generated it. |
| synchroBookmarkPosition | event |
com.acapela.vaas.advanced.events.BookmarkPositionEvent
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:
| Property | Description |
|---|---|
| id | a Number representing the id of the bookmark position. i.e: the value contained in the associated tag. |
| position | the the complete BookmarkPosition instance associated to this event. |
| bubbles | false |
| cancelable | false |
| target | The Player instance or the other object instance that generated it. |
| synchroMouthPosition | event |
com.acapela.vaas.advanced.events.MouthPositionEvent
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:
| Property | Description |
|---|---|
| mouthHeight | a Number representing the height of the mouth or lips. |
| mouthWidth | a Number representing the width of the mouth or lips. |
| mouthUpturn | a Number representing the mouth turns up at the corners
(that is, how much it smiles). |
| jawOpen | a Number representing the upper jaw oppening. |
| teethUpperVisible | a Number representing the upper teeth visibility. |
| teethLowerVisible | a Number representing the upper teeth visibility. |
| tonguePosn | a Number representing the tongue position. |
| lipTension | a Number representing the lip tension. |
| position | the the complete MouthPosition instance associated to this event. |
| bubbles | false |
| cancelable | false |
| target | The Player instance or the other object instance that generated it. |
| synchroWordPosition | event |
com.acapela.vaas.advanced.events.WordPositionEvent
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:
| Property | Description |
|---|---|
| word | a String representing the word corresponding to the event. |
| startPos | a Number representing the start position of the word in the text. |
| endPos | a Number representing the end position of the word in the text. |
| position | the the complete WordPosition instance associated to this event. |
| bubbles | false |
| cancelable | false |
| target | The Player instance or the other object instance that generated it. |