本文介绍了如何使用ijkplayer库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要使用ijkplayer 。我下载了这个,然后导入通过文件>导入>常规>现有项目到工作区偏食。之后,我有三个项目:

I'm going to use ijkplayer github link. I downloaded this and then import it to eclipse by File > Import > General > Existing Projects to Workspace. After that I have three project:

1.ijkmediaplayer ( library )
2.ijkmediawidget ( VideoView-like interface )
3.ijkmediademo   ( Demo project )

当我运行ijkmediademo,错误发生,程序崩溃。我得到了错误的这些行:

When I run ijkmediademo, Error happened and program crashed. I got these lines of error:

07-06 14:06:26.913: E/AndroidRuntime(11394): FATAL EXCEPTION: main
07-06 14:06:26.913: E/AndroidRuntime(11394): Process: tv.danmaku.ijk.media.demo, PID: 11394
07-06 14:06:26.913: E/AndroidRuntime(11394): java.lang.UnsatisfiedLinkError: Couldn't load ijkffmpeg from loader dalvik.system.PathClassLoader[dexPath=/data/app/tv.danmaku.ijk.media.demo-8.apk,libraryPath=/data/app-lib/tv.danmaku.ijk.media.demo-8]: findLibrary returned null
07-06 14:06:26.913: E/AndroidRuntime(11394):    at java.lang.Runtime.loadLibrary(Runtime.java:358)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at java.lang.System.loadLibrary(System.java:526)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.player.IjkMediaPlayer$1.loadLibrary(IjkMediaPlayer.java:86)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.player.IjkMediaPlayer.loadLibrariesOnce(IjkMediaPlayer.java:95)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.player.IjkMediaPlayer.initPlayer(IjkMediaPlayer.java:137)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.player.IjkMediaPlayer.<init>(IjkMediaPlayer.java:133)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.player.IjkMediaPlayer.<init>(IjkMediaPlayer.java:125)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.widget.VideoView.openVideo(VideoView.java:244)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.widget.VideoView.access$30(VideoView.java:229)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at tv.danmaku.ijk.media.widget.VideoView$8.surfaceCreated(VideoView.java:502)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.SurfaceView.updateWindow(SurfaceView.java:602)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.SurfaceView.access$000(SurfaceView.java:94)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:183)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:888)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2173)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6567)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.Choreographer.doCallbacks(Choreographer.java:603)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.Choreographer.doFrame(Choreographer.java:573)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.os.Handler.handleCallback(Handler.java:733)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.os.Handler.dispatchMessage(Handler.java:95)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.os.Looper.loop(Looper.java:136)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at android.app.ActivityThread.main(ActivityThread.java:5476)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at java.lang.reflect.Method.invokeNative(Native Method)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at java.lang.reflect.Method.invoke(Method.java:515)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
07-06 14:06:26.913: E/AndroidRuntime(11394):    at dalvik.system.NativeStart.main(Native Method)

这似乎是程序无法找到一些库,设置在这里IjkMediaPlayer类:

It's seems that program can't find some libraries that sets here in IjkMediaPlayer class:

public static void loadLibrariesOnce(IjkLibLoader libLoader) {
    synchronized (IjkMediaPlayer.class) {
        if (!mIsLibLoaded) {
            libLoader.loadLibrary("stlport_shared");
            libLoader.loadLibrary("ijkffmpeg");
            libLoader.loadLibrary("ijkutil");
            libLoader.loadLibrary("ijkadk");
            libLoader.loadLibrary("ijksdl");
            libLoader.loadLibrary("ijkplayer");
            mIsLibLoaded = true;
        }
    }
}

什么是这些库?

在哪里这些库? (我不能在项目中找到)

where are these libraries? ( i could not find them in projects )

如何解决这个问题?

推荐答案

看来你还没有建立所需要的库 - 你必须自己做。
按照标题下指令的构建Android 在页面上

Seems that you haven't built libraries which are required - you have to do it by yourself.Follow instructions under the header Build Android on the page ijkplayer github link

在全成构建过程中,你会得到几个库文件( libijkffmpeg,libijkutil,libijkadk,libijksdl,libijkplayer 的),这将被自动放入 ijkmediaplayer /库文件夹中。

After successfull build process you'll get several library files (libijkffmpeg, libijkutil, libijkadk, libijksdl, libijkplayer) which will be automatically put into ijkmediaplayer/libs folder.

我已经成功地建立的 ijkplayer 的下的的VirtualBox的Ubuntu 12.04库的。
而且你必须安装的的Andr​​oid NDK

I've successfully built ijkplayer libraries under VirtualBox Ubuntu 12.04.And you'll have to install Android NDK.

这篇关于如何使用ijkplayer库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 17:38