2 Replies Latest reply on Feb 18, 2014 5:15 AM by Dele Olajide

    camera facing mode

    simon wu

      ofmeet open the front camera by default when using Android device. I used facingMode option in spec to select the back camera, but with no luck. Any idea? The spec I used to choose camera is below. In my test I changed "user" to "environment".

       

      {

        mandatory: {

          width: { min: 640 },

          height: { min: 480 }

        },

        optional: [

          { width: 650 },

          { width: { min: 650 }},

          { frameRate: 60 },

          { width: { max: 800 }},

          { facingMode: "user" }

        ]

      }

        • Re: camera facing mode
          simon wu

          I got a workaround to choose the back camera in application from the demos along with webrtc project. The demo is located in \WebRTC\samples\js\demos\html\device-switch.html. The basic idea is to get souce id which identify front/back camera by calling MediaStreamTrack.getSources,and then pass the souce id to getUserMedia.

           

          MediaStreamTrack.getSources(gotSources);

           

          getUserMedia({ audio: {optional: [{sourceId: audio_source}]},

                           video: {optional: [{sourceId: video_source}]}

                         }, gotStream, function() {});