I tried to using method in com.webos.service.camera2
getCameraList(),
open(),
getInfo() and
getProperties() methods work well.
but, When I tried startProperties() method, I met an error
HTML code
<input type="text" placeholder="handle(335)" class="input_box" id="input_start_preview">
<div class="button": id="button_start_preview">
start preview
</div>
JS code
function startPreview_callback(msg){
var arg = JSON.parse(msg);
if (arg.returnValue) {
console.log("[StartPreview] Success [key: " + arg.key + "]");
}
else{
console.error("[StartPreview] Failed, error <" + arg.errorCode + "> : " + arg.errorText);
}
}
// camera2/startPreview(handle)
function startPreview(handle){
var url = 'luna://com.webos.service.camera2/startPreview';
var params = JSON.stringify({
"handle": Number(handle),
"params":{
"type": "sharedmemory",
"source": "0"
}
})
bridge.onservicecallback = startPreview_callback;
bridge.call(url,params);
}
document.getElementById("button_start_preview").onclick = function() {
var handle = document.getElementById("input_start_preview").value;
startPreview(handle);
}
I view a journal log.
Jul 20 01:25:32 qemux86 webapp-mgr.sh[300]: [ERROR:CONSOLE(1)] "[StartPreview] Failed, error <5> : Can not start", source: file:///media/developer/apps/usr/palm/applications/com.domain.tutorial/index.js (1)
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera service {} CameraService::startPreview ndevhandle : 6718
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera CommandHandler {} startPreview : devhandle : 6718
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera VirtualDeviceManager {} startPreview : devhandle : 6718
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera VirtualDeviceManager {} startPreview : deviceid : 7669
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera service {} DeviceManager::isDeviceOpen !!
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera DeviceManager {} find_devnum : ndevcount_: 1
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera DeviceManager {} find_devnum : gdev_status[0].nDevIndex : 1
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera DeviceManager {} find_devnum : gdev_status[0].nDeviceID : 7669
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera DeviceManager {} find_devnum : ndevicehandle : 7669
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera DeviceManager {} dev_num is :0
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera service {} isDeviceOpen : *deviceID : 7669
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera service {} isDeviceOpen : *gdev_status[0].nDeviceID : 7669
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera service {} isDeviceOpen : gdev_status[0].isDeviceOpen : 1
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera DeviceManager {} Device is open
!!
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera VirtualDeviceManager {} startPreview : Camera State : 2
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera service {} err_id != DEVICE_OK
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] camera service {} output_reply {"errorCode":5,"returnValue":false,"errorText":"Can not start"}
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] <default-lib> LS_NOT_AN {} Enhanced ACG
Jul 20 01:25:32 qemux86 com.webos.service.camera2[398]: [] [pmlog] <default-lib> LS_NOT_AN {} [_LSCheckProvidedTrustedGroups] found group bit mask : 2
Jul 20 01:25:32 qemux86 WebAppMgr[300]: [] [pmlog] wam.log ERROR {} 300:300 2[CONSOLE:1] "\"[StartPreview] Failed, error \u003C5> : Can not start\", source: file:///media/developer/apps/usr/palm/applications/com.domain.tutorial/index.js (1)\n"
I used Emulator, and USB webcam (NCWC-01)
How can I resolve this error?
Sorry, I'm not good at English.
This is my git repository link
https://github.com/THINCAR/webOS_OSE_tutor