[jitsi-dev] Getting the visual component of received video


#1

I succeeded displaying the video which captured from camera with this
code:

...
VideoMediaStream vstream = (VideoMediaStream)
AVTransmit2.mediaStreams[1];
while(vstream.getLocalVisualComponent() == null)
  Thread.sleep(100);
Component localVideo = vstream.getLocalVisualComponent();
center = new VideoContainer(photoLabel, false);
center.add(localVideo, VideoLayout.LOCAL, -1);
vp.add(center); //vp is a jframe
vp.setVisible(true);
...

That was for avtransmit2 side.

In the avreceive side I want to get the visual component of received
video. I'm seeing transmit is successful because there is text for
received bytes at the system out info. But when I try
vstream.getVisualComponents()
it returns an empty list. I tried for
vstream.getVisualComponent(vstream.getRemoteSourceID())
and it returns null again because
vstream.getRemoteSourceID() returns -1

Could you give me a hint please?

if you want to see what am I doing at avreceive side, this is it:

...
VideoMediaStream vstream = (VideoMediaStream)
AVReceive2.mediaStreams[1];
long ssrc = AVReceive2.mediaStreams[1].getRemoteSourceID();
while(vstream.getVisualComponent(ssrc) == null)
  {
    Thread.sleep(500);
    System.out.println(ssrc); // its always -1
    System.out.println(vstream.getVisualComponent(ssrc));
// so its returning null
    ssrc = AVReceive2.mediaStreams[1].getRemoteSourceID();
  }
Component remoteVideo = vstream.getVisualComponent(ssrc);
center = new VideoContainer(photoLabel, false);
center.add(remoteVideo, VideoLayout.CENTER_REMOTE, -1);
vp.add(center);
vp.setVisible(true);
...