VOPlayer Class

Matt Karl edited this page Dec 17, 2015 · 9 revisions

The VOPlayer class lives within the Sound Module and uses the Sound Class (and optionally the Captions Module) to play voice-over audio. This is great for paying instructions.

Usage

var app = new springroll.Application();

app.on('init', function()
{
	// voPlayer is ready when the application inits
	this.voPlayer.play('IntroLine', function(){
		// Line is finished
	});
});

Methods

###play(idOrList, [callback, [cancelledCallback]])

Parameters

  • idOrList array|string The alias of the audio file to play or the array of items to play/call in order. Acceptable items in the list include int (millisecond delays), audio alias strings, and functions.
  • callback function (optional) The callback function when play completes.
  • cancelledCallback function (optional) The callback when stop is called before the audio is finished playing.

Example

In this example a sound "WouldYouLike" is played, followed by 400 milliseconds of silence, then a sound "Sandwich", then a function call, finally the sound "ForLunch";

var startAnimation = function()
{
	// Show the sandwich on stage!
};
// Great for creating dynamic/templated audio
app.voPlayer.play([
	'WouldYouLike',
	400, 
	'Sandwich',
	startAnimation, 
	'ForLunch'
]);

API Documentation

To see the full list of methods available to springroll.VOPlayer please see the full documentation.