2

I am getting json response perfectly,but I want to display video which i get from json in my video view but its not showing..my response is give below..and my snippet code and also UI design view..can any one help?

enter image description here

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>
Aditya Vyas-Lakhan
  • 13,409
  • 16
  • 61
  • 96

1 Answers1

1

First of all your given video url is not correct so please use another one and when play video from url use setVideoPath(url) instead setVideoURI(uri) which generally used play video from device local :

vides.setVideoPath("http://download.itcuties.com/teaser/itcuties-teaser-480.mp4");

Instead :

vides.setVideoURI(uri);
Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67