Languages

Menu
Sites
Language
Use Rear Camera

Hello,

 

I want to capture video from rear camear;

Here is code I am using now

var options = {

audio: false,

video: true

};

 

navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;

try {

if (typeof (navigator.getUserMedia) === 'function') {

navigator.getUserMedia(options, this.onCaptureVideoSuccess.bind(this), this.onCaptureVideoError.bind(this));

}

} catch (e) {

alert('navigator.getUserMedia() error.');

console.error('navigator.getUserMedia() error: ' + e.message);

}

 

This is showing camera input from front camera.

I think tizen device is having rear camear and how can I get signal from it.

 

Thanks.

Christian.

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

8 Replies
Raghu Kona
Hi Christian, Currently, only front camera is supported, no option available to select back camera using Web APIs. Regards, Raghu Kona
Didier De Nadai
Hi! Is there anything new about that in the new version (2.2)? Is there any plan to support the back camera in web apis ? Thanks, Didier
Raghu Kona
Hi Didier, Unfortunately, even in the latest Tizen release 2.2 there is no support for accessing the back camera using Web APIs. Regards, Raghu Kona
Didier De Nadai
Hi! Indeed that was my understanding based on the documentation :( Let's hope it will evolve in the coming releases! Cheers, Didier
Md. Mafrul Alam

Is Web api  to launch Rear Camera available in current version..?

Marco Buettner

Since Tizen 2.4 the property "facingMode" of getUserMedia are supported.

https://developer.tizen.org/community/code-snippet/web-code-snippet/how-use-rear-camera-tizen-2.4?tab=all

Seoghyun Kang

Please refer the following code.

 

// Front Camera
var frontCamera = function () {
    navigator.getUserMedia(
     {
   audio: false, 
   video: true
  } 
  , null, null);
};
 
 
// Rear Camera
var rearCamera = function () {
    navigator.getUserMedia(
  {
   audio: false, 
   video: true,
   facingMode: "environment"
  } 
  , null, null);
};

 

■ Reference Site
- http://www.w3.org/TR/mediacapture-streams/#constraints

Md. Mafrul Alam

Thank you for response. After using facingMode: "environment" rear camera is working but camera preview showing  reverse direction. Could you please tell me where i am wrong. My source code is given below---

function getVideoStream() {
    navigator.webkitGetUserMedia({
        audio:false,
        video: true,
        facingMode: "environment"
        }, SuccessCallBack, ErrorCallBack);
}