ibc / fake-mediastreamtrack Goto Github PK
View Code? Open in Web Editor NEWFake W3C MediaStreamTrack implementation
Fake W3C MediaStreamTrack implementation
Hey @ibc,
thanks for this library, it's a big simplification when testing code around media streams and tracks in jest!
Upon some more advanced usage I noticed a potential bug in the typescript definitions for the constructor:
readyState
is typed as MediaTrackConstraints
and constraints
is typed as any
.
readyState
should probably be of type string
instead (or more specific values, like 'live' | 'ended'
).
constraints
should probably have the MediaTrackConstraints
type.
Would be great to have that fixed for the future ๐
Thanks in advance!
Hi, I want tu use FakeMediaStreamTrack with RTCVideoSink constructer however I get en error:
TypeError: This is not an instance of MediaStreamTrack
I try to do it like const sink = new RTCVideoSink(consumer.track);
I do it in context of node.js client to mediasoup app, using mediasoup-client-aiortc.
Is there a way around it?
Hey, I've just tried this package, it looks to be useful for solving couple of my WebRTC problems.
However, when I try to use it in a browser, both Chrome and Firefox complain:
media.js:10 Uncaught TypeError: Failed to execute 'addTrack' on 'MediaStream': parameter 1 is not of type 'MediaStreamTrack'.
at Object.47.fake-mediastreamtrack (media.js:10)
at o (_prelude.js:1)
at _prelude.js:1
at Object.49../common (room.js:5)
at o (_prelude.js:1)
at r (_prelude.js:1)
at _prelude.js:1
It was probably not intended to be used in a browser, but the error looks to be not really deep.
It's just a mismatch of types when FakeMediaStreamTrack
gets into a TypeScript function expecting normal MediaStreamTrack
.
The function is MediaStream.addTrack
in my case. I am hoping to initialize the media stream being published with fake tracks in the beginning, replacing them with real ones when a user decides to share them. This could help to add new tracks without SDP renegotiation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.