全螢幕支援

FLVPlayback 組件的 ActionScript 3.0 版所支援的全螢幕模式需要使用 Flash Player 9.0.28.0 版或更新版本,同時也必須正確設定用於全螢幕檢視的 HTML。某些預先設計的外觀元素中含有可以切換全螢幕模式開和關的切換按鈕。FullScreenButton 圖示位於下列圖例的右側控制列。

控制列上的全螢幕圖示

只有當 fullScreenTakeOver 屬性設為 true (這是預設值) 時,才支援全螢幕。

無論是否支援硬體加速都能支援全螢幕。如需硬體加速支援的詳細資訊,請參閱 硬體加速

實作 FLVPlayback 全螢幕支援:

  1. 將 FLVPlayback 組件加入應用程式中,並為組件指定視訊檔。

  2. 為 FLVPlayback 組件選取一個具有全螢幕按鈕的外觀元素 (例如 SkinUnderPlaySeekFullscreen.swf),或從「組件」面板的「視訊」區段將 FullScreenButton 使用者介面組件加入到 FLVPlayback 組件。

  3. 選取「檔案 > 發佈設定」。

  4. 在「發佈設定」對話方塊中,按一下「HTML」索引標籤。

  5. 在「HTML」索引標籤上,從「範本」彈出式選單中選取「含有全螢幕支援的 Flash」。

  6. 同時,在「HTML」索引標籤上選取「偵測 Flash 版本」核取方塊,並依您所使用的 Flash Player 版本,指定 9.0.28 版或更新版本。

  7. 選取「格式」索引標籤,並確認已選取「Flash (.swf)」和「HTML (.html)」您可以置換預設的檔案名稱。

  8. 按一下「發佈」,然後按一下「確定」。

    您也可以略過步驟 7,直接按「確定」再選取「檔案 > 發佈預覽 > 預設 - (HTML)」,自動使用您的預設瀏覽器開啟匯出的 HTML 檔。若未略過該步驟,則請啟動您的瀏覽器並開啟匯出的 HTML 檔以測試全螢幕選項。

    如果要將支援全螢幕的 FLVPlayback 組件加入您的網頁,請開啟匯出的 HTML 檔,並將內嵌 SWF 檔的程式碼複製到網頁的 HTML 檔中。這段程式碼看起來會與下列範例類似:

    //from the <head> section 
     
    <script language="javascript"> AC_FL_RunContent = 0; </script>  
    <script language="javascript"> DetectFlashVer = 0; </script>  
    <script src="AC_RunActiveContent.js" language="javascript"></script> 
    <script language="JavaScript" type="text/javascript">  
    <!--  
    // -----------------------------------------------------------------------------  
    // Globals  
    // Major version of Flash required  
    var requiredMajorVersion = 9;  
    // Minor version of Flash required  
    var requiredMinorVersion = 0;  
    // Revision of Flash required  
    var requiredRevision = 28;  
    // -----------------------------------------------------------------------------  
    // -->  
    </script>  
     
    //and from the <body> section 
     
    <script language="JavaScript" type="text/javascript">  
    <!--  
    if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {  
        alert("This page requires AC_RunActiveContent.js.");  
    } else {  
        var hasRightVersion = DetectFlashVer(requiredMajorVersion, 
            requiredMinorVersion, requiredRevision);  
        if(hasRightVersion) { // if we&apos;ve detected an acceptable version  
            // embed the Flash movie  
            AC_FL_RunContent(  
                &apos;codebase&apos;, &apos;http://download.macromedia.com/pub/ 
                    shockwave/cabs/flash/swflash.cab#version=9,0,28,0&apos;,  
                &apos;width&apos;, &apos;550&apos;,  
                &apos;height&apos;, &apos;400&apos;, 
                &apos;src&apos;, &apos;fullscreen&apos;,  
                &apos;quality&apos;, &apos;high&apos;,  
                &apos;pluginspage&apos;, &apos;http://www.macromedia.com/go/ 
                    getflashplayer&apos;,  
                &apos;align&apos;, &apos;middle&apos;,  
                &apos;play&apos;, &apos;true&apos;,  
                &apos;loop&apos;, &apos;true&apos;,  
                &apos;scale&apos;, &apos;showall&apos;,  
                &apos;wmode&apos;, &apos;window&apos;,  
                &apos;devicefont&apos;, &apos;false&apos;,  
                &apos;id&apos;, &apos;fullscreen&apos;,  
                &apos;bgcolor&apos;, &apos;#ffffff&apos;,  
                &apos;name&apos;, &apos;fullscreen&apos;,  
                &apos;menu&apos;, &apos;true&apos;, 
                &apos;allowScriptAccess&apos;,&apos;sameDomain&apos;, 
                &apos;allowFullScreen&apos;,&apos;true&apos;,  
                &apos;movie&apos;, &apos;fullscreen&apos;,  
                &apos;salign&apos;, &apos;&apos; ); //end AC code  
        } else { // Flash is too old or we can&apos;t detect the plug-in.  
            var alternateContent = &apos;Alternative HTML content should be placed 
                    here.&apos;  
                + &apos;This content requires Adobe Flash Player.&apos;  
                + &apos;<a href=http://www.macromedia.com/go/getflash/>Get Flash</a> 
                        &apos;;  
            document.write(alternateContent); // Insert non-Flash content.  
        }  
    }  
    // -->  
    </script>  
    <noscript>  
        // Provide alternative content for browsers that do not support scripting  
        // or for those that have scripting disabled.  
        Alternative HTML content should be placed here. This content requires Adobe Flash Player.  
        <a href="http://www.macromedia.com/go/getflash/">Get Flash</a>  
    </noscript>

    或者,您也可以使用匯出的 HTML 檔當做網頁的範本,再自行加入其它內容。不過,如果您要這麼做,請記得更改 HTML 檔的名稱,以避免日後再次從 Flash 匯出 FLVPlayback HTML 檔時,意外地覆寫了該檔案。

    無論採用何種方式,您都必須將與 HTML 檔匯出至相同資料夾的 AC_RunActiveContent.js 檔一併上傳到網站伺服器。

    ActionScript 對全螢幕模式的支援包括 fullScreenBackgroundColor fullScreenSkinDelay fullScreenTakeOver 屬性以及 enterFullScreenDisplayState() 方法。如需有關這些 ActionScript 元素的詳細資訊,請參閱 適用於 Adobe Flash Platform 的 ActionScript 3.0 參考

使用 enterFullScreenDisplayState()

您也可以呼叫 ActionScript enterFullScreenDisplayState() 方法叫用全螢幕模式,如下列範例所示。

function handleClick(e:MouseEvent):void { 
    myFLVPlybk.enterFullScreenDisplayState(); 
} 
myButton.addEventListener(MouseEvent.CLICK, handleClick);

此範例「並非」透過按一下 FLVPlayback 外觀元素上的全螢幕切換按鈕叫用全螢幕模式,而是按一下網頁建立者所加入用來叫用全螢幕模式的 MyButton 按鈕。按一下該按鈕會觸發 handleClick 事件處理常式,進而呼叫 enterFullScreenDisplayState() 方法。

enterFullScreenDisplayState() 方法會將 Stage.displayState 屬性設定為 StageDisplayState.FULL_SCREEN ,因此與 displayState 屬性具有相同的限制。如需有關 enterFullScreenDisplayState() 方法和 Stage . displayState 屬性的詳細資訊,請參閱 適用於 Adobe Flash Platform 的 ActionScript 3.0 參考

硬體加速

Flash Player 9.0.115.0 及更新版本包含的程式碼可利用現有視訊硬體來改善 FLVPlayback 以全螢幕模式播放 FLV 檔的效能和真實度。只要符合先決條件且 fullScreenTakeOver 屬性是設定為 true ,Flash Player 就會使用硬體加速來縮放視訊檔,而非透過軟體進行縮放。如果 FLVPlayback 組件是在較早版本的 Flash Player 中執行,或者未能符合硬體加速的先決條件,Flash Player 則會沿用以往的作法,將視訊檔本身放大。

為了充分運用全螢幕支援下的硬體加速優點,您的電腦必須有相容於 DirectX 7 的視訊卡且 VRAM (視訊記憶體) 為 4 MB 以上。這類硬體支援適用於 Windows 2000 或 Mac OS X 10.2 及其後續版本的作業系統。Direct X® 所提供的 API 構成軟體與視訊硬體之間的介面,可對三維和二維圖像及其它物件進行加速處理。

若要利用硬體加速模式,您還必須透過下列任一方法叫用全螢幕模式:

  • 使用 FLVPlayback 外觀元素上的全螢幕切換按鈕

  • 使用 FullScreenButton 視訊控制項

  • 使用 ActionScript enterFullScreenDisplayState() 方法。如需詳細資訊,請參閱 使用 enterFullScreenDisplayState()

    如果您透過將 Stage.displayState 屬性設定為 StageDisplayState.FULLSCREEN 以叫用全螢幕模式,FLVPlayback 就不會使用硬體加速,即使視訊硬體和記憶體符合先決條件也一樣。

    使用全螢幕支援下的硬體加速時,會導致 FLVPlayback 外觀元素隨著視訊播放程式及視訊檔一起縮放。下圖顯示 FLVPlayback 外觀元素在全螢幕模式下搭配硬體加速的效果,此為佔滿整個螢幕解析度的細部畫面。

    在 1600 x 1200 監視器上以全螢幕模式顯示 320x240 像素視訊
    在 1600 x 1200 監視器上以全螢幕模式顯示 320x240 像素視訊

    這個影像顯示了在 1600 x 1200 的監視器上,使用全螢幕模式播放高度和寬度各為 320 和 240 (即 FLVPlayback 預設尺寸) 的視訊檔結果。如果換成尺寸較小的 FLV 檔或解析度較高的監視器,扭曲情形將更為顯著。反之,若將 FLV 檔的尺寸加大或縮減螢幕解析度,扭曲情形就不會那麼明顯。例如,從 640 x 480 變更為 1600 x 1200 依然會增加外觀元素的大小,卻可使視訊扭曲程度降低。

    您可以設定 skinScaleMaximum 屬性來限制 FLVPlayback 外觀元素的縮放。預設值為 4.0,也就是 400%。不過,限制外觀元素的縮放需要結合硬體和軟體縮放處理 FLV,可能會對採用高位元速率編碼的較大尺寸 FLV 效能產生不良的影響。如果是大型尺寸的視訊 (例如,寬度 640 像素以上,高度 480 像素以上),就不應該將 skinScaleMaximum 設定為較小的值,因為這樣可能導致在大型監視器上出現嚴重的效能問題。 skinScaleMaximum 屬性可讓您針對大型外觀元素的效能、品質和外觀做取捨,以求得三者之間的平衡。

結束全螢幕模式

若要結束全螢幕模式,請再按一次全螢幕按鈕或按 Esc 鍵。

設定下列屬性及呼叫下列方法可能造成版面變更,進而導致 FLVPLayback 組件結束全螢幕模式: height registrationHeight registrationWidth registrationX registrationY scaleX scaleY width x y setScale() setSize()

一旦您設定 align scaleMode 屬性,FLVPlayback 便會將其分別設定為 center maintainAspectRatio 直到結束全螢幕模式為止。

使用全螢幕時,若將 fullScreenTakeOver 屬性的值從 true 變更為 false ,硬體加速模式也會導致 Flash 結束全螢幕模式。