Skip to content

Instantly share code, notes, and snippets.

@Oleur
Last active October 13, 2016 07:50
Show Gist options
  • Save Oleur/c8fab90f0a0c02b96035c33e2649b25a to your computer and use it in GitHub Desktop.
Save Oleur/c8fab90f0a0c02b96035c33e2649b25a to your computer and use it in GitHub Desktop.
JNI Call from Unity
// Can't use AndroidJavaObject.Call() with a jobject, must use low level interface
IntPtr setSimplePlayerID = AndroidJNI.GetMethodID(localMediaPlayer.GetRawClass(), "setSurface", "(Landroid/view/Surface;)V");
jvalue[] parms = new jvalue[1];
parms[0] = new jvalue();
parms[0].l = _androidSurface; // Android Surface reference as an IntPtr
AndroidJNI.CallVoidMethod(localMediaPlayer.GetRawObject(), setSimplePlayerID, parms);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment