Git Product home page Git Product logo

fake-mediastreamtrack's People

Contributors

ibc avatar jmillan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jmillan

fake-mediastreamtrack's Issues

[bug][ts] readyState and constraints constructor types incorrect

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!

Compitability with RTCVideoSink

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?

Is it possible to use the package in browser with Browserify?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.