Avoiding NavigatorUserMediaError “Only secure origins are allowed” on HTTP in Chrome

后端 未结 2 1383
太阳男子
太阳男子 2021-01-17 17:18

I\'m trying to make some audio/video tests with a JavaScript library for SIP phones and since Chrome 47 I can no longer test in local development because of this error:

2条回答
  •  轮回少年
    2021-01-17 17:48

    The unsafely-treat-insecure-origin-as-secure flag works for me as documented here.

    On OS X this looks like:

    $ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/foo --unsafely-treat-insecure-origin-as-secure=http://alt.local:8080
    

    For various reasons, my local development server doesn't run on localhost or port 80. Specifying the alternative port appears to be necessary.

    The user-data-dir directive appears to create a temporary sandbox profile in Chrome.

提交回复
热议问题