Vitamio VideView崩溃了

时间:2014-04-12 16:52:12

标签: java android android-videoview vitamio

我尝试使用Vitamio VideoView在我的应用中播放视频流。 我已经下载了vitamio演示应用程序,它与我的网址一起工作正常。但是当我试图在我的应用程序中使用它时,它会在" mVideoView.setVideoURI(Uri.parse(path))之后崩溃;"

 public void play ()
 {      
    LinearLayout VideoView = (LinearLayout) findViewById(R.id.videoview);       
    VideoView.setVisibility(View.VISIBLE);

    String path = "here is my url"; 

    mVideoView = (VideoView) findViewById(R.id.surface_view1);
    mVideoView.setVideoURI(Uri.parse(path));
    MediaController mediaController = new MediaController(this);
    mVideoView.setMediaController(mediaController);
    mVideoView.requestFocus();
    mVideoView.start();

    mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            // optional need Vitamio 4.0
            //mediaPlayer.setPlaybackSpeed(1.0f);
        }
    });

 }

这是我在main.xml中的视频视图的布局:

<LinearLayout 
   android:id="@+id/videoview"    
   android:orientation="vertical" 
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:background="#FFFFFF"
   android:visibility="gone">

<io.vov.vitamio.widget.CenterLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <io.vov.vitamio.widget.VideoView
        android:id="@+id/surface_view1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" />
</io.vov.vitamio.widget.CenterLayout>

LogCat显示:

 04-12 20:00:00.241: E/Vitamio(16177): Error loading libs
 04-12 20:00:00.241: E/Vitamio(16177): java.lang.UnsatisfiedLinkError: Cannot load library: load_library(linker.cpp:771): library "nulllibstlport_shared.so" not found
 04-12 20:00:00.241: E/Vitamio(16177): at java.lang.Runtime.load(Runtime.java:340)
 04-12 20:00:00.241: E/Vitamio(16177): at java.lang.System.load(System.java:507)
 04-12 20:00:00.241: E/Vitamio(16177): at io.vov.vitamio.MediaPlayer.<init>(MediaPlayer.java:100)
 04-12 20:00:00.241: E/Vitamio(16177): at io.vov.vitamio.MediaPlayer.<init>(MediaPlayer.java:78)
 04-12 20:00:00.241: E/Vitamio(16177): at io.vov.vitamio.widget.VideoView.openVideo(VideoView.java:221)
 04-12 20:00:00.241: E/Vitamio(16177): at io.vov.vitamio.widget.VideoView.access$29(VideoView.java:209)
 04-12 20:00:00.241: E/Vitamio(16177): at io.vov.vitamio.widget.VideoView$9.surfaceCreated(VideoView.java:461)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.SurfaceView.updateWindow(SurfaceView.java:569)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.SurfaceView.access$000(SurfaceView.java:86)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:174)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:680)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1842)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.Choreographer.doFrame(Choreographer.java:532)
 04-12 20:00:00.241: E/Vitamio(16177): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
 04-12 20:00:00.241: E/Vitamio(16177): at android.os.Handler.handleCallback(Handler.java:725)
 04-12 20:00:00.241: E/Vitamio(16177): at android.os.Handler.dispatchMessage(Handler.java:92)
 04-12 20:00:00.241: E/Vitamio(16177): at android.os.Looper.loop(Looper.java:137)
 04-12 20:00:00.241: E/Vitamio(16177): at android.app.ActivityThread.main(ActivityThread.java:5227)
 04-12 20:00:00.241: E/Vitamio(16177): at java.lang.reflect.Method.invokeNative(Native Method)
 04-12 20:00:00.241: E/Vitamio(16177): at java.lang.reflect.Method.invoke(Method.java:511)
 04-12 20:00:00.241: E/Vitamio(16177): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
 04-12 20:00:00.241: E/Vitamio(16177): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
 04-12 20:00:00.241: E/Vitamio(16177): at dalvik.system.NativeStart.main(Native      Method)

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题! :)

首先,我已添加到清单

 <activity
    android:name="io.vov.vitamio.activity.InitActivity"
    android:configChanges="orientation|keyboardHidden|navigation"
    android:launchMode="singleTop"
    android:theme="@android:style/Theme.NoTitleBar"
    android:windowSoftInputMode="stateAlwaysHidden" />

这是我的onCreate():

     new AsyncTask<Object, Object, Boolean>() {
        @Override
        protected void onPreExecute() {
        //              mPD = new ProgressDialog(InitActivity.this);
        //              mPD.setCancelable(false);
        //      PD.setMessage(getString(R.string.vitamio_init_decoders));
        //              mPD.show();
        }

        @Override
        protected Boolean doInBackground(Object... params) {
            return Vitamio.initialize(MyMapActivity.this);
        }

        @Override
        protected void onPostExecute(Boolean inited) {
        //              if (inited) {
        //                  uiHandler.sendEmptyMessage(0);
        //              }
        }

    }.execute();