Controlling Player Volume using the Flash-Only Player API

In this topic you will learn how you can control player volume using the Flash-only Player API.

Note: The steps outlined in this topic are for Flash based players and will not work in HTML5 players and may prevent HTML5 players from functioning.

If you want to have your Video Cloud players load with the volume turned down, you can use the setVolume() method of the VideoPlayerModule class. The setVolume() method takes one parameter, a number from 0 to 1. For example, for half volume, you'd set the parameter to .5.

You also have the option to adjust the current volume by leveraging the complementary getVolume() method to get the current volume. As you'd expect, this method returns the current volume as a number between 0 and 1.

To change the volume when the player loads, call the setVolume() method in the templateReady() handler, or in the onTemplateLoaded() handler. To change the volume during play, call the setVolume() method after the player loads, at events such as a button click, or a timer trigger, or another event that works for your player.

Here is a working JavaScript sample that uses the setVolume() method to adjust player volume when the player loads and when clicking a button:

http://files.brightcove.com/dev/Controlling-Player-Volume-with-the-Player-APIs/index.html.
 

Post new comment

The content of this field is kept private and will not be shown publicly.
0

Comments