embedded WMP, button to play in full screen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • craig

    #1

    embedded WMP, button to play in full screen

    i want to make a button that will start an embedded windows media
    player playing AND in full screen. i can do it with TWO buttons:

    <input
    onclick="MediaP layer.controls. play();"
    type="button"
    size="22"
    value="Play">

    <INPUT type = "button"
    value = "Full Screen"
    name = BUTTON
    onclick = "if (MediaPlayer.pl ayState == 3)
    MediaPlayer.ful lScreen = 'true';">

    but i would like to be able to combine this into ONE button. seems
    simple enough but after a week of experimenting, i just can't figure
    it out.

    thanks,
    craig
  • Michael Winter

    #2
    Re: embedded WMP, button to play in full screen

    craig wrote on 14 Dec 2003 at Sun, 14 Dec 2003 00:59:17 GMT:
    [color=blue]
    > i want to make a button that will start an embedded windows
    > media player playing AND in full screen. i can do it with TWO
    > buttons:
    >
    > <input
    > onclick="MediaP layer.controls. play();"
    > type="button"
    > size="22"
    > value="Play">
    >
    > <INPUT type = "button"
    > value = "Full Screen"
    > name = BUTTON
    > onclick = "if (MediaPlayer.pl ayState == 3)
    > MediaPlayer.ful lScreen = 'true';">
    >
    > but i would like to be able to combine this into ONE button.[/color]

    In the document HEAD, add this:

    <SCRIPT type="text/javascript">
    function playFullscreen( ) {
    if (3 == MediaPlayer.pla yState) {
    MediaPlayer.ful lscreen = 'true';
    }
    MediaPlayer.con trols.play();
    }
    </SCRIPT>

    ...and this BUTTON to your document:

    <BUTTON type="button" onclick="playFu llscreen()"[color=blue]
    >Play fullscreen</BUTTON>[/color]

    I can't test this, but there should be no reason why it won't work.

    What is 3 as a value of MediaPlayer.pla yState? Does it impact whether
    the video should be played, or only if it can or can't be changed to
    fullscreen. Does the video need to be playing before it's changed to
    fullscreen, or should the fullscreen happen first? You'll have to
    decide, based on the answers to those questions, whether the play()
    call should be inside the if statement, before it, or after it.

    Hope that helps,

    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk")

    Comment

    • craig

      #3
      Re: embedded WMP, button to play in full screen

      thanks for the reply michael. i am contacting you directly via email.
      your solution apparently only works if the button is pressed twice,
      which does get me closer than before but it also makes me think the
      real solution is simple and close. if anyone else has any ideas
      please post them here. as soon as i get a solution i will post it
      here and hopefully it will help someone else in the future.

      craig

      Comment

      • craig

        #4
        Re: embedded WMP, button to play in full screen

        thanks to mike, I GOT IT. the following code in the header:

        <SCRIPT type="text/javascript">
        var stateTimer = null;

        function playFullscreen( ) {
        // Check if the video is playing. If it is, change
        // to fullscreen. If not, start checking to see when
        // it is.
        if (3 == MediaPlayer.pla yState) {
        MediaPlayer.ful lscreen = 'true';
        } else {
        MediaPlayer.con trols.play();
        if (!stateTimer) stateTimer =
        window.setInter val( checkState, 500 );
        }
        }

        function checkState() {
        // Check periodically to see if the video has
        // started. If so, destroy the timer and change to
        // fullscreen
        if (3 == MediaPlayer.pla yState) {
        window.clearInt erval( stateTimer );
        stateTimer = null;
        MediaPlayer.ful lscreen = 'true';
        }
        }
        </SCRIPT>

        and the following in the body:

        <BUTTON type="button" onclick="playFu llscreen()"[color=blue]
        >Play fullscreen</BUTTON>[/color]

        did the trick! thanks mike, you're a true guru.

        craig

        Comment

        Working...