[英]IBM Worklight 6.0 - Does the Mobile Browser Simulator support Worklight Skins?
[英]IBM Worklight 6.0 - Cordova camera simulation in the Mobile Browser Simulator doesn't work
我的相機代碼在WL 5.0.6中運行良好,並且移動瀏覽器模擬器可以正確顯示圖像。 現在,我移至WL 6.0,並且在移動瀏覽器模擬器中使用預覽並使用Cordova相機模擬來獲取偽圖片時遇到以下錯誤。
我正在使用Chrome瀏覽器進行預覽。
Not allowed to load local resource: file:///C:/Users/Administrator/cordova/internal/sim/camera/camera1_m.jpg wljq.js:2374
代碼與此類似
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.FILE_URI });
請注意,如果我使用DATA_URL,則使用移動瀏覽器模擬器似乎還可以。 似乎FILE_URI似乎不適用於移動瀏覽器模擬器。
Worklight 6.0 Mobile Browser Simulator支持Cordova 2.6 API。 對於navigator.camera.getPicture,可以在WL 6.0中使用以下目標類型:
Camera.DestinationType = {
DATA_URL : 0, // Return image as base64 encoded string
FILE_URI : 1, // Return image file URI
NATIVE_URI : 2 // Return image native URI (eg. assets-library:// on iOS or content:// on Android)
};
例:
navigator.camera.getPicture(
function(data) {
document.getElementById('camera_status').innerHTML = "Success: picture located at " + data;
var img = document.getElementById('camera_image');
img.style.display = "none";
},
function(e) {
console.log("Error getting picture: " + e);
document.getElementById('camera_status').innerHTML = "Error getting picture.";
},
{ quality: 50, destinationType: navigator.camera.DestinationType.FILE_URI, sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM, encodingType: fileType});
嘗試清除瀏覽器緩存,然后確保在Mobile Browser Simulator啟動時接受applet權限對話框。 此外,請確保您的文件許可權允許從C:/ Users // cordova / internal / sim / camera /文件夾進行傳輸,因為該位置是小程序存儲相機sim圖像內容的位置。
科爾多瓦2.6相機API參考: http : //docs.phonegap.com/en/2.6.0/cordova_camera_camera.md.html
有趣的是,已經有了針對您的問題的故障排除文檔。
http://www-01.ibm.com/support/docview.wss?uid=swg21614861
看起來DATA_URL在WLv5中不起作用,而FILE_URI從WLv6開始不起作用(如果您是正確的話)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.