0

嗨,我使用 Android 视频播放器下载并播放了下面引用的 3gp 视频,但我找不到使用下面的代码播放它的方法。我的 xml 布局定义如下:

    <VideoView
    android:id="@+id/before_begin_video"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center"
    android:layout_centerInParent="true"
    android:layout_below="@id/before_begin_title" />

我试过这段代码,但不起作用,只播放声音,但没有视频,只有一个黑色方块:

    VideoView vView = (VideoView)findViewById(R.id.before_begin_video);
    MediaController mController = new MediaController(MABeforeBegin.this); 
    mController.setAnchorView(vView);
    Uri video = Uri.parse("https://dl.dropbox.com/s/xxxx/videoname.3gp?dl=0?client_id=xxxxxxx");
    vView.setMediaController(mController);
    vView.setVideoURI(video);
    vView.requestFocus();
    vView.start();

此代码显示我在手机上拥有的媒体播放器:

    Uri video = Uri.parse("https://dl.dropbox.com/s/xxxx/videoname.3gp?dl=0?client_id=xxxxxxx");
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setType("video/*");

    Intent intent0 = Intent.createChooser(intent, "Complete Action Using");
    startActivity(intent0);

但是当我添加 intent.setData(video) 时,文件选择器会显示 chrome 和其他网络浏览器,但没有像上面那样的视频播放器

    Uri video = Uri.parse("https://dl.dropbox.com/s/xxxx/videoname.3gp?dl=0?client_id=xxxxxxx");
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setType("video/*");
    intent.setData(video);

    Intent intent0 = Intent.createChooser(intent, "Complete Action Using");
    startActivity(intent0);
4

1 回答 1

0

终于找到了解决这个问题的方法:

之前:我将 .avi 转换为 .3gp - .3gp 无法在 HTC Sensation 4g 上运行

之后:将 .avi 转换为 .mp4 - 完全有效!!

于 2014-09-10T03:42:40.053 回答