Chrome禁止弹出是否允许使用摄像头

2016/3/1 12:31 下午 目录  开发总结 评论

搜索关键字:always open camera on chrome 1

  • 方案一: chrome启动时加上–use-fake-ui-for-media-stream参数2

    • windows启动脚本

       #For full screen access
      start chrome --kiosk "http://localhost:8080" --use-fake-ui-for-media-stream
      #For normal access
      start chrome "http://localhost" --use-fake-ui-for-media-stream
      
    • Linux启动方式

      google-chrome "http://localhost" --use-fake-ui-for-media-stream
      
    • mac 方式

      /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome "http://localhost" --use-fake-ui-for-media-stream
      
  • 方案二:重写提示策略(Chromium)
    VideoCaptureAllowedUrls3

    Patterns in this list will be matched against the security origin of the requesting URL. If a match is found, access to audio capture devices will be granted without prompt. NOTE: This policy is currently only supported when running in Kiosk mode.

    凡是网站url匹配videocaptureallowedurls规则的,无需提示框即可访问摄像头。
    VideoCaptureAllowedUrls

参考文档