我在UIImagePicker上有一个按钮,我希望它在点击时发出一些声音.为此,我在我的项目资源中有m4a和mp3格式的声音(用于测试目的).
我尝试通过多种方式播放声音,尝试使用m4a和mp3格式,但没有任何东西从iPhone(不是模拟器)中消失.
框架包含在项目中.
这是我的示例代码:
#import <AudioToolBox/AudioToolbox.h>
#import <AVFoundation/AVAudioPlayer.h>
- (IBAction) click:(id)sender {
// Try
/*
SystemSoundID train;
AudioServicesCreateSystemSoundID(CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("TheSound"), CFSTR("mp3"), NULL), &train);
AudioServicesPlaySystemSound(train);
*/
// Try
/*
NSError *error;
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource: @"TheSound" withExtension: @"mp3"] error:&error];
[audioPlayer play];
[audioPlayer release];
*/
// Try (works)
//AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
// Try
/*
SystemSoundID soundID;
NSURL *filePath = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"TheSound" ofType:@"mp3"] isDirectory:NO];
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
AudioServicesPlaySystemSound(soundID);
*/
NSLog(@"Clicked");
}
Run Code Online (Sandbox Code Playgroud)
你能告诉我出了什么问题吗?
在我的应用程序中,我使用相机,当用户拍照时,我的应用程序将其编码为JPEG +各种其他操作.这需要几秒钟,但它会导致无法响应的用户界面,而其工作=糟糕的用户体验!
有没有办法向用户展示一些东西 - 也许是一个进度条 - 当应用正在处理图片时?
在我的应用程序中,我想使用相机捕获图像并发送到服务器.
当用户打开我的应用程序的相机部分时,我想向他显示他正在使用的设备的默认相机.目前以下是我用来捕捉图像的两行代码
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, TAKE_RECEIPT);
Run Code Online (Sandbox Code Playgroud)
当我在HTC设备中运行此代码时,在捕获图像后,它显示了带有完成和重拍按钮的图像预览.当我点击完成后,它将移至上一个活动.
当我在moto设备中使用代码时,在捕获图像后,它显示了带有插入,重新拍摄和取消的图像预览.当我点击完成后,它将移至上一个活动.
像这样,所有设备都会有所不同.因此,当我点击任何设备的完成或插入或任何其他按钮肯定按钮时,我想开始上传过程.
如何处理请帮帮我....
我想在我的Android应用程序中集成条形码扫描程序.
我试图添加zxing库,但我的所有应用程序都是在没有扫描的情况下显示摄像机视图.
http://code.google.com/p/zxing/
有没有一种简单的方法来集成条形码扫描功能?
我正在尝试使用pyOpenGL,但我无法让相机正常工作.
def Draw():
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glRotatef(roty,1,0,0)
glRotatef(rotx,0,1,0)
glTranslate(0,0,eyez)
glPushMatrix()
glTranslate(0,0,-80)
glBegin(GL_QUADS)
glColor(0,1,0)
glVertex3f(-50,-5,10)
glVertex3f(-50,50,10)
glVertex3f(50,50,10)
glVertex3f(50,-5,10)
glColor(1,0,0)
glVertex3f(-50,-5,10)
glVertex3f(-50,50,10)
glVertex3f(-50,50,70)
glVertex3f(-50,-5,70)
glEnd()
glPopMatrix()
glutSwapBuffers()
Run Code Online (Sandbox Code Playgroud)
这些旋转效果很好,但我无法向相机朝向的方向前进.当我修改代码以便能够以这种方式向前移动时,场景将无法正确旋转.如果我回到足够远的地方,将会发生一个圆圈旋转的情况.
几天以来,我一直在使用CAMERA模块进行应用.我已经定制了完整的相机模块,而不是通过意图调用硬件内置的移动相机.我已经使用了快门,图片等的回叫.现在我正在尝试为这个定制的相机添加ZOOM和AUTO-FOCUS功能.任何人都可以告诉我添加ZOOM和AUTO-FOCUS功能的方法以及清单文件中应该提到的所需权限..希望我会尽快得到帮助.
我正在构建一个Camera应用程序并在拍照后(在写入PictureCallback中的文件之后),我想更新设备上的媒体文件,因此我使用MediaScannerConnection(如下面的代码所示).但是,我无法在设备上的图库应用程序中查看图像.但是我可以在PC上查看图像(图像在SD卡上).我错过了什么吗?
MediaScannerConnection.scanFile(this,
new String[] {pictureFile.toString()}, null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Log.d("ExternalStorage", "Scanned " + path + ":");
Log.d("ExternalStorage", "-> uri=" + uri);
}
});
我在OpenGL中遇到问题让我的对象(一个行星)相对于当前的相机旋转旋转.它似乎首先工作,但在旋转一点后,旋转不再正确/相对于相机.
我正在计算屏幕上mouseX和mouseY移动的增量(差异).旋转存储在称为"planetRotation"的Vector3D中.
这是我的代码来计算相对于planetRotation的旋转:
Vector3D rotateAmount;
rotateAmount.x = deltaY;
rotateAmount.y = deltaX;
rotateAmount.z = 0.0;
glPushMatrix();
glLoadIdentity();
glRotatef(-planetRotation.z, 0.0, 0.0, 1.0);
glRotatef(-planetRotation.y, 0.0, 1.0, 0.0);
glRotatef(-planetRotation.x, 1.0, 0.0, 0.0);
GLfloat rotMatrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX, rotMatrix);
glPopMatrix();
Vector3D transformedRot = vectorMultiplyWithMatrix(rotateAmount, rotMatrix);
planetRotation = vectorAdd(planetRotation, transformedRot);
Run Code Online (Sandbox Code Playgroud)
理论上 - 它的作用是在'rotateAmount'变量中设置一个旋转.然后通过将此向量与逆模型变换矩阵(rotMatrix)相乘,将其转换为模型空间.
然后将该变换后的旋转添加到当前旋转.
要渲染这是正在设置的转换:
glPushMatrix();
glRotatef(planetRotation.x, 1.0, 0.0, 0.0);
glRotatef(planetRotation.y, 0.0, 1.0, 0.0);
glRotatef(planetRotation.z, 0.0, 0.0, 1.0);
//render stuff here
glPopMatrix();
Run Code Online (Sandbox Code Playgroud)
相机有点摆动,我试图执行的旋转,似乎与当前的变换无关.
我究竟做错了什么?
我试图启动这样的相机意图时遇到了这个问题:
String imagePath;
imagePath = Environment.getExternalStorageState() + "/images/myimage.jpg";
File file = new File( imagePath );
Uri outputFileUri = Uri.fromFile( file );
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQUEST_CAMERA);
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:REQUEST_CAMERA无法解析为变量
任何帮助表示赞赏!
问候克里斯
我想写一个iPhone应用程序,允许你在很短的时间内连续拍摄2张照片,我想知道它是否可以实现.市场上的应用程序似乎只能从视频流中获取低分辨率的静止帧,所以我想知道快速捕获全分辨率照片是否可行.