It all comes down to this. All the setup so far has been done so that we can show live streaming videos in our beautiful app.
To render video you will use HMSVideoView. To use it we will need few things:
HMSVideoViewwill render video using trackId from HMSTrack.
HMSVideoViewwill use viewSize to get height and width of rendered video. If not passed, it will take whatever size is available to the widget.
HMSTrack is used to render video in HMSVideoView.
And you can get all tracks by listening to
Add a check on these tracks to see if they are video tracks or audio tracks.
For example -
/// check if track is video or audio /// For Audio track.kind == HMSTrackKind.kHMSTrackKindAudio /// For Video track.kind == HMSTrackKind.kHMSTrackKindVideo
Now, you can pass video track to
HMSVideoView to get you live video on screen.
To Render video you need the video track.
For example - HMSVideoView with
/// This will render video with trackId present in track and it will have height = 50 and width = 50 HMSVideoView(track: track);
Remove the HMSVideoView from UI and it will not render its video & conserve network bandwidth.
For full example try out our Example app here.