PDA

View Full Version : RTMP loader


SullDC
09-17-2007, 11:04 PM
First I would like to apologize to FlashGordon for my comment before... I had a pretty bad day and I am sorry I "snapped." I'm sorry. Hope we can forgive and forget:rolleyes:

I am working with Lee's video tutorials to get a load bar in my custom player
I was able to get my connection working but it can't get the loader working. a trace of ns.bytesLoaded or even ns.bytesTotal gives me "0"

anyone have any ideas??

any help is greatly appreciated.
Although I am new to scripting, I am a professional web designer and will gladly offer my services to any potential helper for their help. Thanks!

//////////////////////////Connections///////////////

nc = new NetConnection();
nc.connect("rtmp://******.rtmphost.com/bes/");

nc.onStatus = function(info){
trace(info.code);
if(info.code == "NetConnection.Connect.Success"){
playLive();
}
};

playLive = function(){
ns = new NetStream(nc);
theVideo.attachVideo(ns);
theVideo.attachAudio(ns);
ns.play("movie");
};
///////////////Button/////////////////////////

playButton.onRelease = function() {
ns.pause();
};

///////////////Loader/////////////////////////

//calls videoStatus 10 times a second
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;


function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 269;

};

onEnterFrame = function(){
trace(ns.bytesTotal);
//Returning 0 !!!
};

Flash Gordon
09-18-2007, 12:09 AM
First I would like to apologize to FlashGordon for my comment before... I had a pretty bad day and I am sorry I "snapped." I'm sorry. Hope we can forgive and forget:rolleyes:
Hey buddy, if anyone understand that it is certainly me. I do it all the time to people and feel bad about it later.

However, I really was serious about using the Flash Help docs. I never used to, and now I can't live without them.

When I pointed out connect problem, the flash docs say this for me:

public function connect(command:String, ... arguments):void

Language version: ActionScript 3.0
Player version: Flash Player 9


Opens a connection to a server. Through this connection, you can play back audio or video (FLV) files from the local file system, or you can invoke commands on a remote server.

When using this method, consider the Flash Player security model and the following security considerations:

By default, the website denies access between sandboxes. The website can enable access to a resource by using a cross-domain policy file.
A website can deny access to a resource by adding server-side ActionScript application logic in Flash Media Server.
You cannot use the NetConnection.connect() method if the calling SWF file is in the local-with-file-system sandbox.
You can prevent a SWF file from using this method by setting the allowNetworking parameter of the the object and embed tags in the HTML page that contains the SWF content.
For more information, see the following:

The security chapter in the Programming ActionScript 3.0 book and the latest comments on LiveDocs
The Flash Player 9 Security white paper

Parameters command:String — Set this parameter to null if you are connecting to video without a server (that is, video on the local computer that is running the SWF file).
If you are connecting to a server, set this parameter to the URI of the application on the server that runs when the connection is made. Use the following format (items in brackets are optional):

protocol:[//host][:port]/appname/[instanceName]

If the SWF file is served from the same host where the server is installed, you can omit the host parameter. If you omit the instanceName parameter, Flash Player connects to the application's default instance (_definst_).


... arguments — Optional parameters of any type to be passed to the application specified in command. If the application is unable to process the parameters in the order in which they are received, netStatusEvent is dispatched with the code property set to NetConnection.Connect.Rejected.


You look like you got that happening now, but I haven't used FMS before. Though I will have to here shortly. I'll help you if you want, but I don't see anything wrong if your code. You are going to need to give me server access.

Cheers and hope your day is going better.