-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
trackRef
as primary way of passing track info around, deprecate…
… participant/source based APIs (#627)
- Loading branch information
Showing
30 changed files
with
646 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@livekit/components-react': minor | ||
'@livekit/components-core': patch | ||
--- | ||
|
||
fix handling of multiple tracks of the same source from the same participant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@livekit/components-core": patch | ||
"@livekit/components-react": patch | ||
--- | ||
|
||
fix handling of multiple tracks of the same source from the same participant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@livekit/components-react': minor | ||
'@livekit/component-example-next': patch | ||
--- | ||
|
||
refactor `ParticipantTile` and `useParticipantTile` to trackRef and rename `TrackContext` to `TrackRefContext`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@livekit/components-react': minor | ||
--- | ||
|
||
Update AudioTrack and VideoTrack components to accept track references. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
packages/core/src/track-reference/track-reference.utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { describe, test, expect, expectTypeOf } from 'vitest'; | ||
import { mockTrackReferencePlaceholder, mockTrackReferenceSubscribed } from './test-utils'; | ||
import type { Participant, TrackPublication } from 'livekit-client'; | ||
import { Track } from 'livekit-client'; | ||
import { isPlaceholderReplacement } from './track-reference.utils'; | ||
|
||
describe('Test mocking functions ', () => { | ||
test('mockTrackReferenceSubscribed without options.', () => { | ||
const mock = mockTrackReferenceSubscribed('MOCK_ID', Track.Source.Camera); | ||
expect(mock).toBeDefined(); | ||
// Check if the participant is mocked correctly: | ||
expect(mock.participant).toBeDefined(); | ||
expect(mock.participant.identity).toBe('MOCK_ID'); | ||
expectTypeOf(mock.participant).toMatchTypeOf<Participant>(); | ||
|
||
// Check if the publication is mocked correctly: | ||
expect(mock.publication).toBeDefined(); | ||
expect(mock.publication.kind).toBe(Track.Kind.Video); | ||
expectTypeOf(mock.publication).toMatchTypeOf<TrackPublication>(); | ||
|
||
// Check if the source is mocked correctly: | ||
expect(mock.source).toBeDefined(); | ||
expect(mock.source).toBe(Track.Source.Camera); | ||
expectTypeOf(mock.source).toMatchTypeOf<Track.Source>(); | ||
}); | ||
}); | ||
|
||
describe('Test if the current TrackReferencePlaceholder can be replaced with the next TrackReference.', () => { | ||
test.each([ | ||
{ | ||
currentTrackRef: mockTrackReferencePlaceholder('Participant_A', Track.Source.Camera), | ||
nextTrackRef: mockTrackReferenceSubscribed('Participant_A', Track.Source.Camera, { | ||
mockPublication: true, | ||
}), | ||
isReplacement: true, | ||
}, | ||
{ | ||
currentTrackRef: mockTrackReferencePlaceholder('Participant_B', Track.Source.Camera), | ||
nextTrackRef: mockTrackReferenceSubscribed('Participant_A', Track.Source.Camera, { | ||
mockPublication: true, | ||
}), | ||
isReplacement: false, | ||
}, | ||
{ | ||
currentTrackRef: mockTrackReferencePlaceholder('Participant_A', Track.Source.ScreenShare), | ||
nextTrackRef: mockTrackReferenceSubscribed('Participant_A', Track.Source.Camera, { | ||
mockPublication: true, | ||
}), | ||
isReplacement: false, | ||
}, | ||
])( | ||
'Test if the current TrackReference was the placeholder for the next TrackReference.', | ||
({ nextTrackRef: trackRef, currentTrackRef: maybePlaceholder, isReplacement }) => { | ||
const result = isPlaceholderReplacement(maybePlaceholder, trackRef); | ||
expect(result).toBe(isReplacement); | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.