将图像保存到相册
var _picsTaken = 0;
var timer = {};
Titanium.Media.showCamera ({
saveToPhotoGallery: true,
allowEditing: false,
autohide:false, //Important!
success: function(event){
timer = setInterval(function(){
Ti.Media.takePicture();
if(_picsTaken++ > 5){
clearInterval(timer);
_picsTaken = 0;
}
}, 5000);
},
error: function(error){
var a = Titanium.UI.createAlertDialog({
title: 'Camera'
});
if (error.code == Titanium.Media.NO_CAMERA || error.code == Titanium.Media.NO_VIDEO) {
a.setMessage(L('no_camera'));
}
else {
a.setMessage('Unexpected error: ' + error.code);
}
a.show();
},
cancel:function()
{
Titanium.include('db.js');
},
});
我正在尝试在 Titan Studio(1.7) 上制作一个基于 ios 的应用程序。我在这里想做的是每 5 秒自动连续单击图片并保存。但这段代码只保存了第一张图片。我尝试对代码进行很多更改,但似乎没有任何效果。请在这方面帮助我。我真的很感激任何形式的帮助。提前致谢。
var _picsTaken = 0;
var timer = {};
Titanium.Media.showCamera ({
saveToPhotoGallery: true,
allowEditing: false,
autohide:false, //Important!
success: function(event){
timer = setInterval(function(){
Ti.Media.takePicture();
if(_picsTaken++ > 5){
clearInterval(timer);
_picsTaken = 0;
}
}, 5000);
},
error: function(error){
var a = Titanium.UI.createAlertDialog({
title: 'Camera'
});
if (error.code == Titanium.Media.NO_CAMERA || error.code == Titanium.Media.NO_VIDEO) {
a.setMessage(L('no_camera'));
}
else {
a.setMessage('Unexpected error: ' + error.code);
}
a.show();
},
cancel:function()
{
Titanium.include('db.js');
},
});
I am trying to make an ios based app on titanium studio(1.7). What I am trying to do here is click pictures continuously automatically every 5 seconds and save it. But this code only saves the first picture. I have tried to change a lot in the code, but nothing seems to work. Please help me in this regard. I would really appreciate any sort of help. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: