Pause\Play on 1 button on my popup menu

I have a popup that I want to have 1 button that is "pause" when he movie is playing but after pressed it turns into a play button...I know how to animate its state so that it shows "play\pause" graphics but in my script I need to know a good if\then command for this button.

Case "menu_1"

player.playlist.pause();

thats what it is right now and it pauses the video and switches to the "play" graphic for the button...just need a good if\then script for Case "menu_1"

Thanx in advance!



Answer this question

Pause\Play on 1 button on my popup menu

  • Mark Marquis

    This is interesting. I could not get it to work though. Anyone have a small example


  • MukilanP

    Peter Torr - MSFT wrote:
    Section 7.5.2.4.1 will point you to Annex W.2-1 (and some other tables).
    That makes things so much easier. Thanks.

  • Christopher Lusardi

    Section 7.5.2.4.1 will point you to Annex W.2-1 (and some other tables).

    Note that some XPaths are set at the time the page was loaded (ie, won't change) and others are set every tick (so will change).



  • jepptje

    Using $playState for switching graphics does sound like a better way, can anyone give an example (got no specs)

     BTW. if you want to use script just catch the pause, 0xB3, button that should solve the issue when a user presses pause.


  • kadabba

    thanks!
  • elainel311

    if

    [HD-DVD)) Fails}

    else if

    {you are frustrated}

    Post.document.forums=PETER TORR


  • dougknows

    Or without the use of a variable:

    function pauseHandler()

    {
        try
        {
            if (Player.playlist.playState == Player.playlist.PLAYSTATE_PAUSE)
            {
                Player.playlist.play();
            }
            else
            {
                Player.playlist.pause();
            }
        }
        catch (err) {}
    }

  • Hooper

    <cue begin="($playState=1)" end="($playState!=1)" select="id('playPauseButton')">
    <
    set style:backgroundColor="blue"/>
    </
    cue>

    <cue begin="($playState=2)" end="($playState!=2)" select="id('playPauseButton')">
    <
    set style:backgroundColor="red"/>
    </
    cue>



  • EtherealSky

    Very cool...I will check that tomorrow.


  • Ultrawhack

    Interesting. Peter, is there a list of all player properties usable through XPath variables somewhere in the spec
    I cannot remember seeing something like this...

    Cheers,
    Gunnar

  • atec

    I dont know what I would do without the forums!

    Thanks guys


  • TRID

    Also I would recommend NOT changing the graphic when the button is pressed, since that won't work if the user presses the pause key manually. Rather, I would trigger the graphic change based on the playstate changing; you can do that in the markup by referencing the $playState XPath variable.



  • RMooreFL

    This code doesn't seem to work on the sonic emulator unfortunately but it does work on the ihdsim.
  • Steve from adzac

    I've used this:

    var playing=1;  //put this line outside of function

          if(playing==1){
             Player.playlist.pause();
             playing=0;
          }else{
             Player.playlist.play();
             playing=1;
           }


  • Pause\Play on 1 button on my popup menu