How to obtain object from navigator.getUserMedia()

2019-09-15 17:14发布

Trying to get a JavaScript reference/promise to a MediaStream returned from MediaDevices in HTML5 and WebRTC.

JavaScript here is run on Chrome and Safari on iOS and Android.

navigator.mediaDevices.getUserMedia(session, initRec , onErr);

This throws TypeError: undefined is not an object (evaluating 'navigator.mediaDevices.getUserMedia')

Fine, let's try it the slightly older way:

navigator.getUserMedia(parms,initfunc,errfunc);

This throws TypeError: navigator.getuserMedia is not a function. (In 'navigator.getUserMedia(parms,initfunc,errfunc)', 'navigator.getUserMedia' is undefined)

Note: Both of those calls work on desktop versions. Did mobile web EVER work for audio recording?

1条回答
手持菜刀,她持情操
2楼-- · 2019-09-15 17:45

Safari (or any browser on iOS) does not support getUserMedia and WebRTC until the upcoming Safari 11. See the webkit blog post for details and note that it does not mention the MediaRecorder API.

查看更多
登录 后发表回答