how to make getUserMedia() work on all browsers

后端 未结 5 447
执念已碎
执念已碎 2020-11-29 22:39

I learn about web-rtc, it says that you can capture video-cam , i used demo , well this worked on chrome only..

when i open it on firefox i get mess

5条回答
  •  盖世英雄少女心
    2020-11-29 23:06

    getUserMedia needs to be prefixed with webkit- or moz-. The first example is only prefixed with webkit-. Therefor it will never work on Firexox, only Chrome and Safari.

    The code example does not show the prefix...

    Prefixing can be done in this way:

    navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
    

提交回复
热议问题