我正在完美地获得json的响应,但是我希望在我的视频视图中显示我从json获得的视频,但它没有显示..我的响应是在下面...以及我的代码段和UI设计视图...有人帮忙吗?
json
{
"user_login_id":"2650",
"user_total_video":"0",
"max_upload_video":"1",
"video_id":"485",
"video_status":"Approved",
"video":"http:\/\/lakinos.com\/uploads\/user\/1249\/small\/Denger.3gp"
}
的java
public class VideoList extends Activity{
private String User_IDs;
private String total;
private String max;
private String vidid;
private String vidsta;
private String vd;
private VideoView vides;
private ViewPager viewPager;
private ImageAdapter adapter;
private Button btnvideoupload;
private Button btndelete;
JSONParser jsonParser = new JSONParser();
private static final String DELT_SETPRO_URL = "";
private static final String DELT_SETPRO_STATUS = "status";
private static final String DELT_SETPRO_MSG = "msg";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fullvideo);
User_IDs=this.getIntent().getStringExtra("id");
System.out.println("photo upload view user id"+User_IDs);
total=this.getIntent().getStringExtra("totalvideos");
System.out.println("photo total "+total);
max=this.getIntent().getStringExtra("maxvideos");
System.out.println("photo maximum "+max);
vidid=this.getIntent().getStringExtra("videoid");
System.out.println("photo maximum "+vidid);
vidsta=this.getIntent().getStringExtra("vidstatus");
System.out.println("photo maximum "+vidsta);
vd=this.getIntent().getStringExtra("vids");
System.out.println("photo maximum "+vd);
btnvideoupload=(Button)findViewById(R.id.goforuploadvid);
btnvideoupload.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(getApplicationContext(),VideoUpload.class);
intent.putExtra("id", User_IDs);
startActivity(intent);
}
});
btndelete=(Button)findViewById(R.id.deletevid);
btndelete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
new AttemptLogin().execute();
}
});
}
//Creating MediaController
/*MediaController mediaController= new MediaController(this);
mediaController.setAnchorView(vides);
Uri uri=Uri.parse(vd.toString());
vides.setVideoURI(uri);
vides.setMediaController(new MediaController(VideoList.this));
vides.requestFocus();*/
}
public void getInit()
{
vides=(VideoView)findViewById(R.id.videoviewfull);
//video_player_view = (VideoView) findViewById(R.id.video_player_view);
mediaController = new MediaController(this);
dm = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(dm);
int height = dm.heightPixels;
int width = dm.widthPixels;
vides.setMinimumWidth(width);
vides.setMinimumHeight(height);
vides.setMediaController(mediaController);
vides.setVideoPath("");
vides.start();
}
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="Upload Video"
android:id="@+id/goforuploadvid"
/>
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="Delete"
android:id="@+id/deletevid"
android:tag="delete"
/>
<FrameLayout
android:id="@+id/video_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/videoviewfull"
/>
</FrameLayout>
</LinearLayout>
答案 0 :(得分:1)
首先你的给定视频网址不正确所以请使用另一个视频网址,当从网址播放视频时,请使用setVideoPath(url)而不是setVideoURI(uri),它通常使用来自本地设备的播放视频:
vides.setVideoPath("http://download.itcuties.com/teaser/itcuties-teaser-480.mp4");
相反:
vides.setVideoURI(uri);