当摄像头捕获视频时,是否有方法通过broadcast接收器(或任何其他方式)进行检测。BroadCast Reciever检测视频是从摄像头捕获的
我一直在使用下面的代码做了同样的相机照片:
在清单:
<receiver
android:name=".CameraPhotoReceiver"
android:enabled="true" >
<intent-filter>
<action android:name="com.android.camera.NEW_PICTURE" />
<action android:name="android.hardware.action.NEW_PICTURE" />
<data android:mimeType="image/*" />
</intent-filter>
</receiver>
广播接收器类:
public class CameraPhotoReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent arg1)
{
// TODO Auto-generated method stub
Cursor cursor = context.getContentResolver().query(arg1.getData(), null, null, null, null);
cursor.moveToFirst();
String image_path = cursor.getString(cursor.getColumnIndex("_data"));
Toast.makeText(context, "New Photo is Saved as : " + image_path, Toast.LENGTH_SHORT).show();
}
}
我想要陪伴plish是在从摄像头捕获新视频时从广播接收器onReceive上传视频。
等待从您的经验中学习。在此先感谢
编辑:具体来说,我要做到这一点只有从相机捕获的视频
:刚刚尝试对清单中的相机按钮CLIK事件和检查广播接收器类的输出,该输出图像或video..if它是视频,然后执行上传到服务器的动作。 – 2015-02-24 12:06:04
@BornToWin plz一行或两行代码可以解决我的问题 – 2015-02-24 12:09:46
:我不明白你在说什么? – 2015-02-24 12:12:33