address suggestions

This commit is contained in:
harshithpabbati 2022-04-08 13:15:25 +05:30
parent 93a45bdf64
commit 43f69601f2
7 changed files with 28 additions and 9 deletions

View File

@ -17,7 +17,7 @@ export const App = ({ customComponentForState }) => {
...customComponentForState, ...customComponentForState,
}); });
// Memoize children to avoid unnecassary renders from HOC // Memoize children to avoid unnecessary renders from HOC
return useMemo( return useMemo(
() => ( () => (
<> <>

View File

@ -89,7 +89,7 @@ export const VideoGrid = React.memo(
return bestLayout; return bestLayout;
}, [dimensions, participants]); }, [dimensions, participants]);
// Memoize our tile list to avoid unnecassary re-renders // Memoize our tile list to avoid unnecessary re-renders
const tiles = useDeepCompareMemo( const tiles = useDeepCompareMemo(
() => () =>
participants.map((p) => ( participants.map((p) => (

View File

@ -21,7 +21,7 @@ export const App = ({ customComponentForState }) => {
...customComponentForState, ...customComponentForState,
}); });
// Memoize children to avoid unnecassary renders from HOC // Memoize children to avoid unnecessary renders from HOC
return useMemo( return useMemo(
() => ( () => (
<> <>

View File

@ -18,7 +18,13 @@
Please note: this demo is not currently mobile optimised Please note: this demo is not currently mobile optimised
### Getting started ## Pre-requisites
To use this demo, you will need to create a [Daily account](https://dashboard.daily.co/signup) and a [Daily room](https://dashboard.daily.co/rooms/create).
You will also need to enter an RTMP URL in the demo UI to start a live stream. To learn more about where to find this value, please read Daily's [live streaming guide](https://docs.daily.co/guides/paid-features/live-streaming-with-daily). You may also find the [live streaming with AWS's IVS tutorial](https://www.daily.co/blog/live-stream-daily-calls-with-only-3-second-latency/) helpful.
## Getting started
``` ```
# set both DAILY_API_KEY and DAILY_DOMAIN # set both DAILY_API_KEY and DAILY_DOMAIN

View File

@ -57,6 +57,11 @@ export const LiveStreamingModal = () => {
stopLiveStreaming(); stopLiveStreaming();
} }
const handleRMTPURLChange = (e) => setRtmpUrl(e.target.value);
const handleSelectLayoutInputChange = (e) => setLayoutType(e.target.value);
const handleSelectParticipantInputChange = (e) => setParticipantId(e.target.value);
const handleSelectMaxCamsInputChange = (e) => setMaxCams(e.target.valueAsNumber);
return ( return (
<Modal <Modal
title="Live stream" title="Live stream"
@ -93,7 +98,7 @@ export const LiveStreamingModal = () => {
<CardBody> <CardBody>
<Field label="Layout"> <Field label="Layout">
<SelectInput <SelectInput
onChange={(e) => setLayoutType(e.target.value)} onChange={handleSelectLayoutInputChange}
value={layoutType} value={layoutType}
> >
{LAYOUTS.map((l) => ( {LAYOUTS.map((l) => (
@ -107,7 +112,7 @@ export const LiveStreamingModal = () => {
{layoutType === 'default' && ( {layoutType === 'default' && (
<Field label="Additional cameras"> <Field label="Additional cameras">
<SelectInput <SelectInput
onChange={(e) => setMaxCams(Number(e.target.value))} onChange={handleSelectMaxCamsInputChange}
value={maxCams} value={maxCams}
> >
<option value={9}>9 cameras</option> <option value={9}>9 cameras</option>
@ -126,7 +131,7 @@ export const LiveStreamingModal = () => {
{layoutType === 'single-participant' && ( {layoutType === 'single-participant' && (
<Field label="Select participant"> <Field label="Select participant">
<SelectInput <SelectInput
onChange={(e) => setParticipantId(e.target.value)} onChange={handleSelectParticipantInputChange}
value={participantId} value={participantId}
> >
<option value={0} disabled> <option value={0} disabled>
@ -146,8 +151,14 @@ export const LiveStreamingModal = () => {
type="text" type="text"
placeholder="RTMP URL" placeholder="RTMP URL"
required required
onChange={(e) => setRtmpUrl(e.target.value)} onChange={handleRMTPURLChange}
/> />
<a
className="learn-more"
href="https://docs.daily.co/guides/paid-features/live-streaming-with-daily"
>
Want to learn more about RTMP url?
</a>
</Field> </Field>
</CardBody> </CardBody>
</Modal> </Modal>

View File

@ -87,7 +87,7 @@ export const HairCheck = () => {
} }
}; };
// Memoize the to prevent unnecassary re-renders // Memoize the to prevent unnecessary re-renders
const tileMemo = useDeepCompareMemo( const tileMemo = useDeepCompareMemo(
() => ( () => (
<Tile <Tile

View File

@ -10,6 +10,8 @@ import { useUIState } from './UIStateProvider';
export const LiveStreamingContext = createContext(); export const LiveStreamingContext = createContext();
export const LiveStreamingProvider = ({ children }) => { export const LiveStreamingProvider = ({ children }) => {
// setCustomCapsule allows us to set the recording capsule on the header
// to indicate that the recording is going on.
const { setCustomCapsule } = useUIState(); const { setCustomCapsule } = useUIState();
const handleStreamStarted = useCallback(() => { const handleStreamStarted = useCallback(() => {