Expand my Community achievements bar.

SOLVED

Publishing Streams in Different rooms?

Avatar

Level 4

Hi,

So If i have someone streaming their cam and audio in a room. Then want to redirect that stream in a different room, but make it work in such a way where the user does not have to republish. is that possible. I understand you can be connected in multiple rooms at the same time. but could you detect that the camera is on in one room and redirect the stream into another?

hope that makes sense.

thanks.

...russ

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi Russ,

When you connect to any room, you get a connectSession Instance, and whenever any stream( A/V) has to be created, it requires the NetConnection which is obtained from the connectSession instance( Refer to any of the Audio/Webcam Publisher code for details about creating NetStream).

Now if you are redirecting to a different room, it means a completely new connectSession and thus a new NetConnection, so you can't redirect the stream to a different room automatically.

What you can do is , to have your audio/webcam publisher publishing to a different room, something like

audioPub.stop();

audioPub.connectSession = "newSessionInstance" ;

audioPub.subscribe();

audioPub.publish();

to redirect your publisher to the new room that has the new connectSession.

Hope this helps

Thanks

Hironmay Basu

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Hi Russ,

When you connect to any room, you get a connectSession Instance, and whenever any stream( A/V) has to be created, it requires the NetConnection which is obtained from the connectSession instance( Refer to any of the Audio/Webcam Publisher code for details about creating NetStream).

Now if you are redirecting to a different room, it means a completely new connectSession and thus a new NetConnection, so you can't redirect the stream to a different room automatically.

What you can do is , to have your audio/webcam publisher publishing to a different room, something like

audioPub.stop();

audioPub.connectSession = "newSessionInstance" ;

audioPub.subscribe();

audioPub.publish();

to redirect your publisher to the new room that has the new connectSession.

Hope this helps

Thanks

Hironmay Basu

Avatar

Level 4

Hi,

That was right on. I thought it was something like that.

Makes total sense. Now I have someone pubishing between two rooms using AS to control one of the rooms.

thanks again!

...russ

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----