CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2008
    Location
    The Netherlands
    Posts
    22

    Emmbed Windows media player Firefox

    Hello Codeguru's,

    I copyed this piece of code to generate a emmbed windows media player with a streaming video straight from a webpage.

    Now when i paste this in a HTML document and i open it in IE, the emmbed player works fine. But when i open the HTML document in Firefox then the player doesn't appear at all. Even when i copy the whole sourcecode of the original webpage with the emmbed player on it, it still doesn't work in Firefox. Can anyone explain me why?.
    Thanks.

    Tim
    Code:
    <!--Window media Player -->
    <script language="javascript" type="text/javascript">
       var _app = navigator.appName;
         if (_app == 'Microsoft Internet Explorer') 
         {
            document.write('<object id="Player" width="360" height="335" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" STANDBY="Loading Microsoft Windows Media Player components...">'+
           '<param name="Filename" value="http://streams.planet.nl/cgi-bin/reflector.cgi?stream=encoder11">'+
           '<param name="AutoStart" value="True">'+
           '<param name="ShowControls" value="True">'+
           '<param name="ShowStatusBar" value="True">'+
           '<param name="ShowDisplay" value="False">'+
           '<param name="AutoRewind" value="True">'+
           '<param name="StretchToFit" value="False">'+
           '<param name="UIMode" value="full">'+
           '<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/" width="360" height="335" src="reflector.asx?stream=http%3A%2F%2Fstreams.planet.nl%2Fcgi-bin%2Freflector.cgi%3Fstream%3Dencoder11%26wm9%3Dtrue%26title%3Dwww.nostalgienet.nl" filename="reflector.asx?stream=http%3A%2F%2Fstreams.planet.nl%2Fcgi-bin%2Freflector.cgi%3Fstream%3Dencoder11%26wm9%3Dtrue%26title%3Dwww.nostalgienet.nl" autostart="True" showcontrols="True" showstatusbar="1" showdisplay="False" autorewind="True" stretchtofit="0" uimode="full"></embed> '+
        '</OBJECT>');
         }        
         else
         {
         document.write('<embed type="application/x-mplayer2"'+
         ' width="360"'+ 
         ' height="335"'+
         ' autostart="True"'+
         ' showcontrols="True"'+
         ' showstatusbar="1"'+
         ' showdisplay="False"'+
         ' autorewind="True"'+
         ' stretchtofit="0"'+
         ' uimode="full"'+
         ' src="reflector.asx?stream=http%3A%2F%2Fstreams.planet.nl%2Fcgi-bin%2Freflector.cgi%3Fstream%3Dencoder11%26wm9%3Dtrue%26title%3Dwww.nostalgienet.nl"'+
         ' filename="http://streams.planet.nl/cgi-bin/reflector.cgi?stream=encoder11"'+   
         ' pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/">'+
         '</embed>');       
         }
    </script>       
    <!-- End Window media Player -->
    Last edited by PeejAvery; September 2nd, 2008 at 09:10 AM. Reason: Fixed the ridiculous code tabbing.

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Emmbed Windows media player Firefox

    The embedding is what is failing. You should extract the <embed> tag and work only on that in Firefox. Then, after you have isolated why the <embed> is not working, put it back into the if statement.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Sep 2008
    Location
    The Netherlands
    Posts
    22

    Re: Emmbed Windows media player Firefox

    Thanks, but i have already tried that. The funny thing is, is that the exact same code does work with firefox because when i view the emmbed player on the site where i took the script from then it does work but when i copy the script and run i local, then the script only works in IE and not in Firefox.

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Emmbed Windows media player Firefox

    Quote Originally Posted by TimothyH
    then the script only works in IE and not in Firefox.
    No. The script does work in Firefox. If you put an alert() in the else clause, you will see that it does fire. However, something about the embedding is not.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Sep 2008
    Location
    The Netherlands
    Posts
    22

    Re: Emmbed Windows media player Firefox

    There should be nothing wrong with the embed code because i copeyd it direcly from a webpage. Also there are no syntax error's in the code. The weird thing is that its a direct copy and it doesn't work... and on the online page it does work.

  6. #6
    Join Date
    Sep 2008
    Location
    The Netherlands
    Posts
    22

    Solution!

    Yay, i've found the solution. I replaced the <embed> element with a <object> element in the code that is executed in firefox, now it works fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured