i want to embedd a youtube video to my android app. but its not working .what should i do

  • Thread starter Android Central Question
  • Start date
A

Android Central Question

package com.zeel.zee;

import android.content.Context;
import android.media.MediaPlayer;

import android.media.session.MediaSession;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.VideoView;
import android.widget.ViewFlipper;
import android.widget.MediaController;

public class did extends AppCompatActivity {

ViewFlipper v_flipper1;
@ override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_did);

VideoView videoView = (VideoView)findViewById(R.id.videoView);
android.widget.MediaController mediaController = new android.widget.MediaController(this);
mediaController.setAnchorView(videoView);
Uri uri = Uri.parse("rtsp://r5---sn-npoe7nes.googlevideo.com/Cj0LENy73wIaNAltcAyvi-QbchMYDSANFC1vKkdbMOCoAUIASARgwPTz6qWTqJpbigELRlhBLTdxcjhzVlEM/2024081E055C7CF434A7DAA8482A4B891172AAA5.7A79E1365833C3FA71BAC08EFDBC89E2DFF7B1AC/yt6/1/video.3gp");
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();

int dids[] = {R.drawable.did1,R.drawable.did2,R.drawable.did3,R.drawable.did4,R.drawable.did5};
v_flipper1= findViewById(R.id.v_flipper1);

for (int image: dids){
flipperImages(image);
}

}

public void flipperImages(int image){
ImageView imageView=new ImageView(this);

imageView.setBackgroundResource(image);

v_flipper1.addView(imageView);
v_flipper1.setFlipInterval(1500);
v_flipper1.setAutoStart(true);

v_flipper1.setInAnimation(this,android.R.anim.slide_in_left);
v_flipper1.setInAnimation(this,android.R.anim.slide_out_right);
}
}
 
Last edited by a moderator:

Forum statistics

Threads
942,976
Messages
6,916,710
Members
3,158,758
Latest member
davisongeorge