適用於 Adobe® Flash® Platform 的 ActionScript® 3.0 參考
首頁  |  隱藏套件和類別清單 |  套件  |  類別  |  新增內容  |  索引  |  附錄  |  為什麼顯示英文?
篩選: 從伺服器擷取資料...
從伺服器擷取資料...
org.osmf.net 

NetLoader  - AS3 OSMF

套件org.osmf.net
類別public class NetLoader
繼承NetLoader Inheritance LoaderBase Inheritance EventDispatcher Inheritance Object
子類別 HTTPStreamingNetLoader, MulticastNetLoader, RTMPDynamicStreamingNetLoader

語言版本: ActionScript 3.0
產品版本: OSMF 1.0
執行階段版本: Flash Player 10, AIR 1.5

The NetLoader class extends LoaderBase to provide loading support to the AudioElement and VideoElement classes.

Supports both streaming and progressive media resources. If the resource URL is RTMP, connects to an RTMP server by invoking a NetConnectionFactoryBase. NetConnections may be shared between LoadTrait instances. If the resource URL is HTTP, performs a connect(null) for progressive downloads.

The NetLoader supports Flash Media Token Authentication, for passing authentication tokens through the NetConnection.

檢視範例



公用屬性
 屬性定義自
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
  reconnectTimeout : Number
The stream reconnect timeout in milliseconds.
NetLoader
公用方法
 方法定義自
  
Constructor.
NetLoader
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。
EventDispatcher
 Inherited
Indicates whether this loader is capable of handling (loading) the given MediaResourceBase.
LoaderBase
 Inherited
會將事件傳送到事件流程。
EventDispatcher
 Inherited
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。
EventDispatcher
 Inherited
指出物件是否有已定義的指定屬性。
Object
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
 Inherited
Loads the specified LoadTrait.
LoaderBase
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
會從 EventDispatcher 物件移除偵聽程式。
EventDispatcher
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
 Inherited
會傳回指定之物件的字串形式。
Object
 Inherited
Unloads the specified LoadTrait.
LoaderBase
 Inherited
會傳回指定之物件的基本值。
Object
 Inherited
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。
EventDispatcher
保護方法
 方法定義自
  
The factory function for creating a NetStream.
NetLoader
  
The factory function for creating a NetStreamSwitchManagerBase.
NetLoader
 Inherited
Executes the load of the given LoadTrait.
LoaderBase
 Inherited
Executes the unload of the given LoadTrait.
LoaderBase
  
reconnect(netConnection:NetConnection, resource:URLResource):void
Attempts to reconnect the specified NetConnection to the specified URL.
NetLoader
 Inherited
Updates the given LoadTrait with the given info, and dispatches the state change event if necessary.
LoaderBase
事件
 事件 摘要 定義自
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。EventDispatcher
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。EventDispatcher
 InheritedDispatched when the state of a LoadTrait being loaded or unloaded by the LoaderBase has changed.LoaderBase
屬性詳細資訊

reconnectTimeout

屬性
reconnectTimeout:Number

The stream reconnect timeout in milliseconds.

The NetLoader will give up trying to reconnect the stream if a successful reconnect does not occur within this time period. The default is 120 seconds. For unpaused streams, the timeout period begins when the buffer empties and therefore a value of zero seconds is valid, meaning after the buffer empties, don't try to reconnect. For paused streams, the timeout period begins immediately.



實作
    public function get reconnectTimeout():Number
    public function set reconnectTimeout(value:Number):void

擲回值
ArgumentError — If value param is less than zero.
建構函式詳細資料

NetLoader

()建構函式
public function NetLoader(factory:NetConnectionFactoryBase = null)

語言版本: ActionScript 3.0
產品版本: OSMF 1.0
執行階段版本: Flash Player 10, AIR 1.5

Constructor.

參數
factory:NetConnectionFactoryBase (default = null) — The NetConnectionFactoryBase instance to use for managing NetConnections. If factory is null, a NetConnectionFactory will be created and used. Since the NetConnectionFactory class facilitates connection sharing, this is an easy way of enabling global sharing, by creating a single NetConnectionFactory instance within the player and then handing it to all NetLoader instances.
方法詳細資訊

createNetStream

()方法
protected function createNetStream(connection:NetConnection, resource:URLResource):NetStream

The factory function for creating a NetStream.

參數

connection:NetConnection — The NetConnection to associate with the new NetStream.
 
resource:URLResource — The resource whose content will be played in the NetStream.

傳回值
NetStream — A new NetStream associated with the NetConnection.

createNetStreamSwitchManager

()方法 
protected function createNetStreamSwitchManager(connection:NetConnection, netStream:NetStream, dsResource:DynamicStreamingResource):NetStreamSwitchManagerBase

The factory function for creating a NetStreamSwitchManagerBase.

參數

connection:NetConnection — The NetConnection that's associated with the NetStreamSwitchManagerBase.
 
netStream:NetStream — The NetStream upon which the NetStreamSwitchManagerBase will operate.
 
dsResource:DynamicStreamingResource — The resource upon which the NetStreamSwitchManagerBase will operate.

傳回值
NetStreamSwitchManagerBase — The NetStreamSwitchManagerBase for the NetStream, null if multi-bitrate switching is not enabled for the NetStream.

reconnect

()方法 
protected function reconnect(netConnection:NetConnection, resource:URLResource):void

Attempts to reconnect the specified NetConnection to the specified URL.

Clients can override this method to provide custom NetConnection behavior when using the stream reconnect feature. For example, if you wanted to provide client-side load balancing in your player, you could create a custom NetLoader class and override this method to use an alternate URI.

參數

netConnection:NetConnection — The new NetConnection created by the stream reconnect logic.
 
resource:URLResource — The URLResource that was originally used to play the media.

NetLoaderExample.as

package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    
    import org.osmf.elements.VideoElement;
    import org.osmf.media.MediaPlayerSprite;
    import org.osmf.media.URLResource;
    import org.osmf.net.NetLoader;
    
    public class NetLoaderExample extends Sprite
    {
        public function NetLoaderExample()
        {
            super();
            
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            
            var mediaPlayerSprite:MediaPlayerSprite = new MediaPlayerSprite();
            var netLoader:NetLoader = new NetLoader();
            var urlResource:URLResource = new URLResource("rtmp://cp67126.edgefcs.net/ondemand/mediapm/strobe/content/test/SpaceAloneHD_sounas_640_500_short");
            var videoElement:VideoElement = new VideoElement(urlResource, netLoader);
            
            addChild(mediaPlayerSprite);
            mediaPlayerSprite.media = videoElement;    
        }    
    }
} 




[ X ]為什麼顯示英文?
「ActionScript 3.0 參考」的內容是以英文顯示

並非所有「ActionScript 3.0 參考」的內容都翻譯為所有語言。當語言元素未翻譯時,就會以英文顯示。例如,ga.controls.HelpBox 類別並沒有翻譯為任何語言。因此在參考的繁體中文版本中,ga.controls.HelpBox 類別就會以英文顯示。