Hi,
I got this error message and can't find out why this is happening.
Here is what I do:
I have a simple room for 2 users maximum with AudioSubscriber and AudioPublisher as in PeerToPeerRtmfp example.
What I want to do is keep a user always connected in the room (master). The other user (viewer) must be able to connect to a room, disconnect and then reconnect again later.
The first time I connect and use AudioSubscriber and AudioPublisher, everything is working fine, I can hear and speak.
Then I disconnect the viewer from the room:
audioPub.stop();
audioSub.resetAllStreams();
session.close(); // I tried with session.logout() also, same effect
So far, everything works fine, the master user is the only one connected to the room.
Later, I want to reconnect the 'viewer' user, so I do the same step of login him on the session.
I receive the SYNCHRONIZATION_CHANGE and the user is connected to the session.
Then I try to publish his audio stream:
audioPub.publish();
And this call generate this stack trace:
Error: Stream cannot be published as it doesnot exists
at com.adobe.rtc.sharedManagers::StreamManager/publishStream()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/main/connect/cocomoPlayer10/src/com/adobe/rtc/sharedManagers/StreamManager.as:709]
at com.adobe.rtc.collaboration::AudioPublisher/publish()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/main/connect/cocomoPlayer10/src/com/adobe/rtc/collaboration/AudioPublisher.as:700]
at voiceapi/merchantAudioConnected()[D:\workspace\voiceapi\src\voiceapi.mxml:132]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at com.adobe.rtc.collaboration::AudioSubscriber/onStreamReceive()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/main/connect/cocomoPlayer10/src/com/adobe/rtc/collaboration/AudioSubscriber.as:680]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.adobe.rtc.sharedManagers::StreamManager/onItemReceive()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/main/connect/cocomoPlayer10/src/com/adobe/rtc/sharedManagers/StreamManager.as:1580]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.adobe.rtc.sharedModel::CollectionNode/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItem()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/main/connect/cocomoPlayer10/src/com/adobe/rtc/sharedModel/CollectionNode.as:742]
at com.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItem()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/main/connect/cocomoPlayer10/src/com/adobe/rtc/messaging/manager/MessageManager.as:662]
at com.adobe.rtc.session.managers::SessionManagerBase/receiveItem()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/main/connect/cocomoPlayer10/src/com/adobe/rtc/session/managers/SessionManagerBase.as:330]
Is it a bug, or did I make something wrong?
Thanks for your help!!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I guess I found out where you were wrong
The Master is publishing as well as viewer is publishing after the viewer connects. When you are hanging, you are deleting the master's stream and on the handler , you are also calling audioPub.stop() for viewer , but before the audioPub.stop() is executed, i.e. the viewer's stream is deleted , you are already calling logout, and once you do that, the microphone instance keeps hanging since before the notification of his stream deletion reaches himself, the viewer is already logged out of the session.
You need to wait for the viewer's stream to be deleted by listening to STREAM_DELETE to viewer's audioPub before logging out. Here is your updated viewer code.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:rtc="AfcsNameSpace"
layout="absolute">
<mx:Script>
<![CDATA[
import com.adobe.rtc.clientManagers.MicrophoneManager;
import com.adobe.rtc.events.SessionEvent;
import com.adobe.rtc.events.StreamEvent;
private function connect():void {
session.login();
}
private function onSynchronize(event:SessionEvent):void {
if (event.type == SessionEvent.SYNCHRONIZATION_CHANGE) {
if (session.isSynchronized) {
audioPub.codec = SoundCodec.SPEEX;
MicrophoneManager.getInstance().framesPerPacket = 1;
audioPub.publish();
audioSub.addEventListener(StreamEvent.STREAM_DELETE, masterAudioHangUp);
}
}
}
private function masterAudioHangUp(event:StreamEvent):void {
audioPub.stop();
audioSub.resetAllStreams();
audioPub.addEventListener(StreamEvent.STREAM_DELETE,onStreamDelete);
}
private function onStreamDelete(p_evt:StreamEvent):void
{
session.logout();
}
]]>
</mx:Script>
<rtc:AdobeHSAuthenticator id="auth" protocol="rtmfp" userName="viewer" password="" />
<rtc:RoomSettings id="settings" autoPromote="true"/>
<rtc:ConnectSession
id="session"
authenticator=""
roomURL="your room url"
initialRoomSettings=""
synchronizationChange="onSynchronize(event)">
</rtc:ConnectSession>
<rtc:AudioSubscriber id="audioSub" />
<rtc:AudioPublisher id="audioPub" />
<mx:Button label="Connect" click="connect()" enabled="{!session.isSynchronized}" /> </mx:Application>
This code should work fine now.
Hope this helps.
Thanks
Hironmay Basu
Views
Replies
Total Likes
Hi,
We will definitely investigate this. Does this happen always ? Can you provide us a simple code of yours that reproduce this problem.
Thanks
Hironmay Basu
Views
Replies
Total Likes
Hi,
Yes this always happens. I created a simple example that shows it. I joined it in a zip file.
There's 2 files. First, run 'master application'. Then run 'viewer 'application'.
Click on connect in 'viewer app'. Both users can now speak together. Click on Hang Up button in 'Master app'. Then click connect again in viewer app. The issue will occur when viewer tries to publish its audio again.
Thanks for your help!
Views
Replies
Total Likes
Hi,
Do you know a workaround to avoid this problem for now?
Thanks!
Romain
Views
Replies
Total Likes
Hi,
I will run it and get back to you by end of day of possible reasons and solutions.
Thanks
Regards
Hironmay Basu
Views
Replies
Total Likes
Hi,
I guess I found out where you were wrong
The Master is publishing as well as viewer is publishing after the viewer connects. When you are hanging, you are deleting the master's stream and on the handler , you are also calling audioPub.stop() for viewer , but before the audioPub.stop() is executed, i.e. the viewer's stream is deleted , you are already calling logout, and once you do that, the microphone instance keeps hanging since before the notification of his stream deletion reaches himself, the viewer is already logged out of the session.
You need to wait for the viewer's stream to be deleted by listening to STREAM_DELETE to viewer's audioPub before logging out. Here is your updated viewer code.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:rtc="AfcsNameSpace"
layout="absolute">
<mx:Script>
<![CDATA[
import com.adobe.rtc.clientManagers.MicrophoneManager;
import com.adobe.rtc.events.SessionEvent;
import com.adobe.rtc.events.StreamEvent;
private function connect():void {
session.login();
}
private function onSynchronize(event:SessionEvent):void {
if (event.type == SessionEvent.SYNCHRONIZATION_CHANGE) {
if (session.isSynchronized) {
audioPub.codec = SoundCodec.SPEEX;
MicrophoneManager.getInstance().framesPerPacket = 1;
audioPub.publish();
audioSub.addEventListener(StreamEvent.STREAM_DELETE, masterAudioHangUp);
}
}
}
private function masterAudioHangUp(event:StreamEvent):void {
audioPub.stop();
audioSub.resetAllStreams();
audioPub.addEventListener(StreamEvent.STREAM_DELETE,onStreamDelete);
}
private function onStreamDelete(p_evt:StreamEvent):void
{
session.logout();
}
]]>
</mx:Script>
<rtc:AdobeHSAuthenticator id="auth" protocol="rtmfp" userName="viewer" password="" />
<rtc:RoomSettings id="settings" autoPromote="true"/>
<rtc:ConnectSession
id="session"
authenticator=""
roomURL="your room url"
initialRoomSettings=""
synchronizationChange="onSynchronize(event)">
</rtc:ConnectSession>
<rtc:AudioSubscriber id="audioSub" />
<rtc:AudioPublisher id="audioPub" />
<mx:Button label="Connect" click="connect()" enabled="{!session.isSynchronized}" /> </mx:Application>
This code should work fine now.
Hope this helps.
Thanks
Hironmay Basu
Views
Replies
Total Likes
It works. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies