forked from jitsi/lib-jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RTC): add support for creating non-standard tracks (jitsi#2409)
* feat(RTC): add support for creating non-standard tracks * fix(RTC): add additional checks for creating tracks via mediastream * fix(RTC): simplify options to create track * fix(RTC): fix tests * fix(RTC): update sourceId documentation
- Loading branch information
1 parent
43b8340
commit 8419c89
Showing
6 changed files
with
96 additions
and
4 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,39 @@ | ||
import JitsiMeetJS from './JitsiMeetJS'; | ||
import { VideoType } from './service/RTC/VideoType'; | ||
import { MediaType } from './service/RTC/MediaType'; | ||
import { JitsiTrackErrors } from './JitsiTrackErrors'; | ||
|
||
describe('JitsiMeetJS', () => { | ||
describe('createLocalTracksFromMediaStreams', () => { | ||
it('creates a local track from a media stream', () => { | ||
const canvas = document.createElement('canvas'); | ||
|
||
const canvasStream = canvas.captureStream(5); | ||
const trackInfo = { | ||
stream: canvasStream, | ||
sourceType: 'canvas', | ||
mediaType: MediaType.VIDEO, | ||
videoType: VideoType.DESKTOP | ||
}; | ||
const newTracks = JitsiMeetJS.createLocalTracksFromMediaStreams([ trackInfo ]); | ||
|
||
expect(newTracks).toBeDefined(); | ||
expect(newTracks.length).toBe(1); | ||
}); | ||
|
||
it('throws an error if track is not the correct media type', () => { | ||
const canvas = document.createElement('canvas'); | ||
|
||
const canvasStream = canvas.captureStream(5); | ||
const trackInfo = { | ||
stream: canvasStream, | ||
sourceType: 'canvas', | ||
mediaType: MediaType.AUDIO, | ||
videoType: VideoType.DESKTOP | ||
}; | ||
|
||
expect(() => JitsiMeetJS.createLocalTracksFromMediaStreams([ trackInfo ])) | ||
.toThrowError(JitsiTrackErrors.TRACK_NO_STREAM_TRACKS_FOUND); | ||
}); | ||
}); | ||
}); |
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