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. 🙌✌️🤝
First, you need to create a
HMSVideoViewobject in your View hierarchy.
HMSVideoViewis a subclass of
UIViewso add it to your UI just as a regular view using Storyboard, XIB or in-code.
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
- Now, pass the video track object to video view using
videoView.setVideoTrack(track) // videoView is HMSVideoView, track is HMSVideoTrack
Video Track to Video View. Remember this. You'll be doing this often.
The video which the peer will be transmitting will now be rendered & start playing in your video view. 🥳