• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Find out the connection lost

New Here ,
Sep 05, 2011 Sep 05, 2011

Copy link to clipboard

Copied

I have done the application with two type of authentication

First one is the presenter

Second one is the viewer

(both are connect to the same FMS application)

i want to notify the viewer when presenter log out or connection lost , how it's possible, please help me, thanks in advance

Views

737

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 05, 2011 Sep 05, 2011

Copy link to clipboard

Copied

NetStatus event listener. Its in the AS3.0 live docs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 06, 2011 Sep 06, 2011

Copy link to clipboard

Copied

You'll need to keep track of the two clients on the server side, and invoke a client side method on the viewer client when the presenter disconnects. For example:

On the viewer, you'll have a method in the netconnection's client object:

onPresenterDisconnect = function(){

// Notify the client here

}

on the server side:

application.onDisconnect = function(client){

// Test to see if the disconnecting client is the presenter

if(client is the presenter){

// Loop through the client list to find the viewer or viewers

for(var i=0; i<application.clients.length; i++){

if(application.clients is a viewer){

application.clients.call("onPresenterDisconnect" null);

}

}

Obvoiously, the above is not complete code. You'll need to add your own logic to determine whether a given client is a presenter or a viewer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 06, 2011 Sep 06, 2011

Copy link to clipboard

Copied

LATEST

oh yeah I was a little hasty on this one sorry. I would probably have an object on the server side that tracks all users and have an attribute that denotes presenter or subscriber. something like

//intialize in onAppStart

this.adminObj = new Object();

//get user data from connection string on client side

"rtmp://192.168.1.102/someApp/someInstance","userNameVariable"

//add username in onConnect to Object

client.userName=userName;
this.userObj[client.userName]=client;

//call this from client side depending on whether the user chooses to be presenter or subscriber.

Client.prototype.setStreamID = function(userName,streamType){

this.userObj[client.userName].streamID = streamType;

}

//find out onDisconnect what type the client is.

//application.onDisconnect = function(oldClient)

if(application.userObj[oldClient.userName].streamID=="presenter"){
  //then either send or call the subscribers
  }

//This is imperfect just an example of how I might go about it.........I've also have tracke FPS on the client side to see when the presenter stops presenting. to track frames per second though you need to continously poll the fps property of the netstream with either a timer or onEnter (onEnterFrame).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines