我正在尝试使用VITAMIO VideoView在应用程序中播放流视频。 我下载了Vitamio Demo应用程序,它用我的URL工作了很好。但是当我在我的应用程序中尝试在我的应用程序中使用它时,它会在“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)
.

有帮助吗?

解决方案

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

首先我添加到清单

 <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();
.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top