How localplayback errors are notified from C++ to java mediaplayer/ mediarecorder layer/Application in android ?
How localplayback errors are notified from C++ to java mediaplayer/ mediarecorder layer/Application in android ?
Java layer will have
MediaPlayer
{
public static void postEventFromNative() { Notifies Error or Information events to Application thru InfoListener or ErrorListener }
};
JNI:
=====
JNIMediaPlayerListener/ JNIMediaRecorderListener is passed to underlying c++ mediaplayer or mediarecorder [libmedia] object.
whenver C++ mediaplayer or media recorder encounters errors it will call JNIMediaPlayerListener's notify () fn.
JNIMediaPlayerListener's notify/JNIMediaRecorderListener's notify is implemented in JNI.
void JNIMediaPlayerListener/JNIMediaRecorderListener::notify(int msg, int ext1, int ext2, const Parcel *obj)
{
fields.post_event = env->GetStaticMethodID(clazz, "postEventFromNative",
"(Ljava/lang/Object;IIILjava/lang/Object;)V");
env->CallStaticVoidMethod(mClass, fields.post_event, mObject,
msg, ext1, ext2, NULL); //This will call the postEventFromNative() fn in Java...
}
0 Comments:
Post a Comment
<< Home