Hallo, i try to make ketai camera work in VR mode is it possible?
i have the following code from ketai and imported VR
/**
* <p>Ketai Sensor Library for Android: http://ketai.org</p>
*
* <p>Ketai Camera Features:
* <ul>
* <li>Interface for built-in camera</li>
* <li>Access camera flash</li>
* </ul>
* <p>Updated: 2017-09-01 Daniel Sauter/j.duran</p>
*/
import ketai.camera.*;
import processing.vr.*;
KetaiCamera cam;
void setup() {
fullScreen(STEREO);
//orientation(LANDSCAPE);
imageMode(CENTER);
cam = new KetaiCamera(this, 320, 240, 24);
cam.start();
}
void draw() {
if (cam != null && cam.isStarted())
image(cam, width/2, height/2, cam.width, cam.height);
else
{
background(128);
//text("Camera is currently off.", width/2, height/2);
}
//drawUI();
}
void onCameraPreviewEvent()
{
cam.read();
}
but after builded successfully when it tries to open in the phone it crashes with
FATAL EXCEPTION: main
Process: processing.test.cameragettingstarted2, PID: 14687
java.lang.ClassCastException: processing.android.PFragment cannot be cast to com.google.vr.sdk.base.GvrActivity
at processing.vr.VRSurface.<init>(VRSurface.java:68)
at processing.vr.VRGraphicsStereo.createSurface(VRGraphicsStereo.java:33)
at processing.core.PApplet.initSurface(PApplet.java:538)
at processing.android.PFragment.onCreateView(PFragment.java:149)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:210)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1436)
at android.app.Activity.performStart(Activity.java:8024)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3456)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2067)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7698)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
is it possible to use the camera in VR mode?