Share via


Silverlight.OnPluginFullScreenChanged Property

Gets or sets the name of the client JavaScript function (event handler) that is called when full-screen mode is toggled.

Namespace:  System.Web.UI.SilverlightControls
Assembly:  System.Web.Silverlight (in System.Web.Silverlight.dll)

Syntax

'Declaration
<BindableAttribute(True)> _
Public Overridable Property OnPluginFullScreenChanged As String
    Get
    Set
'Usage
Dim instance As Silverlight
Dim value As String

value = instance.OnPluginFullScreenChanged

instance.OnPluginFullScreenChanged = value
[BindableAttribute(true)]
public virtual string OnPluginFullScreenChanged { get; set; }

Property Value

Type: System.String
The name of the JavaScript function that is called when full-screen mode is toggled.

Remarks

The Sys.UI.Silverlight.Control.pluginFullScreenChanged client event occurs at runtime when the plug-in toggles to or from full-screen mode.

Note

You cannot programmatically set the Silverlight content to full-screen mode; this can only be done by the user at runtime.

Examples

The following example shows client script called when full screen mode changes during playback of a media file. This code example is part of a larger example provided for the MediaPlayer server control.

The markup shows the value of the OnPluginFullScreenChanged property that the MediaPlayer server control inherits from the Silverlight server control indicating that fullScreenChanged is the name of the JavaScript function to run when a Sys.UI.Silverlight.Control.pluginFullScreenChanged 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 fullScreenChanged JavaScript function.

function fullScreenChanged(sender, args) {
    var currentPosition = sender.get_position();
    textMessage = String.format("fullScreenChanged event: position {0} seconds", currentPosition);
    ta.innerText +=  '\r\n' + textMessage;
}
function fullScreenChanged(sender, args) {
    var currentPosition = sender.get_position();
    textMessage = String.format("fullScreenChanged event: position {0} seconds", currentPosition);
    ta.innerText +=  '\r\n' + textMessage;
}
<%@ Page Language="C#"%>
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
    TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="https://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Display MediaPlayer client events</title>
</head>
<body>
    <form id="form1" runat="server">
    <script type="text/javascript">
        var ta;

        function pageLoad(sender, args) {
            ta = $get('textarea1');
        }
        function chapterSelected(sender, args) {
            var chapter = args.get_chapter();
            if (chapter)
            {
                var title = chapter.get_title();
                var textMessage = String.format("chapterSelected event: title '{0}'", title);
                ta.innerText +=  '\r\n' + textMessage;
            } 
        } 
        function chapterStarted(sender, args) {
            var chapter = args.get_chapter();
            if (chapter)
            {
                var title = chapter.get_title();
                var textMessage = String.format("chapterStarted event: title '{0}'", title);
                ta.innerText +=  '\r\n' + textMessage;
            }
        } 
        function currentStateChanged(sender, args) { 
            var state = sender.get_currentState();
            var textMessage = String.format("currentStateChanged event: state '{0}'", state); 
            ta.innerText += '\r\n' + textMessage;
        }  
        function markerReached(sender, args) {
            var marker = args.get_marker();
            try {
                var markerText = marker.type;
            }
            catch(e) {
                var markerText = "unknown marker type";
            }

            var currentPosition = sender.get_position();
            var textMessage = String.format("markerReached event: '{0}' at {1} seconds", markerText, currentPosition);
            ta.innerText +=  '\r\n' + textMessage;
        }        
        function mediaEnded(sender, args) {
            var currentPosition = sender.get_position();
            var textMessage = String.format("mediaEnded event: position {0} seconds", currentPosition);
            ta.innerText += '\r\n' + textMessage;
        }        
        function mediaFailed(sender, args) {
            var currentPosition = sender.get_position();
            var textMessage = String.format("mediaFailed event: position {0} seconds", currentPosition);
            ta.innerText +=  '\r\n' + textMessage;
        }        
        function mediaOpened(sender, args) {
            var currentPosition = sender.get_position();
            var textMessage = String.format("mediaOpened event: position {0} seconds", currentPosition);
            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;
        }
        function fullScreenChanged(sender, args) {
            var currentPosition = sender.get_position();
            textMessage = String.format("fullScreenChanged event: position {0} seconds", currentPosition);
            ta.innerText +=  '\r\n' + textMessage;
        }
    </script>

    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <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>
        <br />
        <h3>Script functions called for client-side events</h3>
        <textarea id="textarea1" cols="70" rows="15"></textarea>
    </div>
    </form>
</body>
</html>

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Silverlight Class

Silverlight Members

System.Web.UI.SilverlightControls Namespace

Other Resources

Sys.UI.Silverlight.Control.onPluginFullScreenChanged Method

Sys.UI.Silverlight.Control.pluginFullScreenChanged Event