How can I use a MediaRecorder object in an Angular2 application?

后端 未结 7 479
刺人心
刺人心 2021-01-03 21:15

I\'m building a small Angular2 app and I\'m trying to use a MediaRecorder object (https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder) like so:

va         


        
7条回答
  •  伪装坚强ぢ
    2021-01-03 22:09

    You can now add types for MediaRecorder even easier, just install them through npm.

    npm install @types/dom-mediacapture-record

    This will load the latest type definitions from DefinitelyTyped. They will automatically work, no extra steps. If you have any improvements for the typings feel free to contribute them to DefinitelyTyped.

    That solution proposed by Elias Meire is the best for me. But indeed I needed some extra steps to make it work. As stated in this issue on github https://github.com/Microsoft/TypeScript/issues/11420#issuecomment-341625253, you have to reference it to use it with this line:

    /// 
    

提交回复
热议问题