Dynamically setting the volume on a video using JavaScript and the CFMEDIAPLAYER tag in ColdFusion

Readability

Dynamically setting the volume on a video using JavaScript and the CFMEDIAPLAYER tag in ColdFusion

In a pre­vi­ous exam­ple, “Mut­ing a video using JavaScript and the CFME­DI­APLAYER tag in Cold­Fu­sion”, we saw how you could dynam­i­cally mute a video using the <CFME­DI­APLAYER> tag at run­time using JavaScript and Cold­Fu­sion by call­ing the ColdFusion.Mediaplayer.setMute() function.

The fol­low­ing exam­ple shows how you can dynam­i­cally set the vol­ume on the <CFME­DI­APLAYER> tag at run­time using JavaScript and Cold­Fu­sion by call­ing the ColdFusion.Mediaplayer.setVolume() function.

And the out­put of the <CFME­DI­APLAYER> tag is as fol­lows:

In a previous example, “Muting a video using JavaScript and the CFMEDIAPLAYER tag in ColdFusion”, we saw how you could dynamically mute a video using the <CFMEDIAPLAYER> tag at runtime using JavaScript and ColdFusion by calling the ColdFusion.Mediaplayer.setMute() function.

The following example shows how you can dynamically set the volume on the <CFMEDIAPLAYER> tag at runtime using JavaScript and ColdFusion by calling the ColdFusion.Mediaplayer.setVolume() function.

<div style="background-color:#EEEEEE; padding:5px;">
    <input type="button"
            value="setVolume(0.0)"
            onclick="ColdFusion.Mediaplayer.setVolume('flvPlayer', 0.0);" />
    <input type="button"
            value="setVolume(0.5)"
            onclick="ColdFusion.Mediaplayer.setVolume('flvPlayer', 0.5);" />
    <input type="button"
            value="setVolume(1.0)"
            onclick="ColdFusion.Mediaplayer.setVolume('flvPlayer', 1.0);" />
</div>
 
<cfmediaplayer name="flvPlayer"
        source="http://helpexamples.com/flash/video/caption_video.flv"
        autoPlay="false" />

And the output of the <CFMEDIAPLAYER> tag is as follows:

Leave a Reply

Your email address will not be published.