Rendering Video


To render the remote participant's video into the UI, you need to first set the stream configurations for all the remote participants. An example of setting video stream configuration for a participant is given below:

VideoStreamService videoStreamService = getBlueJeansSDK().getMeetingService().getVideoStreamService();
      List<VideoStreamConfiguration> streamConfiguration = new ArrayList<>();
      streamConfiguration.add(
                            new VideoStreamConfiguration(
                              "<participant ID>",
                              StreamQuality.R360p_30fps,
                              StreamPriority.Medium
                            )
                    );
      VideoStreamConfigurationResult result = viewModel.setVideoConfiguration(streamConfiguration);
 val videoStreamService = blueJeansSDK.meetingService.videoStreamService
      val streamConfiguration = listOf(
        VideoStreamConfiguration(
          "<participant ID>",
          StreamQuality.R360p_30fps,
          StreamPriority.Medium
        )
      )
      val result = videoStreamService.setVideoStreamConfiguration(streamConfiguration)

The above code snippet requests the backend service to send a participant with ID <participant ID> 's video feed in 360p. If the result of setVideoStreamConfiguration is VideoStreamConfigurationResult.Success then we are ready to render the participant's video. To do so,

if (VideoStreamConfigurationResult.Success.INSTANCE.equals(result)) {
        TextureView textureView = findViewById(R.id.participantTextureView)
        AttachParticipantStreamResult attachResult = videoStreamService.attachParticipantToView("<participant ID>", textureView);
      } else {
        // Failed to apply stream configuration. Cannot render video.
      }
 if (result is VideoStreamConfigurationResult.Success) {
        val textureView = findViewById(R.id.participantTextureView)
        val attachResult = videoStreamService.attachParticipantToView("<participant ID>", textureView)
      } else {
        // Failed to apply stream configuration. Cannot render video.
      }

If the value of attachResult is AttachParticipantStreamResult.Success, then you should start seeing the remote
participant's video feed inside your TextureView.

Note

Always add the TextureView inside a parent container (e.g. LinearLayout, ConstraintLayout, or something
similar). A parent container is required to support video stream styles. 

Video Stream Styles

BlueJeans SDK provides you with two types of styling options for video streams VideoStreamStyle.FIT_TO_VIEW and
VideoStreamStyle.SCALE_AND_CROP.

  • VideoStreamStyle.FIT_TO_VIEW - In this type of styling option, videos maintain their aspect ratio with a clear space on the sides or top and bottom of the parent container.
  • VideoStreamStyle.SCALE_AND_CROP - In this styling option, videos maintain their aspect ratio but are cropped within their parent container.

VideoStreamStyle.SCALE_AND_CROPoption ensures that the video feed occupies the entire space of the parent container (which means no "pillar boxing", or "letterboxing"). When you are selecting this option, there may be some data loss.

Use the following commands to apply the video stream style.

videoStreamService.setVideoStreamStyle(VideoStreamStyle.FIT_TO_VIEW);
videoStreamService.setVideoStreamStyle(VideoStreamStyle.FIT_TO_VIEW)

Note

Video stream styles are globally applied to all the available video streams. 

You should consider your layout and decide if cropping or letterboxing is better for your use case. You can also observe the resolution of the stream and resize the container instead.