Skip to content
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

Update default templates to use component/client 2.0 #648

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions template-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"private": true,
"dependencies": {
"@babel/runtime": "^7.21.0",
"@livekit/components-core": "^0.8.0",
"@livekit/components-react": "^1.4.0",
"@livekit/components-styles": "^1.0.7",
"@livekit/egress-sdk": "^0.1.2",
"livekit-client": "^1.14.4",
"@livekit/components-core": "^0.9.3",
"@livekit/components-react": "^2.0.6",
"@livekit/components-styles": "^1.0.11",
"@livekit/egress-sdk": "^0.2.0",
"livekit-client": "^2.0.10",
"react": ">=18",
"react-dom": ">=18",
"react-scripts": "5.0.1"
Expand Down
121 changes: 73 additions & 48 deletions template-default/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions template-default/src/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function CompositeTemplate({ layout: initialLayout }: CompositeTemplateProps) {

// start recording when there's already a track published
let hasTrack = false;
for (const p of Array.from(room.participants.values())) {
if (p.tracks.size > 0) {
for (const p of Array.from(room.remoteParticipants.values())) {
if (p.trackPublications.size > 0) {
hasTrack = true;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions template-default/src/SingleSpeakerLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

import { useVisualStableUpdate, VideoTrack } from '@livekit/components-react';
import { TrackReference, useVisualStableUpdate, VideoTrack } from '@livekit/components-react';
import { LayoutProps } from './common';

const SingleSpeakerLayout = ({ tracks: references }: LayoutProps) => {
const sortedReferences = useVisualStableUpdate(references, 1);
if (sortedReferences.length === 0) {
return null;
}
return <VideoTrack {...sortedReferences[0]} />;
return <VideoTrack trackRef={sortedReferences[0] as TrackReference} />;
};

export default SingleSpeakerLayout;
10 changes: 5 additions & 5 deletions template-default/src/SpeakerLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { TrackReference } from '@livekit/components-core';
import {
CarouselView,
CarouselLayout,
FocusLayout,
ParticipantTile,
VideoTrack,
Expand All @@ -33,15 +33,15 @@ const SpeakerLayout = ({ tracks: references }: LayoutProps) => {
return <></>;
} else if (remainingTracks.length === 0) {
const trackRef = mainTrack as TrackReference;
return <VideoTrack {...trackRef} />;
return <VideoTrack trackRef={trackRef} />;
}

return (
<div className="lk-focus-layout">
<CarouselView tracks={remainingTracks}>
<CarouselLayout tracks={remainingTracks}>
<ParticipantTile />
</CarouselView>
<FocusLayout track={mainTrack as TrackReference} />
</CarouselLayout>
<FocusLayout trackRef={mainTrack as TrackReference} />
</div>
);
};
Expand Down
Loading