Is there a way to embed windows media player and control its parameters with PHP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • matheussousuke
    New Member
    • Sep 2009
    • 249

    Is there a way to embed windows media player and control its parameters with PHP?

    I spent about 3 weeks on this. First I tried WMP embedded, didnt work (active x issue), then JW PLayer, didnt work too, then Flow Player, then Jw wmv player silver light (Yehaa, it worked, parcialy...)

    It was 2 weeks to realize that flow player and jw player work with RTMP, but not with MMS video streams.

    So, my question is: Is there a way to embed windows media player and control its parameters with PHP?

    I mean, not active x controls, but pure php, along with java script, or something else that can be accepted by everybrowser.

    I dont know a thing of ASP, tried and tried with silverlight player, and it simply wont play the mms stream, someone told me that I should change the port on the server, and on the script. I dont have access to that kind of stuff (server config), and also, I have an ASX playlist with more than 800 itens, most of them works fine.

    Even if that's not windows media player, if anyone know at least a player that can play this stream mms://unitv.pucrs.br/UniTV on FireFox, or FF, or Safari, please, let me know.

    ty very much :)


    Ps: Note that the mms stream above works fine on Windows media player.
    Last edited by matheussousuke; Feb 9 '11, 09:16 PM. Reason: spelling
  • HaLo2FrEeEk
    Contributor
    • Feb 2007
    • 404

    #2
    If it's an activex issue then it's your browser, because PHP is aserver-size language, all it does is print the code to the page. Here's the HTML that you need:

    Code:
    <OBJECT classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="[WIDTH]" height="[HEIGHT]">
    <PARAM NAME="URL" VALUE="[URL GOES HERE]">
    <PARAM NAME="volume" VALUE="[VOLUME]">
    <embed src="[URL GOES HERE]" width="[WIDTH]" height="[HEIGHT]" volume="[VOLUME]"></embed>
    </OBJECT>
    PHP has nothing to do with it working or not, all it des it print the HTML to the page. I tested this code and it works.

    Oh, and yes, you WILL need to replace the values that I've put inside [] brackets (including the brackets themselves).

    Comment

    • matheussousuke
      New Member
      • Sep 2009
      • 249

      #3
      you're being of great help again, ty vm. :)

      Comment

      • matheussousuke
        New Member
        • Sep 2009
        • 249

        #4
        This one is fully working for me. :D
        By the way, is there a parameter that can show the playlist, so the user can choose wich item he will watch?

        Comment

        • matheussousuke
          New Member
          • Sep 2009
          • 249

          #5
          I found a script, configured it acording to the guide, but now, only the player works, the playlist wont show up.

          Code:
          <head>
          <script language="javascript1.2">
          function loadPlayItems() {
                  df=document.getElementById("playItem");
                  dp=document.getElementById("playlist");
                  WMP9=document.getElementById("MediaPlayer1");
          
          WMP9.url="http://tv.mghospedagem.com/jwp-silverlight/play.asx";
                  WMP9.controls.play();
          
          }
          
          function showPlayItems() {
                  WMP9=document.getElementById("MediaPlayer1");
                  playlistItems=WMP9.currentPlaylist.count;
                  for (i=0; i<playlistItems; i++) {
                          playitem=document.createElement("a");
                          playnext=document.createElement("br");
                          playitem.setAttribute("href","#");
                          playitem.setAttribute("onclick","playItem("+i+")");
                          playitem.innerText=WMP9.currentPlaylist.item(i).name;
                          dp.appendChild(playitem);
                          dp.appendChild(playnext);
                  }
                  playListLoaded=true;
                  WMP9.controls.stop();
          
          }
          
          function setPlayItem(index) {
                  WMP9=document.getElementById("MediaPlayer1");
                  playlistItems=WMP9.currentPlaylist.count;
                  if (playlistItems > 0) {
          
          WMP9.controls.currentItem=WMP9.currentPlaylist.item(index);
                          WMP9.controls.play();
                  }
          }
          
          </script></head>
          
          <body onLoad="loadPlayItems()">
          <object id="MediaPlayer1"
          classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"
          type="application/x-oleobject" width="600" height="400">
          <param name="autostart" value="0">
                  <param name="showcontrols" value="0">
                  <param name="uimode" value="full">
                  <param name="stretchtofit" value="1">
                  <param name="enablecontextmenu" value="0">
          </object>
          
          <div id="playlist" style="position: absolute; top: 10px; left:
          640px; visibility: visible;">
          <h2>Playlist</h2></div>
          
          <script language="javascript1.2" for="MediaPlayer1"
          event="playStateChange">
          WMP9=document.getElementById("MediaPlayer1");
          if (WMP9.playState==3 && ! playListLoaded) {
                  showPlayItems();
          }
          
          </script>

          You can see the page here http://tv.mghospedagem.com/wmp-plBYTES.html
          Ps: only work for IE.

          And here is where I got the code from https://groups.google.com/group/micr...a]&hl=en&pli=1

          Comment

          • HaLo2FrEeEk
            Contributor
            • Feb 2007
            • 404

            #6
            Dude, this is Javascript, not PHP. This is a PHP forum, you'll need to ask one of the mods to move it to the Javascript forum. Please make sure you're posting in the proper forum next time.

            Comment

            • matheussousuke
              New Member
              • Sep 2009
              • 249

              #7
              Omg, I really sorry, didnt notice that.

              gomenasai >.<

              Comment

              • matheussousuke
                New Member
                • Sep 2009
                • 249

                #8
                What if I open a new thread in javascript section and come here and put a link to it?

                Comment

                Working...