100ms Logo

100ms

Docs

Search docs
/

Render Video

It all comes down to this. All the setup so far has been done so that we can show live streaming video in our beautiful apps.

How to do it? What should I be careful about? Is it easy? 😨😰😱

It's simpler than you think. That's what we are here for. 🙌✌️🤝

  1. First, you need to create a HMSVideoView object in your View hierarchy. HMSVideoView is a subclass of UIView so add it to your UI just as a regular view using Storyboard, XIB or in-code.

  2. Next, you'll have a reference to a video track object. Specifically, a object of type HMSVideoTrack (or any of it's subclasses). For example, the local peer's video track can be accessed like so -

hmsSDK.localPeer?.localVideoTrack() // it's a HMSLocalVideoTrack, a subclass of HMSVideoTrack
  1. Now, pass the video track object to video view using setVideoTrack method of HMSVideoView
videoView.setVideoTrack(track) // videoView is HMSVideoView, track is HMSVideoTrack

Video Track to Video View. Remember this. You'll be doing this often.

That's it.

The video which the peer will be transmitting will now be rendered & start playing in your video view. 🥳