These days are studying flashcom's MP3 library. Flashcom, I am more unfamiliar. I spent a day and a half, I spent a video recording. I didn't put the speaker in the studio. I saved the speaker. I didn't hear the machine's voice for more than a year. I know very little on this aspect of the audio. I am very grateful here. I am very grateful to the selfless help of the cloud. Look at the streaming media package of the Macromedia media component, I feel that it is quite big, the following analysis It is a subclass of NetConnection based on the RTMP protocol. In the MX.Controls.streamingMedia package.
Pre {Font-Family: "Courier New", Courier, Arial; font-size: 12px;}
. galan {color: # 000000;
. readyword {color: # 993300;
.IDENTIFIER {color: # 000087;
.properties {color: # 000087;
{Color: # 000087;
.linecomment, .bockcomment {color: # 808080;
. String {color: # 0000ff;}
// ******************************************************** *****************************
// CopyRight (C) 2003 Macromedia, Inc. All Rights Reserved.
// the folowing is sample code and is subject to all restrictions on
// Such code as contained in the end user license agreement acid ACCompanying
// this product.
// ******************************************************** *****************************
Import mx.controls.streamingmedia.rtmpplayer;
Import mx.controls.streamingmedia.tracer; // Do debugging Trace
/ **
* A Subclass of NetConnection That Is Tailored to Work with The RTMPPLAYER
* Class.
* A subclass of a NetConnection class specifically customized for RTMPPLAYER
* @Author stephen Cheng
* /
Class mx.controls.streamingmedia.rtmpConnection
Extends NetConnection
{
/ ** Flag to indeady in connect (). ONLY One Thread
* at a Time should be in this function.
* Tags have a thread in connection, only one thread connection at the same time
* /
Static var _ConnectFlag: boolean;
/ ** Array of queued rtmpplayers, awaiting their turn to call connect (). * /
// RTMPPLAYERS queue (actually an array of RTMPConnection), waiting for connection
Static var _connectorqueue: array = new array ();
Private var _targeturi: string; // Target resource location
Private var _streamname: String; // Name
Private var _player: RTMPPLAYER; // Running RTMPPLAYER instance
// Constructor, parameter is an instance of RTMPPLAYER PUBLIC FUNCTION RTMPCONNECTION (Player: RTMPPLAYER)
{
_Player = Player;
}
// When the metadata is coming from Flash Communication Server
// Player sets the total play time from the server from the server
Public Function OnmeTadata (Info)
{
_Player.Settottottime (Info.duration);
}
/ * ONLY One Thread Can Be in this function at a time.
* Only one thread can use this connection function at the same time
* /
Public Function Connect (Targeturi: String, StreamName: String): Void
{
// If there is already a thread is being connected
// put this connection into the waiting queue
/ / Return
IF (_ConnectFlag == True)
{
PushConnection (targeturi, streamname);
Return;
}
// If there is no existence, set the connection tag to true
/ / Then connect the target
_ConnectFlag = true;
Super.Connect (Targeturi, StreamName);
// From the queue after the current connection is executed
/ / Pop up the most recently pressed RTMPConnection instance, and perform the connection
PopConnection ();
}
Private function pushconnection (targeturi: string, streamname: string): Void
{
// Pressed queue
_targeturi = targeturi;
_StreamName = streamname;
// queue the connection attempt and return lat
_ConnectorQueue.push (this);
}
/ / Pop up the most recently pressed RTMPConnection instance, and perform the connection
Private function popconnection (): void
{
_ConnectFlag = false;
IF (_Connectorqueue.Length! = 0)
{
VAR poppedConnection: RTMPConnection = RTMPCONNECTION (_Connectorqueue.POP ());
PoppedConnection.connect (PoppedConnection._targeturi, PoppedConnection._StreamName);
}
}
}
The connection queue is not as good as a queue. This makes the connection become advanced, this is not very good. If the POP comes out, the RTMPConNtion connection time is too long, and there is a new connection. That in the stack It is not always the day. And the connection does not share a level, it is possible because it is a Player service, so it is not divided into ~~~~~ Good Faint.