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

问题描述

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

  1.ijkmediaplayer(library)
2.ijkmediawidget(类似于VideoView的界面)
3.ijkmediademo(演示项目)

当我运行ijkmediademo,发生错误,程序崩溃。我有这些错误:

  07-06 14:06:26.913:E / AndroidRuntime(11394):致命的例外:主要
07-06 14:06:26.913:E / AndroidRuntime(11394):进程:tv.danmaku.ijk.media.demo,PID:11394
07-06 14:06:26.913:E / AndroidRuntime(11394):java.lang.UnsatisfiedLinkError:无法从加载器加载ijkffmpeg dalvik.system.PathClassLoader [dexPath = / data / app / tv.danmaku.ijk.media.demo-8.apk,libraryPath = / data /app-lib/tv.danmaku.ijk.media.demo-8]:findLibrary返回null
07-06 14:06:26.913:E / AndroidRuntime(11394):在java.lang.Runtime.loadLibrary Runtime.java:358)
07-06 14:06:26.913:E / AndroidRuntime(11394):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:0 6: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 。ikk.MediaPlayer。< init> .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):在android.view.SurfaceView.updateWindow(SurfaceView.java:602)
07-06 14:06:26.913:E / AndroidRuntime(11394):在android.view.SurfaceView.access $ 000(SurfaceView.java:94 )
07-06 14:06:26.913:E / AndroidRuntime(11394):android.view.SurfaceView $ 3.onPreDraw(SurfaceView.java:183)
07-06 14:06:26.913: E / AndroidRuntime(11394):在android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:888)
07-06 14:06:26.913:E / AndroidRuntime(11394):在android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2173)
07-06 14:06:26.913:E / AndroidRuntime(11394):在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)
07-06 14 :06:26.913:E / AndroidRuntime(11394):在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):在android.view.Choreographer.doCallbacks(Choreographer.java:603 )
07-06 14:06:26.913:E / AndroidRuntime(11394):在android.view.Choreographer.doFrame(Choreographer.java:573)
07-06 14:06:26.91 3:E / AndroidRuntime(11394):在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:789)
07-06 14:06:26.913:E / AndroidRuntime(11394):在android.os .Handler.handleCallback(Handler.java:733)
07-06 14:06:26.913:E / AndroidRuntime(11394):在android.os.Handler.dispatchMessage(Handler.java:95)
07-06 14:06:26.913:E / AndroidRuntime(11394):android.os.Looper.loop(Looper.java:136)
07-06 14:06:26.913:E / AndroidRuntime(11394) :android.app.ActivityThread.main(ActivityThread.java:5476)
07-06 14:06:26.913:E / AndroidRuntime(11394):在java.lang.reflect.Method.invokeNative(Native Method)
07-06 14:06:26.913:E / AndroidRuntime(11394):在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.j ava:1084)
07-06 14:06:26.913:E / AndroidRuntime(11394):在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;
}
}
}

这些库是什么? / p>

这些图书馆在哪里? (我在项目中找不到)



如何解决这个问题?

解决方案

看起来你还没有建立必需的库 - 你必须自己做。
按照 ijkplayer github链接构建Android 标题下的说明>



在successfull构建过程之后,您将获得几个自动放置的库文件( libijkffmpeg,libijkutil,libijkadk,libijksdl,libijkplayer )进入 ijkmediaplayer / libs 文件夹。



我已成功构建了 ijkplayer em> VirtualBox Ubuntu 12.04 。
您必须安装Android NDK 。


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 )

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)

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

what are these libraries?

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

How can solve this issue?

解决方案

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

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

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

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

09-21 17:38