-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue rendering TVILocalVideoTrack in UICollectionViewCell #161
Comments
@louiss98 I apologize for responding late to you question. An app should not create more than one local video track with camera as source. From the code snippet you have posted, it seems like two Here is the modified methods : func prepareLocalMedia() {
// Create an audio track.
if (localAudioTrack == nil) {
localAudioTrack = TVILocalAudioTrack.init()
if (localAudioTrack == nil) {
print("audio track failed to initialize")
}
}
// Create a video track which captures from the camera.
if (localVideoTrack == nil) {
let videoConstraints = TVIVideoConstraints { (constraints) in
constraints.aspectRatio = TVIAspectRatio16x9
constraints.maxFrameRate = 30
constraints.minFrameRate = TVIVideoConstraintsFrameRateNone
}
camera = TVICameraCapturer(source: .frontCamera, delegate: self)
localVideoTrack = TVILocalVideoTrack.init(capturer: camera!, enabled: true, constraints: videoConstraints)
}
createRoom()
}
func startPreview() {
// Create a local video track if it it is not created yet
if (localVideoTrack == nil) {
let videoConstraints = TVIVideoConstraints { (constraints) in
constraints.aspectRatio = TVIAspectRatio16x9
constraints.maxFrameRate = 30
constraints.minFrameRate = TVIVideoConstraintsFrameRateNone
}
camera = TVICameraCapturer(source: .frontCamera, delegate: nil)
localVideoTrack = TVILocalVideoTrack.init(capturer: camera!, enabled: true, constraints: videoConstraints)
}
// Add renderer on the local video track
if (localVideoTrack == nil) {
print("Video track in cell is nil")
} else {
localVideoTrack!.addRenderer(previewView)
print("Video track added to previewView in Cell")
}
} Let me know if you have any questions. |
@louiss98 Hoping the problem is resolved at your end. I am closing the ticket but feel free to re-open if you observer the issue again. |
Hello,
I am building a group video chat application using the programmable video api, and I'm noticing some strange behavior when connecting to a room.
My goal was to render each room participant in a UICollectionViewCell as opposed to creating a UIView for each participant.
The following best describes my approach.
At the View Controller:
Initialize both the TVILocalVideoTrack & TVILocalAudioTrack
Connect to a room.
At the UICollectionViewCell:
At cellForItemAt indexPath:
Currently what I expect is for a preview to render in the cell and also on the other participants screen.
What's actually happening is, as if by random, the preview either renders solely on the device and no video data is sent to the room or video is sent to the room but doesn't render on the device.
Currently I am using TwilioVideo 1.3.2
Any suggestions?
The text was updated successfully, but these errors were encountered: