Search code examples
javaandroidandroid-videoviewvitamio

Vitamio VideView crashes


I'm trying to play stream video in my app using Vitamio VideoView. I've downloaded vitamio demo app and it worked fine with my url. But when I'm trying to use it in my app it crashes after "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);
        }
    });

 }

This is layout for my videoview in 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 shows:

 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)

Solution

  • I've fixed the problem! :)

    First of all I've added to the manifest

     <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" />
    

    And this to my 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();