“导入”>“常规”>“现有项目到工作区”将其导入到 eclipse 中。之后我有三个项目: 1.ijkmedi-6ren">
gpt4 book ai didi

android - 如何使用 ijkplayer 库

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:04:19 50 4
gpt4 key购买 nike

我要使用 ijkplayer github link .我下载了它,然后通过"file">“导入”>“常规”>“现有项目到工作区”将其导入到 eclipse 中。之后我有三个项目:

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

当我运行 ijkmediademo 时,发生了错误并且程序崩溃了。我收到以下错误行:

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 类中设置的一些库:

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;
}
}
}

这些库是什么?

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

如何解决这个问题?

最佳答案

似乎您还没有构建所需的库 - 您必须自己构建。按照页面上 Build Android 标题下的说明进行操作 ijkplayer github link

成功构建过程后,您将获得几个库文件(libijkffmpeg、libijkutil、libijkadk、libijksdl、libijkplayer),它们将自动放入 ijkmediaplayer/libs 文件夹中。

我已经在 VirtualBox Ubuntu 12.04 下成功构建了 ijkplayer 库。并且您必须安装 Android NDK

关于android - 如何使用 ijkplayer 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24594674/

50 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com