Wowza Media Systems home  

Go Back   Wowza Media Server Forums > Wowza Media Server Pro Forums > Getting Started

Reply
 
Thread Tools Display Modes
  #1  
Old 02-07-2009, 08:46 PM
flashsyndrome flashsyndrome is offline
Junior Member
 
Join Date: Feb 2009
Posts: 1
Default Server unpublishing stream and disconnecting users by itself

I created a video chat application. When I start publishing a stream, the server automatically unpublish the stream.
Here is what I get in the console:


INFO server comment - onStreamCreate: 46859
INFO stream create - -
INFO stream publish user480 -
INFO stream unpublish user480 -
INFO server comment - onStreamDestroy: 46859
INFO stream destroy user480 -

Any idea why this would do that?

Also sometime when streaming, the server just disconnect the client for no apparent reason.
We are using the Wowza Pro 1.6 edition on Windows system and Flash CS3 for the client.
Here is the VideoChat module code:
public class VideoChatModule extends ModuleBase {

static public final String CONNECTEDUSERS_SONAME = "connectedUsersSO";
public String USERNAME = "";
public Arrays ClientAudio[];
public Arrays ClientVideo[];

public void setCamStatus(IClient client, RequestFunction function,
AMFDataList params) {
getLogger().info("setCamStatus called : " + params.getString(4));
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject so = sharedObjects.get(CONNECTEDUSERS_SONAME);
so.send("camStatusFromSrvr",USERNAME,params.getStr ing(4));
}
public void setMicStatus(IClient client, RequestFunction function,
AMFDataList params) {
getLogger().info("setMicStatus called : " + params.getString(4));
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject so = sharedObjects.get(CONNECTEDUSERS_SONAME);
so.send("micStatusFromSrvr",USERNAME,params.getStr ing(4));

}
public void msgFromClient(IClient client, RequestFunction function,
AMFDataList params) {
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject so = sharedObjects.get(CONNECTEDUSERS_SONAME);
so.send("msgFromSrvr",params.getString(3),params.g etString(4),params.getString(5),params.getString(6 ),params.getString(7),params.getString(8),params.g etString(9),params.getString(10));
}
public void setMediaFile(IClient client, RequestFunction function,
AMFDataList params) {
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject so = sharedObjects.get(CONNECTEDUSERS_SONAME);
so.send("mediaFromSrvr",params.getString(3),params .getString(4),params.getString(5),params.getString (6));
}
public void setMediaAction(IClient client, RequestFunction function,
AMFDataList params) {
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject so = sharedObjects.get(CONNECTEDUSERS_SONAME);
so.send("mediaActionFromSrvr",params.getString(3)) ;
}
public void raiseHand(IClient client, RequestFunction function,
AMFDataList params) {
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject so = sharedObjects.get(CONNECTEDUSERS_SONAME);
so.send("raiseHandFromSrvr",params.getString(3));
}
public void fullScreen(IClient client, RequestFunction function,
AMFDataList params) {
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject so = sharedObjects.get(CONNECTEDUSERS_SONAME);
so.send("fullscreenFromSrvr",params.getString(3));
}

public void onAppStart(IApplicationInstance appInstance) {

String fullname = appInstance.getApplication().getName() + "/"
+ appInstance.getName();
getLogger().info("onAppStart: Application starting " + fullname);


ISharedObjects sharedObjects = appInstance.getSharedObjects(false);
ISharedObject connectedUsersSO = new SharedObject(CONNECTEDUSERS_SONAME);
sharedObjects.put(CONNECTEDUSERS_SONAME, connectedUsersSO);

connectedUsersSO.lock();
try
{
connectedUsersSO.acquire();
}
catch (Exception e)
{

}
finally
{
connectedUsersSO.unlock();
}
}

public void onAppStop(IApplicationInstance appInstance) {
String fullname = appInstance.getApplication().getName() + "/"
+ appInstance.getName();
getLogger().info("onAppStop: " + fullname);
// release the shared object when the application stops
ISharedObjects sharedObjects = appInstance.getSharedObjects(false);
ISharedObject connectedUsersSO = sharedObjects.get(CONNECTEDUSERS_SONAME);
if (connectedUsersSO != null)
{
getLogger().info("onAppStart: release shared object: "+CONNECTEDUSERS_SONAME);
connectedUsersSO.lock();
try
{
connectedUsersSO.release();
}
catch (Exception e)
{

}
finally
{
connectedUsersSO.unlock();
}
}

}

public void onConnect(IClient client, RequestFunction function,
AMFDataList params) {
getLogger().info("onConnect: " + params.getString(3));
USERNAME = params.getString(3);
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject connectedUsersSO = sharedObjects.get(CONNECTEDUSERS_SONAME);
if (connectedUsersSO != null)
{
connectedUsersSO.lock();
try
{
getLogger().info("onConnectAccept: add property: "+client.getClientId());
String username = USERNAME;
connectedUsersSO.setProperty(username, USERNAME);

}
catch (Exception e)
{

}
finally
{
connectedUsersSO.unlock();
}
}

}

public void onConnectAccept(IClient client) {
// when a client connection is accepted add a property to the shared object
// that notifies all connections of new client
getLogger().info("onConnectAccept: "+client.getClientId());

}

public void onConnectReject(IClient client) {
getLogger().info("onConnectReject: " + client.getClientId());
}

public void onDisconnect(IClient client) {
// When the client is disconnected remove the property from the shared object
getLogger().info("onDisconnect: "+client.getClientId());
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject connectedUsersSO = sharedObjects.get(CONNECTEDUSERS_SONAME);
if (connectedUsersSO != null)
{
connectedUsersSO.lock();
try
{
getLogger().info("onDisconnect: remove property: "+client.getClientId());
String username = "c" + client.getClientId();
connectedUsersSO.deleteSlot(username);
connectedUsersSO.purge(connectedUsersSO.getVersion ()-200);
}
catch (Exception e)
{

}
finally
{
connectedUsersSO.unlock();
}
}



}

public void onStreamCreate(IMediaStream stream) {
getLogger().info("onStreamCreate: " + stream.getSrc());

}

public void onStreamDestroy(IMediaStream stream) {
getLogger().info("onStreamDestroy: " + stream.getSrc());


}
public void getStreamClientIds(IClient client, RequestFunction function, AMFDataList params)
{
AMFDataArray clientList = new AMFDataArray();
String streamName = params.getString(PARAM1);
IApplicationInstance applicationInstance = client.getAppInstance();
List<IMediaStream> streamList = applicationInstance.getPlayStreamsByName(streamNam e);
if (streamList != null)
{
Iterator<IMediaStream> iter = streamList.iterator();
while (iter.hasNext())
{
IMediaStream stream = iter.next();
if (stream == null)
continue;
IClient sclient = stream.getClient();
if (sclient == null)
continue;
clientList.add(new AMFDataItem(sclient.getClientId()));
}
}
ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
ISharedObject so = sharedObjects.get(CONNECTEDUSERS_SONAME);
so.send("streamListFromSrvr",clientList);
}

////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////


Any help would be appreciated.
We would like this to be working before we purchase the full license.
Reply With Quote
  #2  
Old 03-20-2009, 03:35 PM
solisarg solisarg is offline
Junior Member
 
Join Date: Mar 2009
Posts: 3
Default

I'm having similar problems. A two way videochat randomly kill one or another stream, and even both. Find something similar here: http://www.wowzamedia.com/forums/showthread.php?t=1440 but not sure if the netconnection calls are the reason

Jorge
Reply With Quote
  #3  
Old 04-05-2009, 05:52 PM
Keyston Keyston is offline
Junior Member
 
Join Date: Feb 2009
Posts: 10
Default

Bumping this, running into the same problem. Below is my logic from flash

1)Create First Stream-> Users are able to view stream
2) Stop The first Stream and clean up video/netstream objects(attachCamera(null) , .close())
3) Publish Stream 2 and never recieve a NetStatusEvent

Output :
Code:
INFO stream create - -
INFO stream publish 8eb41606-98a4-41bf-87b4-e0d72784e9bc -
... SNIP ...
INFO stream unpublish 8eb41606-98a4-41bf-87b4-e0d72784e9bc -
INFO stream create - - // Not publishing stream
INFO stream destroy 8eb41606-98a4-41bf-87b4-e0d72784e9bc -
INFO stream destroy - -

// This is from my flash class, as you see this is the new stream ID but on wowza end
it is recieving an empty stream name , thus not creating the stream.
MediaProcessor::start::publish e8c83229-8f21-77cc-6589-9e45af06d27c
Reply With Quote
  #4  
Old 04-05-2009, 06:03 PM
charlie charlie is online now
Administrator
 
Join Date: Nov 2006
Posts: 7,033
Default

Are you overriding the publish command? Can you reproduce the same behavior with the VideoChat example application? Are you creating a new NetStream object the second time you publish. The Flash player can have problems if you try to use the same NetStream object to publish more than once. Try creating a new NetStream object each time you publish.

Charlie
Reply With Quote
  #5  
Old 04-05-2009, 06:15 PM
Keyston Keyston is offline
Junior Member
 
Join Date: Feb 2009
Posts: 10
Default

Come to find out that my problem spaned from the order of exceution, I trying to publish the stream while they were not connected to the server. ANyway I fixed my code order and everything is working now as suppose to.

And Charlie, yes I was using different netstreams.

THanks
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 05:49 AM.


Copyright © 2006 - 2008, Wowza Media Systems
Wowza Media Systems