Packagecom.acapela.vaas
Classpublic class BasicVaas
InheritanceBasicVaas Inheritance flash.events.EventDispatcher

The BasicVaas class is a simple all-in-one class that performs basic functions of the voice as a service API.

It enables you to create a message using:

You will have access to:

Since 1-30 version, you have new methods to automaticaly play the sound associated to the message and use streaming mode:

Using this class is the simpliest way to use voice as a service. However, it does not provide access to advanced functions of the service.

Anyway, if it is offering enough for you, you can forget about the rest of the API.


Note about authentication :

Our service is constantly evolving and we do our best to maintain backward compliance.
That is why there is different ways to proceed with authentication:


This logins and passwords are setted using the accountLogin, applicationLogin and password properties.

If you receveived a service URL from Acapela (optional), you will have to set it using the serviceURL property.


See also related documents: Overview and Basic/Advanced comparison



Public Properties
 PropertyDefined by
  accountLogin : String
The service URL you received from Acapela.
BasicVaas
  applicationLogin : String
The application login (optionnal, could be received from Acapela or created on your backoffice)
BasicVaas
  lastError : String
[read-only] The description of the error that just happened.
You should access it only from the error event handler.
BasicVaas
  password : String
The application/main account password to use (received from Acapela or created on your backoffice)
BasicVaas
  requestedId : String
[read-only] The ID (identifier) of the message that was just generated.
BasicVaas
  requestedSound : Sound
[read-only] The Sound object corresponding to the message that was just generated.
BasicVaas
  serviceURL : String
The service URL you may have receive from Acapela.
BasicVaas
Public Methods
 MethodDefined by
  
use it to create a new BasicVaas object instance.
BasicVaas
  
generateMessage(voice:String, text:String):void
This function will post a message generation request to the service.
BasicVaas
  
pause():void
Pauses the sound that is playing.
BasicVaas
  
play(voice:String, message:String):void
Play the corresponding sound of the requested message.
BasicVaas
  
replay(snd_id:String = null):void
Play the corresponding sound of the message identified by its id.
BasicVaas
  
resume():void
Resumes the sound that is paused.
BasicVaas
  
retrieveMessage(msgId:String):void
This function will post a request to the service in order to retrieve a previously generated message.
BasicVaas
  
stop():void
Stops the sound that is playing.
BasicVaas
Public Constants
 ConstantDefined by
  ERROR : String = "error"
[static] Type of the event dispatched when an error occured while calling generateMessage or retrieveMessage.
BasicVaas
  MESSAGE_AVAILABLE : String = "messageAvailable"
[static] Type of the event dispatched as a result of a successfull call to generateMessage or retrieveMessage.
BasicVaas
Property detail
accountLoginproperty
accountLogin:String  [read-write]

The service URL you received from Acapela. Make sure you include the tailing '/' (slash) if there is one.

Implementation
    public function get accountLogin():String
    public function set accountLogin(value:String):void

See also

applicationLoginproperty 
applicationLogin:String  [read-write]

The application login (optionnal, could be received from Acapela or created on your backoffice)

Implementation
    public function get applicationLogin():String
    public function set applicationLogin(value:String):void

See also

lastErrorproperty 
lastError:String  [read-only]

The description of the error that just happened.
You should access it only from the error event handler.

Implementation
    public function get lastError():String
passwordproperty 
password:String  [read-write]

The application/main account password to use (received from Acapela or created on your backoffice)

Implementation
    public function get password():String
    public function set password(value:String):void

See also

requestedIdproperty 
requestedId:String  [read-only]

The ID (identifier) of the message that was just generated. You should access it only from the messageAvailable event handler.

Implementation
    public function get requestedId():String
requestedSoundproperty 
requestedSound:Sound  [read-only]

The Sound object corresponding to the message that was just generated. You should access it only from the messageAvailable event handler.

Implementation
    public function get requestedSound():Sound
serviceURLproperty 
serviceURL:String  [read-write]

The service URL you may have receive from Acapela. If not, don't set this property. Make sure you include the tailing '/' (slash) if there is one.

Implementation
    public function get serviceURL():String
    public function set serviceURL(value:String):void

See also

Constructor detail
BasicVaas()constructor
public function BasicVaas()

use it to create a new BasicVaas object instance.

Method detail
generateMessage()method
public function generateMessage(voice:String, text:String):void

This function will post a message generation request to the service.

The result will be a dispatched event when the request will be treated.
This event could be:

  • messageAvailable event when message is generated and the corresponding sound downloaded,
  • an error event when the operation failed.

Parameters
voice:String — identifier of the voice to use for the sound generation. e.g. : "heather22k"
 
text:String — text to synthesize. e.g. : "hello, my name is Heather."
pause()method 
public function pause():void

Pauses the sound that is playing.

play()method 
public function play(voice:String, message:String):void

Play the corresponding sound of the requested message.

The event could be a dispatched when the request will be treated:

  • messageAvailable event when message is generated and the corresponding sound downloaded,
  • an error event when the operation failed.

Parameters
voice:String — identifier of the voice to use for the sound generation. e.g. : "heather22k"
 
message:String — text to synthesize. e.g. : "hello, my name is Heather."
replay()method 
public function replay(snd_id:String = null):void

Play the corresponding sound of the message identified by its id. If its id is null, the player will try to replay the current message.

Parameters
snd_id:String (default = null) — identifier of the message to use. The id received with MessageObtained event."
resume()method 
public function resume():void

Resumes the sound that is paused.

retrieveMessage()method 
public function retrieveMessage(msgId:String):void

This function will post a request to the service in order to retrieve a previously generated message.

The result will be a dispatched event when the request will be treated.
This event could be:

  • messageAvailable event when message is generated and the corresponding sound downloaded,
  • an error event when the operation failed.

Parameters
msgId:String — ID (identifier) of the message previously generated

See also

stop()method 
public function stop():void

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

Constant detail
ERRORconstant
public static const ERROR:String = "error"

Type of the event dispatched when an error occured while calling generateMessage or retrieveMessage.

The target of this event is the BasicVaas instance that generated it. You can access to the error description using the lastError property of this instance.

See also

MESSAGE_AVAILABLEconstant 
public static const MESSAGE_AVAILABLE:String = "messageAvailable"

Type of the event dispatched as a result of a successfull call to generateMessage or retrieveMessage. It occurs when the ID of the requested message was received and the corresponding Sound objet was loaded.

The target of this event is the BasicVaas instance that generated it. You can access to the id and the Sound object associated to the message using the requestedId and requestedSound properties of this instance.

See also