html5 cordova,Difference between HTML5+Cordova project and Standard HTML5 project

本文探讨了InXDK平台中创建HTML5+Cordova项目与Standard HTML5项目的不同之处,重点关注这两种类型项目的输出格式、可用功能及API差异,并通过示例代码对比了使用Cordova与纯HTML5进行摄像头操作的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

In XDK, we are forced to choose between creating a HTML5+Cordova project and Standard HTML5 project.

I have not been able to find a discussion on the differences between them.

Some people believes that a Standard HTML5 project means that it will be hosted on remote web server like a Single Page App (SPA). LIke a bunch of static HTML, JS, CSS files for web server.

My personal guess is they differ in the output format after a build? For Cordova projects, they can be built into Android .apk and iOS .ipa format? While Standard HTML5 project would build into a ZIP archive for uploading to web server?

More specifically, what will a developer lose out when he chooses the Standard HTML5 project, without Cordova. Certainly Cordova plugins will not be available but HTML5 capabilities in geo-location, WebSocket, WebRTC, camera, video, audio, and storage handling can handle many of the basic tasks. Perhaps without accelerometer.

The main difference could be in the API. For example to take a photo:

Cordova

navigator.camera.getPicture(onSuccess, onFail, {

quality: 50,

destinationType: Camera.DestinationType.DATA_URL

});

HTML5

navigator.webkitGetUserMedia('video, audio', onSuccess, onError);

function onSuccess(stream) {

var output = document.getElementById('output'); //a element

output.autoplay = true; //you can set this in your markup as well

output.src = is_webkit ? window.webkitURL.createObjectURL(stream) : stream;

}

function takepicture(videoOutput, width, height) {

var canvas = document.getElementById('canvas'),

photo = document.querySelector('photo');

canvas.width = width;

canvas.height = height;

canvas.getContext('2d').drawImage(videoOutput, 0, 0, width, height);

var data = canvas.toDataURL('image/png');

photo.setAttribute('src', data);

}

Hope experienced XDK users and Intel can address this.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值