How to display video after receiving from json?

I get the json response perfectly, but I want to display the video that I receive from json in my video presentation, but they don’t show it ... my answer is below .. and my fragment code, as well as the design of the user interface design .. can any 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> 
+2
source share
1 answer

First of all, your given URL is not valid, so please use a different one, and when playing videos from url, use setVideoPath (url) instead of setVideoURI (uri), which usually plays video from a local device:

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

Instead of this:

 vides.setVideoURI(uri); 
+1
source

Source: https://habr.com/ru/post/1210155/


All Articles