MediaPlayer.OnClientVolumeChanged Property
Gets or sets the name of the client JavaScript function (event handler) that is called when the volume is modified.
Namespace: System.Web.UI.SilverlightControls
Assembly: System.Web.Silverlight (in System.Web.Silverlight.dll)
Syntax
'Declaration
<BindableAttribute(True)> _
Public Overridable Property OnClientVolumeChanged As String
Get
Set
'Usage
Dim instance As MediaPlayer
Dim value As String
value = instance.OnClientVolumeChanged
instance.OnClientVolumeChanged = value
[BindableAttribute(true)]
public virtual string OnClientVolumeChanged { get; set; }
Property Value
Type: System.String
The name of the JavaScript function that is called when the player volume is changed.
Remarks
The Sys.UI.Silverlight.MediaPlayer.volumeChanged client event occurs at runtime when the volume changes. This can occur if the user changes the volume on the media player control or if the volume change is done using a client script.
Examples
The following example demonstrates how to set the name of a JavaScript function to run when the client Sys.UI.Silverlight.MediaPlayer.volumeChanged event occurs. This code example is part of a larger example provided for the Sys.UI.Silverlight.MediaPlayer class.
The markup shows the OnClientVolumeChanged property on MediaPlayer server control indicating that volumeChanged is the name of the JavaScript function to run when a Sys.UI.Silverlight.MediaPlayer.volumeChanged client event occurs at runtime.
<asp:MediaPlayer ID="MediaPlayer1" runat="server" Height="300px" Width="400px"
OnClientChapterSelected="chapterSelected"
OnClientChapterStarted="chapterStarted"
OnClientCurrentStateChanged="currentStateChanged"
OnClientMarkerReached="markerReached"
OnClientMediaEnded="mediaEnded"
OnClientMediaFailed="mediaFailed"
OnClientMediaOpened="mediaOpened"
OnClientVolumeChanged="volumeChanged"
onPluginFullScreenChanged="fullScreenChanged"
MediaSource="../media/expressionstudio.wmv" AutoPlay="True"
MediaSkinSource="../skins/Professional.xaml">
<Chapters>
<asp:MediaChapter Position="5" Title="A New Start" ThumbnailSource="../images/Water lilies.jpg" />
<asp:MediaChapter Position="22" Title="More Things" ThumbnailSource="../images/Sunset.jpg"/>
<asp:MediaChapter Position="54" Title="Final Thoughts" ThumbnailSource="../images/Blue hills.jpg" />
</Chapters>
</asp:MediaPlayer>
<asp:MediaPlayer ID="MediaPlayer1" runat="server" Height="300px" Width="400px"
OnClientChapterSelected="chapterSelected"
OnClientChapterStarted="chapterStarted"
OnClientCurrentStateChanged="currentStateChanged"
OnClientMarkerReached="markerReached"
OnClientMediaEnded="mediaEnded"
OnClientMediaFailed="mediaFailed"
OnClientMediaOpened="mediaOpened"
OnClientVolumeChanged="volumeChanged"
onPluginFullScreenChanged="fullScreenChanged"
MediaSource="../media/expressionstudio.wmv" AutoPlay="True"
MediaSkinSource="../skins/Professional.xaml">
<Chapters>
<asp:MediaChapter Position="5" Title="A New Start" ThumbnailSource="../images/Water lilies.jpg" />
<asp:MediaChapter Position="22" Title="More Things" ThumbnailSource="../images/Sunset.jpg"/>
<asp:MediaChapter Position="54" Title="Final Thoughts" ThumbnailSource="../images/Blue hills.jpg" />
</Chapters>
</asp:MediaPlayer>
The client script shows the volumeChanged JavaScript function.
function volumeChanged(sender, args) {
var volume = sender.get_volume();
var textMessage = String.format("volumeChanged event: volume is now {0}", volume);
ta.innerText += '\r\n' + textMessage;
}
function volumeChanged(sender, args) {
var volume = sender.get_volume();
var textMessage = String.format("volumeChanged event: volume is now {0}", volume);
ta.innerText += '\r\n' + textMessage;
}
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.