View Single Post
  #3  
Old 12-11-2011, 07:42 AM
mick666 mick666 is offline
Junior Member
 
Join Date: Dec 2011
Posts: 1
mick666 is on a distinguished road
Default

Re: How to use rtmpdump (librtmp.so) in android


hey,
it's a quite old post, but i'm really interested too in using this library into java code.

I'm quite new to JNI.

Here is the code i use to push and load the library on the device:

Code:
String lib = "librtmp.so";
PackageManager pm = this.getPackageManager();
String iDataDir = pm.getApplicationInfo(this.getPackageName(), 0).dataDir;
String iSourceDir = pm.getApplicationInfo(this.getPackageName(), 0).sourceDir;
String apkLocation = iSourceDir;
String libLocation = iDataDir + File.separator + lib;
ZipFile zip = new ZipFile(apkLocation);
ZipEntry zipen = zip.getEntry("assets/" + lib);
InputStream is = zip.getInputStream(zipen);
OutputStream os = new FileOutputStream(libLocation);
byte[] buf = new byte[8092];
int n;
while ((n = is.read(buf)) > 0)
	os.write(buf, 0, n);
os.close();
is.close();
System.load(libLocation);
but i really don't know how to call a method after that (and if it's even possible).
I suppose i need to declare something like
Code:
public native void RTMP_Alloc();
but it doesn't work.

Anyone knows more about that?

Thanks in advance.
Reply With Quote