PDA

View Full Version : How to use rtmpdump (librtmp.so) in android


sean6lou
09-07-2010, 09:20 PM
Is here anyone can tell me how to use the rtmpdump in the android environment? What I have done please see below:
1. I have downloaded the "rtmpdump-2.3-android";
2. Change the "librtmp.so.0" file to "librtmp.so";
3. Push the librtmp.so into the android OS (/data/data folder);
4. Lode the librtmp.so in the code;
5. Try to us RTMP_Alloc method, but failed. The definition of RTMP_Alloc is: "RTMP *RTMP_Alloc(void);". But how can I refer the RTMP structure under the java code?

If you are familiar with the rtmpdump-2.3-android, please help me. If you have any idea of the rtmpdump in andriod, please leave with your message here, tks!

javi242
02-04-2011, 05:25 AM
Hi. I'm interesting in how to use this library too. I loaded the library but when I call any method I get UnsatisfiedLinkError. Any help?

Thanks

mick666
12-11-2011, 07:42 AM
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:


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
public native void RTMP_Alloc();
but it doesn't work.

Anyone knows more about that?

Thanks in advance.