Embedding Windows Media Player for all browsers

前端 未结 9 486
盖世英雄少女心
盖世英雄少女心 2020-12-01 03:55

We are using WMV videos on an internal site, and we are embedding them into web sites. This works quite well on Internet Explorer, but not on Firefox. I\'ve found ways to ma

相关标签:
9条回答
  • 2020-12-01 04:52

    Use the following. It works in Firefox and Internet Explorer.

            <object id="MediaPlayer1" width="690" height="500" 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..." type="application/x-oleobject"
                >
                <param name="FileName" value='<%= GetSource() %>' />
                <param name="AutoStart" value="True" />
                <param name="DefaultFrame" value="mainFrame" />
                <param name="ShowStatusBar" value="0" />
                <param name="ShowPositionControls" value="0" />
                <param name="showcontrols" value="0" />
                <param name="ShowAudioControls" value="0" />
                <param name="ShowTracker" value="0" />
                <param name="EnablePositionControls" value="0" />
    
    
                <!-- BEGIN PLUG-IN HTML FOR FIREFOX-->
                <embed  type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
                    src='<%= GetSource() %>' align="middle" width="600" height="500" defaultframe="rightFrame"
                     id="MediaPlayer2" />
    

    And in JavaScript,

        function playVideo() {
            try{
                    if(-1 != navigator.userAgent.indexOf("MSIE"))
                    {
                            var obj = document.getElementById("MediaPlayer1");
                                obj.Play();
    
                    }
                    else
                    {
                                var player = document.getElementById("MediaPlayer2");
                                player.controls.play();
    
                    }
                 }  
            catch(error) {
                alert(error)
            } 
    
    
            }
    
    0 讨论(0)
  • 2020-12-01 04:55

    The best way to deploy video on the web is using Flash - it's much easier to embed cleanly into a web page and will play on more or less any browser and platform combination. The only reason to use Windows Media Player is if you're streaming content and you need extraordinarily strong digital rights management, and even then providers are now starting to use Flash even for these. See BBC's iPlayer for a superb example.

    I would suggest that you switch to Flash even for internal use. You never know who is going to need to access it in the future, and this will give you the best possible future compatibility.

    EDIT - March 20 2013. Interesting how these old questions resurface from time to time! How different the world is today and how dated this all seems. I would not recommend a Flash only route today by any means - best practice these days would probably be to use HTML 5 to embed H264 encoded video, with a Flash fallback as described here: http://diveintohtml5.info/video.html

    0 讨论(0)
  • 2020-12-01 04:55

    I have found something that Actually works in both FireFox and IE, on Elizabeth Castro's site (thanks to the link on this site) - I have tried all other versions here, but could not make them work in both the browsers

    <object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" 
      id="player" width="320" height="260">
      <param name="url" 
        value="http://www.sarahsnotecards.com/catalunyalive/fishstore.wmv" />
      <param name="src" 
        value="http://www.sarahsnotecards.com/catalunyalive/fishstore.wmv" />
      <param name="showcontrols" value="true" />
      <param name="autostart" value="true" />
      <!--[if !IE]>-->
      <object type="video/x-ms-wmv" 
        data="http://www.sarahsnotecards.com/catalunyalive/fishstore.wmv" 
        width="320" height="260">
        <param name="src" 
          value="http://www.sarahsnotecards.com/catalunyalive/fishstore.wmv" />
        <param name="autostart" value="true" />
        <param name="controller" value="true" />
      </object>
      <!--<![endif]-->
    </object>
    

    Check her site out: http://www.alistapart.com/articles/byebyeembed/ and the version with the classid in the initial object tag

    0 讨论(0)
提交回复
热议问题