-
Notifications
You must be signed in to change notification settings - Fork 2
[FCE-2938] Re-enable simulcast variant switching #496
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import type { Variant } from "@fishjam-cloud/ts-client"; | ||
| import { useCallback, useContext } from "react"; | ||
|
|
||
| import { FishjamClientContext } from "../contexts/fishjamClient"; | ||
|
|
||
| /** | ||
| * Hook provides a method to set the target encoding (simulcast variant) for a remote track. | ||
| * | ||
| * The encoding will be sent whenever it is available. If the chosen encoding is temporarily | ||
| * unavailable, some other encoding will be sent until the chosen encoding becomes active again. | ||
| * | ||
| * @category Connection | ||
| * @group Hooks | ||
| */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: i feel this hook is a bit too "low level" as for the react client. instead, i'd suggest adding a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will mitigate the need to pass over a track id. react client users don't even get to the "track" level, the hooks handle it for themselves. what do you think?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the thing is, we're going to be using this function wrt remote tracks, not local ones. so, as far as I understand, we'd need to extend ofc if you see a more elegant way, I'm all ears -- my React proficiency is nonexistent |
||
| export function useSetTargetTrackEncoding() { | ||
| const fishjamClientRef = useContext(FishjamClientContext); | ||
| if (!fishjamClientRef) throw Error("useSetTargetTrackEncoding must be used within FishjamProvider"); | ||
|
|
||
| const setTargetTrackEncoding = useCallback( | ||
| (trackId: string, encoding: Variant) => { | ||
| fishjamClientRef.current.setTargetTrackEncoding(trackId, encoding); | ||
| }, | ||
| [fishjamClientRef], | ||
| ); | ||
|
|
||
| return { setTargetTrackEncoding }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: