2015-12-18 54 views
0

我做的:流星:千年發展目標:相機包失敗

MeteorCamera.getPicture({ 
      quality : 85 
     }, function(err, data) { 
      if (err) { 
       console.error(err); 
      } else { 
       Session.set("photoUri", data); 
      } 
     }); 

如果我運行流星本地和訪問本地主機:3000,一切正常。

但是,如果我考這一個meteor.com部署....

在Chrome中,我看到一個對話框:

Camera Permissions Denied 
You have denied this app permission to use your camera. If you would like to allow permissions, follow the directions for your browser below. 

Google Chrome 
Go to Settings > "Show advanced settings..." > "Content settings..." > Media heading > "Manage exceptions...", then find this website in the list and allow video capture. 

Mozilla Firefox 
Reload the page and try again. 

Opera 
Go to Preferences > Websites > Media heading > "Manage exceptions...", then find this website in the list and allow video capture. 

我確實發現了 「異常」 設定(比描述在不同的地方)的問題,但似乎沒有辦法來編輯這個名單....

所以,我想在Firefox中,在這裏我只看到:

There was an error accessing the camera. 

既不Chrome瀏覽器也沒有將任何錯誤傳遞給回調函數。

此行爲在Android設備上的桌面和瀏覽器上相同。

回答

1

從Chrome的控制檯:

getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details 

本地主機之外,你必須運行一個安全的網站(HTTPS)才能正常工作。

試試這個,證明了以上:
http://cheese-test.meteor.com/
VS
https://cheese-test.meteor.com/