Chrome的问题 - 嵌入Windows媒体播放器

时间:2009-08-04 14:52:07

标签: google-chrome wmp

我遇到了问题。我在页面中嵌入了WMP,我需要隐藏播放器中的按钮。我让它隐藏在IE和FF中,但我无法在谷歌浏览器中实现它。 这是代码

        <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" />



        </object>

在JS中用我做的方法

                        var player = document.getElementById("MediaPlayer2");
            player.uiMode="none";

隐藏FF中的按钮,但似乎对Chrome不起作用。

2 个答案:

答案 0 :(得分:5)

完全交叉浏览器:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Script-Type" content="text/javascript">   
    <title></title>

</head>

<body>

    <table border="0" width="600" height="500" cellpadding="0" cellspacing="0">
        <tr>
            <td width="500" height="500">
                <!--[if !IE]> <-->
                    <object id="mediaplayer" type="application/x-ms-wmp" data="video.wmv" width="500" height="500">
                        <param name="src" value="video.wmv" valuetype="ref" type="video.wmv">
                        <param name="animationatStart" value="1">
                        <param name="transparentatStart" value="1">
                        <param name="autoStart" value="1">
                        <param name="ShowControls" value="0">
                        <param name="ShowDisplay" value="0">
                        <param name="ShowStatusBar" value="0">
                        <param name="playcount" value="10">
                        <param name="autoRewind" value="1">
                        <param name="displaysize" value="0">
                        <param name="stretchtofit" value="1">
                        <param name="enableContextMenu" value="0">
                        <param name="uiMode" value="none">
                        <strong>Error:</strong>You need <a href="http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx">Windows Media Player Plugin</a>.
                    </object>
                <!--> <![endif]-->
                <!--[if IE]>
                    <object id="mediaplayer" type="video/x-ms-wmv" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" width="500" height="500">
                        <param name="url" value="video.wmv" valuetype="ref" type="video/x-ms-wmv">
                        <param name="animationatStart" value="1">
                        <param name="transparentatStart" value="1">
                        <param name="autoStart" value="1">
                        <param name="ShowControls" value="0">
                        <param name="ShowDisplay" value="0">
                        <param name="ShowStatusBar" value="0">
                        <param name="playcount" value="99999">
                        <param name="clickToPlay" value="1">
                         <param name="autoRewind" value="1">
                        <param name="displaysize" value="0">
                        <param name="stretchtofit" value="1">
                        <param name="enableContextMenu" value="0">
                        <param name="uiMode" value="none">
                        <strong>Error:</strong>You need <a href="http://www.microsoft.com/windows/windowsmedia/download/plugin.aspx">Windows Media Player Plugin</a>.
                    </object>
                <![endif]-->
            </td>
            <td>
                <input type="button" value="uiMode Full" onclick="document.getElementById('mediaplayer').uiMode='full'">
                <input type="button" value="uiMode None" onclick="document.getElementById('mediaplayer').uiMode='none'">
            </td>
        </tr>
    </table>

</body>
</html>

答案 1 :(得分:0)

Windows Media Player插件本身不能在chrome中使用。 Chrome基于Safari,所以如果你能找到一个safari插件,你应该可以在chrome中使用它。否则,您将无法播放chrome中的wmp视频。