2

您好,我想为我的视频视图播放、暂停和停止,但似乎不能这样做。看看下面的代码:

    @Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.iworkout);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.exercises32);

    vv = (VideoView) findViewById (R.id.vv_Exercise);
    play = (Button) findViewById (R.id.btWorkOutPlay);
    pause = (Button) findViewById (R.id.btWorkOutPause);
    stop = (Button) findViewById (R.id.btWorkOutStop);



}

public void onClick(View v) {
    // TODO Auto-generated method stub

    switch(v.getId()){
    case R.id.btWorkOutPlay:
        Uri uri = Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.exercise1);
        vv.start();
        vv.setVideoURI(uri);
        break;
    case R.id.btWorkOutPause:
        vv.pause();
        break;
    case R.id.btWorkOutStop:
        vv.stopPlayback();
        break;
    }

} // end of onClick method

如果有人知道怎么做,我会很感激你的帮助。谢谢。

4

1 回答 1

3

MediaController与 一起使用VideoView

....
MediaController mc= new MediaController();
Videoview.setMediaController(mc);
....
于 2012-08-28T14:13:38.250 回答