phonegap如何调用摄像头并在video标签里显示出来?
2016-02-25 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
function uploadshow(typeid) {
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto,
function(message) { alert('没有获取到照片'); },
{ quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
// sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
sourceType: // 1表示摄像头 2表示从相册获取
(typeid==1)?navigator.camera.PictureSourceType.CAMERA:navigator.camera.PictureSourceType.PHOTOLIBRARY }
);
}
function uploadPhoto(imageURI) {
$("#uploadshowtext").text("正在上传......");
var options = new FileUploadOptions();
options.fileKey="file";
//alert(imageURI.fullPath);
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);//安卓的地址是 context://scard/dicm/121/234 这里无文件扩展名
//options.fileName=imageURI;
//options.mimeType="image/jpeg";
options.mimeType="multipart/form-data";//这两个参数修改了,后台就跟普通表单页面post上传一样 enctype="multipart/form-data"
//options.mimeType="application/octet-stream";
options.chunkedMode = false;
var params = new Object();
params.pid = kget("pid");
params.feeid = feeid;
options.params = params;
var ft = new FileTransfer();
ft.upload(imageURI, "http://server.com/uploadshow.asp?action=upload", win, fail, options);
}
function win(r) {
//alert(JSON.parse(r.response).err);
//alert("Code = " + r.responseCode);
alert("上传成功");
// alert("Sent = " + r.bytesSent);
}
function fail(error) {
alert("An error has occurred: Code = " + error.code);
}
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto,
function(message) { alert('没有获取到照片'); },
{ quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
// sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
sourceType: // 1表示摄像头 2表示从相册获取
(typeid==1)?navigator.camera.PictureSourceType.CAMERA:navigator.camera.PictureSourceType.PHOTOLIBRARY }
);
}
function uploadPhoto(imageURI) {
$("#uploadshowtext").text("正在上传......");
var options = new FileUploadOptions();
options.fileKey="file";
//alert(imageURI.fullPath);
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);//安卓的地址是 context://scard/dicm/121/234 这里无文件扩展名
//options.fileName=imageURI;
//options.mimeType="image/jpeg";
options.mimeType="multipart/form-data";//这两个参数修改了,后台就跟普通表单页面post上传一样 enctype="multipart/form-data"
//options.mimeType="application/octet-stream";
options.chunkedMode = false;
var params = new Object();
params.pid = kget("pid");
params.feeid = feeid;
options.params = params;
var ft = new FileTransfer();
ft.upload(imageURI, "http://server.com/uploadshow.asp?action=upload", win, fail, options);
}
function win(r) {
//alert(JSON.parse(r.response).err);
//alert("Code = " + r.responseCode);
alert("上传成功");
// alert("Sent = " + r.bytesSent);
}
function fail(error) {
alert("An error has occurred: Code = " + error.code);
}
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家提供动态代理服务器服务的企业,旨在帮助用户更好地管理网络访问和安全。以下是一些关于StormProxies的IP动态代理服务的特点:1. 高匿名性:StormProxies的动态代理服务器具有高匿名性,可以有效...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询