diff --git src/bp-core/js/webcam.js src/bp-core/js/webcam.js
index 2584465..a20047a 100644
|
|
window.bp = window.bp || {}; |
25 | 25 | flipped: false |
26 | 26 | }; |
27 | 27 | |
| 28 | this.testWebCam(); |
| 29 | |
28 | 30 | bp.Avatar.nav.on( 'bp-avatar-view:changed', _.bind( this.setView, this ) ); |
29 | 31 | }, |
30 | 32 | |
| 33 | testWebCam: function() { |
| 34 | // camera is already disabled via code snippet |
| 35 | var cameraTab = jQuery('#bp-avatar-camera'); |
| 36 | if ( cameraTab.length === 0 ) { |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | var getUserMedia = navigator.getUserMedia || navigator.oGetUserMedia || navigator.mozGetUserMedia || navigator.webkitGetUserMedia || navigator.msGetUserMedia; |
| 41 | |
| 42 | if ( getUserMedia ) { |
| 43 | getUserMedia = getUserMedia.bind(navigator); |
| 44 | |
| 45 | getUserMedia( |
| 46 | {video: true}, |
| 47 | |
| 48 | // success callback |
| 49 | function (stream) { |
| 50 | }, |
| 51 | |
| 52 | // error callback |
| 53 | function (error) { |
| 54 | cameraTab.remove(); |
| 55 | } |
| 56 | ) |
| 57 | |
| 58 | // no support; drop camera tab |
| 59 | } else { |
| 60 | cameraTab.remove(); |
| 61 | } |
| 62 | }, |
| 63 | |
31 | 64 | setView: function( view ) { |
32 | 65 | if ( 'camera' !== view ) { |
33 | 66 | // Stop the camera if needed |