@Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fr_less_15_c, container, false);

    ImageButton button = (ImageButton) view.findViewById(R.id.playVideo);

    videoView = (VideoView) view.findViewById(R.id.less_15_c);
    MediaController mController = new MediaController(getActivity());
    mController.setAnchorView(videoView);
    Uri videoUri =
        Uri.parse("android.resource://com.example.dell.learnerintermediate/raw/less_15_c");
    videoView.setMediaController(mController);
    videoView.setVideoURI(videoUri);

    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            videoView.start();
          }
        });
    return view;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Context context = getActivity();

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_training_detail, container, false);

    // Expandable Summary
    ExpandList = (ExpandableListView) view.findViewById(R.id.training_summary);

    Bundle bundle = getArguments();
    String trainingCode = bundle.getString("trainingCode");

    trainingUrl = String.format("http://eas.elephorm.com/api/v1/trainings/%1$s", trainingCode);

    training_title = (TextView) view.findViewById(R.id.training_title);

    training_video = (VideoView) view.findViewById(R.id.training_video);
    training_video.setMediaController(new MediaController(context));

    // BOITE DE DIALOGUE
    pDialog = new ProgressDialog(getActivity());
    pDialog.setMessage("Chargement...");
    pDialog.setCancelable(false);

    makeJsonObjectRequest();

    ExpandList.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {
          @Override
          public boolean onChildClick(
              ExpandableListView expandableListView,
              View view,
              int parentPosition,
              int childPosition,
              long l) {
            String courseId = list.get(parentPosition).getItems().get(childPosition).getId();
            Intent intent = new Intent(getActivity(), CourseActivity.class);
            intent.putExtra("courseId", courseId);
            intent.putExtra("trainingUrl", trainingUrl);
            startActivity(intent);
            return false;
          }
        });

    training_video.start();

    training_video.setOnCompletionListener(
        new MediaPlayer.OnCompletionListener() {
          @Override
          public void onCompletion(MediaPlayer mediaPlayer) {
            System.out.println("C'est fini :(");
            saveHistory();
          }
        });

    return view;
  }
Exemplo n.º 3
0
  // useVideoPlayerメソッド(VideoPlayerクラスを使用した動画再生処理)
  private void useVideoPlayer() {
    VideoView vvPlayer = (VideoView) findViewById(R.id.vv_player);

    // 動画のURIを取得
    String urlString =
        getIntent().getStringExtra(PlaytubeSampleActivity.IntentKey.MEDIA_URL.name());

    // 動画のURIを設定
    vvPlayer.setVideoURI(Uri.parse(urlString));

    // 動画タイトルを取得
    String title = getIntent().getStringExtra(PlaytubeSampleActivity.IntentKey.MEDIA_TITLE.name());

    // 動画再生元リスト判定
    flag =
        getIntent()
            .getIntExtra(PlaytubeSampleActivity.IntentKey.FROM_FLAG.name(), FROM_RESULTS_LIST);

    // タイトルバーに動画タイトルを設定
    setTitle(title);

    // メディアコントローラを設定
    vvPlayer.setMediaController(new MediaController(this));

    // 動画を再生
    vvPlayer.start();
  }
Exemplo n.º 4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_avplayer);
    mVideoView = (VideoView) findViewById(R.id.videoView1);

    Intent i = getIntent();
    trackList = i.getParcelableArrayListExtra(Track.klass);
    currentPlaylist = new Playlist(trackList, i.getIntExtra("pos", 0));

    mediaPlayer = new MediaPlayer();
    mediaPlayer.setOnPreparedListener(this);

    mediaController = new MediaController(this);
    mVideoView.setMediaController(mediaController);
    mVideoView.setVisibility(VideoView.INVISIBLE);

    //	    set controls for next and previous
    mediaController.setPrevNextListeners(
        new View.OnClickListener() {
          @Override
          public void onClick(View next) {
            prepareToStart(currentPlaylist.getNext());
          }
        },
        new View.OnClickListener() {
          @Override
          public void onClick(View prev) {
            prepareToStart(currentPlaylist.getPrevious());
          }
        });

    prepareToStart(currentPlaylist.getCurrent());
  }
Exemplo n.º 5
0
  public void showVideo(String advice) {
    VideoView video = new VideoView(this);
    video.setVideoURI(Uri.parse(advice));
    ViewGroup.LayoutParams params =
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    video.setLayoutParams(params);

    MediaController controller =
        new MediaController(this) {
          @Override
          public void hide() {}

          @Override
          public boolean dispatchKeyEvent(KeyEvent event) {
            if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) finish();
            return super.dispatchKeyEvent(event);
          }
        };
    controller.setAnchorView(video);
    video.setMediaController(controller);

    layout.addView(video);
    video.start();
  }
Exemplo n.º 6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_canciones);

    tituloView = (TextView) findViewById(R.id.texto_canciones);

    server = new BusinessCanciones(php);

    // Creo videoview solo 1 vez
    video = new VideoView(this);
    ViewGroup.LayoutParams params =
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    video.setLayoutParams(params);
    controller =
        new MediaController(this) {
          /*@Override
          public void hide()
          {}*/

          @Override
          public boolean dispatchKeyEvent(KeyEvent event) {
            if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
              finish();
            }
            return super.dispatchKeyEvent(event);
          }
        };
    controller.setAnchorView(video);
    video.setMediaController(controller);

    // Cargo la primera cancion
    siguienteCancion();
  }
Exemplo n.º 7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    VideoView videoView = (VideoView) findViewById(R.id.videoView);
    videoView.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.demovideo);
    android.widget.MediaController mediaController = new android.widget.MediaController(this);
    mediaController.setAnchorView(videoView);
    videoView.setMediaController(mediaController);
    videoView.start();

    /*
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
    */
  }
Exemplo n.º 8
0
  private void loadVideo() {
    getWindow().setFormat(PixelFormat.TRANSLUCENT);
    mVideoView = (VideoView) findViewById(R.id.imageViewCenter);
    mVideoView.setMediaController(new MediaController(this));
    Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.water_drop);
    mVideoView.setVideoURI(video);
    mVideoView.start();

    if (isLEFT) {

      lp.setMargins(1200, 0, -1000, 0);
      mThumbnailTopLayout.setVisibility(View.GONE);
      mThumnailBottomLayout.setVisibility(View.GONE);

    } else {
      lp.setMargins(-640, 0, 640, 0);
    }
    mVideoView.setLayoutParams(lp);

    mVideoView.setClickable(true);
    mVideoView.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // System.out.println(mVideoView);
            // mVideoView.stopPlayback();
            lp.setMargins(0, 0, 0, 0);
            mVideoView.setLayoutParams(lp);
            return true;
          }
        });
  }
Exemplo n.º 9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_vdo);
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    final VideoView video1 = (VideoView) findViewById(R.id.videoView1);
    video1.setVideoPath(th);
    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(video1);
    video1.setMediaController(mediaController);

    Toast.makeText(getBaseContext(), "รอสักครู่...", Toast.LENGTH_SHORT)
        .show(); // text preloading..

    video1.setOnPreparedListener(
        new MediaPlayer.OnPreparedListener() {

          @Override
          public void onPrepared(MediaPlayer mp) {
            Log.i(TAG, "Duration = " + video1.getDuration());
          }
        });

    video1.requestFocus(); // comment1

    video1.start();
    // finish(); //comment
  }
Exemplo n.º 10
0
  private void initVideoView() {
    mVideoView.setMediaController(new MediaController(this));
    Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bigbuck);
    mVideoView.setVideoURI(uri);

    setVideoViewPosition();
    mVideoView.start();
  }
Exemplo n.º 11
0
 // ----------------start play video ----------------
 void playVideo() {
   videoView = (VideoView) findViewById(R.id.videoView);
   videoView.setVideoPath(
       "http://media.karaokecuatui.vn/mv/AnhVanYeuEmNhuNgayDauTien_CaoThaiSon.mp4");
   MediaController mediaController = new MediaController(this);
   mediaController.setAnchorView(videoView);
   videoView.setOnCompletionListener(completionlistener);
   videoView.setMediaController(mediaController);
   videoView.start();
 }
Exemplo n.º 12
0
 private void prepareVideoEnd(int isSuccess) {
   if (isSuccess == 0) {
     hideLoading();
     mAfternoonImg.setImageBitmap(
         getVideoThumbnail(
             mTodayVideoPath, PhoneUtil.getPhoneWidth(), PhoneUtil.getPhoneHeight()));
     MediaController mediaController = new MediaController(this.getActivity());
     mAfternoonVideo.setMediaController(mediaController);
     mAfternoonVideo.setVideoURI(Uri.parse(mTodayVideoPath));
   }
 }
Exemplo n.º 13
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_menu__usuario__uno);
   final VideoView videoView = (VideoView) findViewById(R.id.webView);
   videoView.setVideoPath("http://www.ebookfrenzy.com/android_book/movie.mp4");
   videoView.start();
   MediaController mediaController = new MediaController(this);
   mediaController.setAnchorView(videoView);
   videoView.setMediaController(mediaController);
   videoView.start();
 }
Exemplo n.º 14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video2);

    VideoView videoView = (VideoView) this.findViewById(R.id.videoView2);
    videoView.setVideoURI(
        Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.most_important_decision));
    videoView.setMediaController(new MediaController(this));
    videoView.requestFocus();
    videoView.start();
  }
Exemplo n.º 15
0
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View view = inflater.inflate(R.layout.fragment_video, container, false);
   VideoView videoView = (VideoView) view.findViewById(R.id.videoView);
   Carro c = getArguments().getParcelable("carro");
   if (c != null) {
     videoView.setVideoURI(Uri.parse(c.urlVideo));
     videoView.setMediaController(new MediaController(getContext()));
     videoView.start();
     toast("start: " + c.urlVideo);
   }
   return view;
 }
Exemplo n.º 16
0
 @Override
 public View onCreateView(
     final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
   final View view = inflater.inflate(R.layout.video_surface, container, false);
   this.progress = view.findViewById(R.id.progress);
   final VideoView videoView = (VideoView) view.findViewById(R.id.video);
   this.videoView = videoView;
   videoView.setOnPreparedListener(this);
   videoView.setOnErrorListener(this);
   videoView.setOnCompletionListener(this);
   this.controller = new MediaController(getActivity());
   videoView.setMediaController(controller);
   return view;
 }
Exemplo n.º 17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.penampil_video);

    videoView = (VideoView) findViewById(R.id.VideoView);
    mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.tahap1);
    videoView.setMediaController(mediaController);
    videoView.setVideoURI(uri);
    videoView.requestFocus();
    videoView.start();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().setWindowAnimations(0); // Do not animate the view when it gets pushed on the screen
    setContentView(R.layout.videoview);

    CustomApp appState = ((CustomApp) getApplicationContext());
    unzippedDir = appState.getUnzippedDir();
    // videoView =  (VideoView) findViewById(R.id.surface_view); //new VideoView(VideoViewer.this);

    // Get the extras (video filename) out of the new intent
    Intent intent = getIntent();
    if (intent != null) videoFile = intent.getStringExtra("video");
    if (intent != null) packagePath = intent.getStringExtra("path");

    File clip = new File(/*unzippedDir + */ packagePath + File.separator + videoFile);
    System.out.println("Complete video path === " + packagePath + File.separator + videoFile);

    try {
      if (clip.exists()) {

        videoView = new VideoView(VideoViewer.this);
        videoView.setVideoPath(clip.getAbsolutePath());

        videoView.setLayoutParams(
            new Gallery.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

        ctlr = new MediaController(VideoViewer.this);
        ctlr.setMediaPlayer(videoView);
        videoView.setMediaController(ctlr);
        videoView.requestFocus();
        videoView.start();
        setContentView(videoView);

      } else {
        TextView tv = new TextView(this);
        tv.setText("File does not exist");
        setContentView(tv);
      }
    } catch (OutOfMemoryError E) {
      // Release some (all) of the above objects
      System.out.println("Out of Memory Exception");
      TextView txtView = new TextView(VideoViewer.this);
      txtView.setText("Error: Out of Memory - video file is too big to load!");
      setContentView(txtView);
    }
  }
Exemplo n.º 19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    v = (VideoView) findViewById(R.id.videoView);
    MediaController ctrlr;
    String url = "http://techslides.com/demos/sample-videos/small.mp4";
    v.setVideoURI(Uri.parse("http://techslides.com/demos/sample-videos/small.mp4"));

    ctrlr = new MediaController(this);
    v.setOnCompletionListener(this);
    ctrlr.setAnchorView(v);
    ctrlr.setMediaPlayer(v);
    v.setMediaController(ctrlr);
    v.requestFocus();
    v.start();
  }
Exemplo n.º 20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    NsisApplication.getInstance().addActivity(this);

    Education video = (Education) getIntent().getSerializableExtra("video");
    if (video != null) {
      mTextTitle.setText(video.getTitle());
      mTextTime.setText(video.getTime());
      String urlString = LoginInfo.mFileUrl.getUrl() + "/" + video.getUrl();
      L.i("视频地址:" + urlString);
      Uri uri = Uri.parse(urlString);
      mVideoView.setMediaController(new MediaController(this));
      mVideoView.setVideoURI(uri);
      mVideoView.start();
      mVideoView.requestFocus();
    }
  }
Exemplo n.º 21
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_video, container, false);

    // установите свой путь к файлу на SD-карточке

    // String videoSource ="/sdcard/Video/ana.mpeg";
    // String videoSource ="https://cs542300.vk.me/2/u3400922/videos/d65c5d132b.720.mp4";
    String videoSource =
        "http://cs540502v4.vk.me/u82858868/videos/0aca1f977d.360.mp4?extra=1pIvbmxIm5El_bz8qxozTvET5GOipetrjXrc-IzVbRO5P2mdimhmKG7EoVjiiRlS_ajloEzCU-RQhxFTMh7lHFtyqdibx-oG8g";
    // http://www.androidbegin.com/tutorial/AndroidCommercial.3gp

    final VideoView video = (VideoView) rootView.findViewById(R.id.videoView);

    MediaController mediaController = new MediaController(getActivity());
    mediaController.setAnchorView(video);

    video.setVideoURI(Uri.parse(videoSource));
    video.setMediaController(mediaController);

    video.requestFocus();
    video.start();

    /*final MediaController mMediaController = new MediaController(getActivity(), false);

    video.setOnPreparedListener( new MediaPlayer.OnPreparedListener() {

        @Override
        public void onPrepared(MediaPlayer pMp) {
            mMediaController.show();
        }

    });

    video.setMediaController(mMediaController);
    mMediaController.setMediaPlayer(video);
    video.setVideoPath(videoSource);  // may not be applicable in your case
    video.requestFocus();
    video.start();*/

    // Inflate the layout for this fragment
    return rootView;
  }
Exemplo n.º 22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Get the layout from video_main.xml
    setContentView(R.layout.activity_videoview);
    // Find your VideoView in your video_main.xml layout
    videoview = (VideoView) findViewById(R.id.VideoView);
    // Execute StreamVideo AsyncTask

    // Create a progressbar
    pDialog = new ProgressDialog(VideoViewActivity.this);
    // Set progressbar title
    pDialog.setTitle("Android Video Streaming Tutorial");
    // Set progressbar message
    pDialog.setMessage("Buffering...");
    pDialog.setIndeterminate(false);
    pDialog.setCancelable(false);
    // Show progressbar
    pDialog.show();

    try {
      // Start the MediaController
      MediaController mediacontroller = new MediaController(VideoViewActivity.this);
      mediacontroller.setAnchorView(videoview);
      // Get the URL from String VideoURL
      Uri video = Uri.parse(VideoURL);
      videoview.setMediaController(mediacontroller);
      videoview.setVideoURI(video);

    } catch (Exception e) {
      Log.e("Error", e.getMessage());
      e.printStackTrace();
    }

    videoview.requestFocus();
    videoview.setOnPreparedListener(
        new OnPreparedListener() {
          // Close the progress bar and play the video
          public void onPrepared(MediaPlayer mp) {
            pDialog.dismiss();
            videoview.start();
          }
        });
  }
Exemplo n.º 23
0
  @Override
  public void onResume() {
    super.onResume();
    // ReceiverをRegister
    IntentFilter mIntentFilter = new IntentFilter();
    mIntentFilter.addAction(VideoConst.SEND_HOSTDP_TO_VIDEOPLAYER);
    registerReceiver(mReceiver, mIntentFilter);

    MediaController mMediaController = new MediaController(this);
    mMediaController.setAnchorView(mVideoView);

    mVideoView.setMediaController(mMediaController);
    mVideoView.setKeepScreenOn(true);
    mVideoView.setVideoURI(mUri);
    mVideoView.requestFocus();
    mVideoView.setOnCompletionListener(this);

    mVideoView.start();
  }
Exemplo n.º 24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.video_playback_layout);

    String path = getIntent().getExtras().getString(VideoList.VIDEO_EXTRA);
    File video = new File(path);
    if (!(video.exists())) throw new RuntimeException("Video Does not exist: " + path);

    VideoView videoView = (VideoView) findViewById(R.id.video_spot);
    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    videoView.setMediaController(mediaController);
    videoView.setVideoPath(video.getAbsolutePath());
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main_video);
    videoURL = getIntent().getStringExtra("url");
    txt_Title = getIntent().getStringExtra("title");
    txtDate = getIntent().getStringExtra("date");
    txtID = getIntent().getStringExtra("id");
    act_tag = getIntent().getIntExtra("tag", 1);

    setFindViewById();
    setEventWidget();
    setLayout();

    mVideoController = new MediaController(this);
    mVideoController.setAnchorView(VideoPlayer);
    VideoPlayer.setMediaController(mVideoController);

    setVideoPlayer(videoURL);
  }
Exemplo n.º 26
0
 public e(Context context) {
   super(context);
   context = new MediaController(getContext());
   a = new VideoView(getContext());
   context.setAnchorView(this);
   a.setMediaController(context);
   context = new android.widget.RelativeLayout.LayoutParams(-1, -1);
   context.addRule(11, -1);
   context.addRule(9, -1);
   context.addRule(10, -1);
   context.addRule(12, -1);
   context.addRule(13);
   a.setLayoutParams(context);
   addView(a);
   g = new Handler();
   context = new b(this);
   g.postDelayed(context, 250L);
   f = new Handler();
   context = new a(this);
   f.postDelayed(context, 250L);
 }
Exemplo n.º 27
0
 private void setRadioPath(final String rType, final String rPath) {
   if (rType.equals("radio")) {
     try {
       player.setDataSource(rPath);
       player.prepare();
     } catch (IllegalArgumentException e1) {
       e1.printStackTrace();
     } catch (SecurityException e1) {
       e1.printStackTrace();
     } catch (IllegalStateException e1) {
       e1.printStackTrace();
     } catch (IOException e1) {
       e1.printStackTrace();
     }
     player.start();
   } else {
     vPlay.setVideoURI(Uri.parse(rPath));
     vPlay.setMediaController(new MediaController(this));
     vPlay.requestFocus();
     vPlay.start();
   }
 }
Exemplo n.º 28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);

    init();

    event_id = this.getIntent().getIntExtra("event_id", -1);

    if (event_id == -1) {
      Toast.makeText(getApplicationContext(), "连接失败,请检查网络是否连接并重试", Toast.LENGTH_LONG).show();
    } else {
      String event_id_string = String.valueOf(event_id);

      //            final String url_mp4 = "http://120.24.208.130:1501/video/201.mp4";

      final String url_mp4 = url_part + "/video/" + event_id_string + ".mp4";

      boolean mp4 = RequestHandler.TestGetURL(url_mp4);

      if (!mp4) {
        Toast.makeText(getApplicationContext(), "没有相应的视频", Toast.LENGTH_SHORT).show();
      } else {
        RelativeLayout RL = (RelativeLayout) findViewById(R.id.video_layout);
        RL.setGravity(Gravity.CENTER);
        VideoView vv = new VideoView(VideoActivity.this);
        vv.setId(R.id.id_video);
        RL.addView(vv);

        video_view = (VideoView) findViewById(R.id.id_video);

        Uri uri = Uri.parse(url_mp4);
        video_view.setMediaController(new MediaController(VideoActivity.this));
        video_view.setVideoURI(uri);
        video_view.start();
        video_view.requestFocus();
      }
    }
  }
Exemplo n.º 29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.play_video_voa);

    StructureListAudioVoa cate =
        (StructureListAudioVoa) getIntent().getExtras().getBundle("audio").getParcelable("audio");
    videoview = (VideoView) findViewById(R.id.videoview);
    mediacontroller = new MediaController(WatchVideoVOA.this);
    mediacontroller.setAnchorView(videoview);

    videoview.setMediaController(mediacontroller);

    videoview.setVideoURI(Uri.parse(cate.getLink()));
    videoview.requestFocus();
    videoview.start();
  }
Exemplo n.º 30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video3);
    vv_video = (VideoView) findViewById(R.id.vv_video);
    // 实例化MediaController
    mController = new MediaController(this);
    //
    // File file = new File(pathString);
    // if (file.exists()) {
    // 设置播放视频源的路径
    // vv_video.setVideoPath(file.getAbsolutePath());

    vv_video.setVideoURI(Uri.parse(pathString));

    // 为VideoView指定MediaController
    vv_video.setMediaController(mController);
    // 为MediaController指定控制的VideoView
    mController.setMediaPlayer(vv_video);
    // 增加监听上一个和下一个的切换事件,默认这两个按钮是不显示的
    mController.setPrevNextListeners(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Toast.makeText(VedioPlay3.this, "下一个", Toast.LENGTH_LONG).show();
          }
        },
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Toast.makeText(VedioPlay3.this, "上一个", Toast.LENGTH_LONG).show();
          }
        });
    // }
  }