How do you control FOggPlayer with JS?

Help
2012-12-23
2013-04-24
  • Peter Coester
    Peter Coester
    2012-12-23

    Below is what I tried. The buttons worked, but the JS below did not. Why is that?

    <html>
      <head>
        <title>FOggPlayer</title>
        <script type="text/javascript" src="../../jquery.min.js"></script>
      </head>
      <body bgcolor="#dddddd">
        <object width="350"
            height="21"
            id="player"
            classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
          <param name="movie"
             value="FOggPlayer.swf?url=test.ogg&title=Test&start=false&volume=75&external=true">
            <param name="allowScriptAccess" value="always" />
          <embed src="FOggPlayer.swf?url=test.ogg&title=Test&start=false&volume=75&external=true"
             name="player"
             width="350"
             height="21"
             type="application/x-shockwave-flash">
          </embed>
        </object>
        <br>
        <button type="button" onclick="player.start(null)">Start</button>
        <button type="button" onclick="player.pause(null)">Pause</button>
        <button type="button" onclick="player.cease(null)">Stop</button>
        <br>
        Volume: <input type="text" value="75" size="6"
               onchange="player.volume(value)"> (0-100)
        <script type="text/javascript">
          $(function () {
            var player = player || document.getElementById('player') ||
              (document.getElementsByName('player') && document.getElementsByName('player')[0]);
            if (!$.isFunction(player.start)) {
              console.log('bummer');
            }
          });
        </script>
      </body>
    </html>