Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

double display of video stream

Avatar

Level 2

It seems like the WebcamSubscriber displays any video feed in the room by default.  Our application has two such subscribers, and we assign publisher ids to them manually, but frequently the session begins with the same feed in both subscribers.  I implemented this function to try to avoid the double display, to mediocre effect.

private function suppressDoubling():void

{

  if (yourCam && friendCam && yourCam.publisherIDs != friendCam.publisherIDs)

  {

    yourCam.visible = true;

  }

}

Is it true that subscribers display any published video by default?  Any better way to suppress the doubling effect?

4 Replies

Avatar

Level 10

Hi,

When you create any subscriber , you need to assign publisherIDs to it if you want to show selected user streams, otherwise , by default , it will show all.

What you mean by doubling effect ? If you do not want to show a stream in a subscriber, make sure that the publisherIDs array don’t have that stream publisher's user id.

For e.g. if you have two subscribers, one you want to show only your stream and other you want to show all other streams , then you can do something like this

webcamSubcriber1.publisherIDs =

and for the second,

add all userIDs to the publisherIDs array except your own ID and then do webcamSubcriber2.publisherIDs = "remaining publisherIDs". If new users come in and publish their streams, you need to update the publisherIDs array again.

Hope this answers your question.

Also, if you want to split any new userID into yours and friends's cam, you need to reassign the publisherIDs. Basically, everytime you want to add a new user's stream to be shown in a subscriber, you need to add that user's id to the subscriber's list of publisherIDs.

Thanks

Hironmay Basu

Avatar

Level 2

Hironmay,

Thanks, this confirms the behavior I suspected.  I am setting the publisher ids of both subscribers in a callback which listens for StreamEvent.STREAM_RECEIVE on the streamManager of my connect session.  Yet there is still a moment or two where the subscribers begin to broadcast the first stream into the room (the default behavior) before my code gets around to assigning the publisher ids.  Is there perhaps a different event I could listen for that will give better response time?

As I indicated, I've actually attempted to keep the one subscriber invisible until I can verify that the publisher id it has does not match that of the other subscriber.  Even this has not completely suppressed the display of the wrong stream in the wrong place.

Still, thanks for the verification.

Avatar

Level 10

Ideally , this shouldn’t happen because if the publisherIDs value is null, then only any other stream that’s not in list will be played. So, somehow in the meantime the publisherIDs is getting to null. Can you put a break point in the playstream function inside WebcamPublisher to see when a new user stream is published, the playstream function gets called with a stream descriptor you didn't want to show i.e. the one that’s not in your existing list.

Or you can give me a small test code and I will run it this side.

If you do not want to show anything in the beginning and start with your list of publisherIDs, then you can pass an empty array as publisherIDs when you create the webcamsubscriber. That may fix your problem in case you see it only before the first time you assign the ids.

Thanks

Hironmay Basu

Avatar

Not applicable

Hi schwabsauce,

Can u give me more specific  details to achieve this.

How to pass opponent UserID to  Subscriber for restrictinig the double display ???

private  function displayExistingStreams():void   
{     var  publishers:Object =  _streamManager.getStreamsOfType(StreamManager.CAMERA_STREAM);
     //status_txt.text += "displayExistingStreams";
    for (var  publisherID:String in publishers) {
        if (publisherID  !=_userManager.myUserID) {   
             setUpSubscriber(publisherID);       
        }
    }
   
}
protected  function setUpSubscriber(p_publisherID:String):void {

     currentSubscriber = new WebcamSubscriber();
     currentSubscriber.displayUserBars=true;
     currentSubscriber.connectSession = cSession ;
     currentSubscriber.subscribe();

     // publisherIDs  used for  restricting the list of publishers     that this subscriber should  display videos for.
    currentSubscriber.publisherIDs =  [p_publisherID];

}

Regards,

Ashish