Skip to main content
Version: 0.1.x

Set Viewport - Android

When you are working with Video Calling, video quality is the most important part of communication. When a participant is shown on the screen, consuming multiple high quality although not required, will result in more memory and CPU usage of the device, eventually degrading quality.

The way to optimze around these situation is to consume the video quality which is required to fit the view of a particular participant, resulting in better quality, less usage of network bandwith and providing a better experience.

Viewport is the size of window or visible area in which video for the participant is shown. We can optimize the consuming video quality based on the viewport size of the participant. For example if the viewport size of a particular participant view is 480x360, VideoSDK will download a 480x360 stream. If a participant on screen is present in bigger size, VideoSDK will provide a higher quality video for that particular participant only.


info

MultiStream is not supported by the Android SDK. Use customTrack instead of setViewPort() if you want to change participant's quality who joined using our Android SDK.

To know more about customTrack visit here

setViewPort()

setViewPort() can be used to achieve the best optimization of the video. This method is called with the width and height of the participant view on the Participant object and VideoSDK will handle the rest.

Parameters
  • width

    • type: int
    • Width of the participant view for which the quliaty of video is to be adjusted.
  • height

    • type: int
    • Height of the participant view for which the quliaty of video is to be adjusted.

Example

class ParticipantAdapter(meeting: Meeting) : RecyclerView.Adapter<ParticipantAdapter.PeerViewHolder() {

//Your variables here

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PeerViewHolder {
containerHeight = parent.height
return PeerViewHolder(
LayoutInflater.from(parent.context)
.inflate(R.layout.item_remote_peer, parent, false)
)
}

override fun onBindViewHolder(holder: PeerViewHolder, position: Int) {
val participant = participants[position]

//View updates here

//Update Consuming quality using setViewPort
participant.setViewPort(holder.itemView.getWidth(), holder.itemView.getHeight());
}
}

The complete usage of this method can be seen here in the code sample

Got a Question? Ask us on discord


Was this helpful?