Skip to content
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
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"devDependencies": {
"@livekit/components-styles": "workspace:*",
"@livekit/protocol": "^1.23.0",
"@livekit/protocol": "^1.36.1",
"@microsoft/api-extractor": "^7.36.0",
"@size-limit/file": "^11.0.2",
"@size-limit/webpack": "^11.0.2",
Expand Down
24 changes: 17 additions & 7 deletions packages/core/src/track-reference/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* @internal
*/

import { Participant, Track, TrackPublication } from 'livekit-client';
import { Participant, RemoteTrackPublication, Track, TrackPublication } from 'livekit-client';
import type { UpdatableItem } from '../sorting/tile-array-update';
import type { TrackReference, TrackReferencePlaceholder } from './track-reference.types';
import { getTrackReferenceId } from './track-reference.utils';
import { TrackInfo } from '@livekit/protocol';

// Test function:
export const mockTrackReferencePlaceholder = (
Expand All @@ -21,10 +22,15 @@ export const mockTrackReferencePublished = (id: string, source: Track.Source): T
const kind = [Track.Source.Camera, Track.Source.ScreenShare].includes(source)
? Track.Kind.Video
: Track.Kind.Audio;
const trackInfo = new TrackInfo({
sid: `${id}`,
name: `${id}`,
muted: false,
});
return {
participant: new Participant(`${id}`, `${id}`),
// @ts-ignore
publication: new TrackPublication(kind, `${id}`, `${id}`),
// @ts-expect-error
publication: new RemoteTrackPublication(kind, trackInfo, true),
source: source,
};
};
Expand All @@ -43,10 +49,14 @@ export const mockTrackReferenceSubscribed = (
const kind = [Track.Source.Camera, Track.Source.ScreenShare].includes(source)
? Track.Kind.Video
: Track.Kind.Audio;

// @ts-ignore
const publication = new TrackPublication(kind, `${id}`, `${id}`);
// @ts-ignore
const trackInfo = new TrackInfo({
sid: `${id}`,
name: `${id}`,
muted: false,
});
// @ts-expect-error
const publication = new RemoteTrackPublication(kind, trackInfo, true);
// @ts-expect-error
publication.track = {};
return {
participant: options.mockParticipant
Expand Down
22 changes: 16 additions & 6 deletions packages/core/src/utilis.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import { Participant, Track, TrackPublication } from 'livekit-client';
import { Participant, RemoteTrackPublication, Track } from 'livekit-client';
import { describe, it, expect } from 'vitest';
import { isTrackReferencePinned } from './track-reference';
import type { PinState } from './types';
import { TrackInfo } from '@livekit/protocol';

describe('Test isTrackReferencePinned', () => {
const participantA = new Participant('dummy-participant', 'A_id', 'track_A_name');
// @ts-ignore
const trackA = new TrackPublication(Track.Kind.Video, 'track_A_id', 'track_A_name');
trackA.trackSid = 'track_a_sid';
const trackInfoA = new TrackInfo({
sid: 'track_a_sid',
name: 'track_A_name',
muted: false,
});
// @ts-expect-error
const trackA = new RemoteTrackPublication(Track.Kind.Video, trackInfoA, true);
const participantB = new Participant('participant_B', 'B_id', 'B_name');
// @ts-ignore
const trackB = new TrackPublication(Track.Kind.Video, 'track_B_id', 'track_B_name');
const trackInfoB = new TrackInfo({
sid: 'track_b_sid',
name: 'track_B_name',
muted: false,
});
// @ts-expect-error
const trackB = new RemoteTrackPublication(Track.Kind.Video, trackInfoB, true);
trackB.trackSid = 'track_b_sid';
const trackReferenceA = {
participant: participantA,
Expand Down
50 changes: 25 additions & 25 deletions pnpm-lock.yaml

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