-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RFC: refactor RTCView to better handle track changes #1618
Comments
Sounds like a much better way to handle things 😃 |
Yeah that seems pretty reasonable. 👍 |
Copying this comment from the PIP issue since it's slightly related if we wanted to do fallback view on the main RTCVideoView. Relevant notes:
|
I suspected ;-)
Sounds alright to me.
Do we need a "normal" view fallback?
I'd skip that for now and focus this PR in iOS. It will already be complex enough... |
I think it'd probably be fine with just a single fallback to cover both, though I found you can slap a regular view into the PIP just fine, so I'm shunting the fallback view directly in. Would need a separate instance of the fallback view for the main view, or go back to the original plan of doing screen grabs (for now I'll be leaving this as is). |
This is something I've had on the back of my head for a while.
Right now one renders a view like so:
If that stream doesn't have a video track we render back, which is fine, but it doesn't work well in case you add a track later, or in case a track is removed while it was being rendered. Well, yes, we'll render back indeed, which I guess is not great.
What I suggest is we create a wrapper component which takes a stream object rather than a URL, to start with:
While we're here, we might as well call it like the DOM
<video>
element prop!So now that we have that, we can check if there is a video track, store it in state and if there is one, get the stream URL and return the native component.
We can then add listeners to internal events that would let us know if a track has been added / removed and act accordingly.
When there is no track we can render
null
or a fallback view we can get as a prop.Keeping backwards compatibility should be easy, since we could still take the
streamURL
prop and if set just skip all logic and return the native component.Thoughts?
/cc @davidliu
The text was updated successfully, but these errors were encountered: