我试图使用videoview lib在我的nexus7(android4.2)上播放视频,但当我启动应用程序时,我的nexus7显示“无法播放此视频”,希望您能帮助我。我的源码:
package com.test.prog;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.VideoView;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Uri viduri=Uri.parse("http://www.law.duke.edu/cspd/contest/finalists/viewentry.php?file=docandyou");
VideoView video=(VideoView)findViewById(R.id.videoview);
video.setVideoURI(viduri);
}
}和布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
tools:context=".MainActivity" >
<VideoView
android:id="@+id/videoview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
/>
</RelativeLayout>LogCat说:
11-19 17:46:08.504: D/VideoView(16804): Error: 1,0
11-19 17:46:19.504: D/MediaPlayer(16804): Couldn't open file on client side, trying server side
11-19 17:46:19.504: E/MediaPlayer(16804): Unable to to create media player敬重基督徒
发布于 2013-01-04 22:58:12
`video.start`
after you set --> `$`video.setVideoURI(viduri);我可以用你的代码在我的nexus7 4.1.2版本上运行视频
https://stackoverflow.com/questions/13458519
复制相似问题