package com.qianhua.ui; |
002 |
003 |
import android.app.Activity; |
004 |
import android.content.Intent; |
005 |
import android.media.MediaPlayer; |
006 |
import android.net.Uri; |
007 |
import android.os.Bundle; |
008 |
import android.os.Environment; |
009 |
import android.widget.MediaController; |
010 |
import android.widget.MediaController.MediaPlayerControl; |
011 |
import android.widget.VideoView; |
012 |
013 |
import com.qianhua.R; |
014 |
015 |
public class VideoActivity extends Activity implements MediaPlayerControl |
016 |
VideoView |
017 |
018 |
@Override |
019 |
protected void onCreate(Bundle |
020 |
// |
021 |
super .onCreate(savedInstanceState); |
022 |
setContentView(R.layout.activity_video); |
023 |
videoView |
024 |
if (Environment.getExternalStorageState().equals( |
025 |
// |
026 |
videoView.setVideoURI(Uri.parse(Environment.getExternalStorageDirectory().getPath() "/" + "mm.mp4" )); |
027 |
MediaController new MediaController( this ); |
028 |
videoView.setMediaController(mediaController); |
029 |
videoView.start(); |
030 |
videoView.requestFocus(); |
031 |
|
032 |
videoView.setOnCompletionListener( new MediaPlayer.OnCompletionListener() |
033 |
|
034 |
@Override |
035 |
public void onCompletion(MediaPlayer |
036 |
// |
037 |
Intent new Intent(VideoActivity. this ,PersonLoginUI. class ); |
038 |
startActivity(intent); |
039 |
} |
040 |
}); |
041 |
} |
042 |
043 |
} |
044 |
045 |
@Override |
046 |
public boolean canPause() |
047 |
// |
048 |
videoView.canPause(); |
049 |
return false ; |
050 |
} |
051 |
052 |
@Override |
053 |
public boolean canSeekBackward() |
054 |
// |
055 |
return false ; |
056 |
} |
057 |
058 |
@Override |
059 |
public boolean canSeekForward() |
060 |
// |
061 |
return false ; |
062 |
} |
063 |
064 |
@Override |
065 |
public int getBufferPercentage() |
066 |
// |
067 |
return 0 ; |
068 |
} |
069 |
070 |
@Override |
071 |
public int getCurrentPosition() |
072 |
// |
073 |
return 0 ; |
074 |
} |
075 |
076 |
@Override |
077 |
public int getDuration() |
078 |
// |
079 |
return 0 ; |
080 |
} |
081 |
082 |
@Override |
083 |
public boolean isPlaying() |
084 |
// |
085 |
return false ; |
086 |
} |
087 |
088 |
@Override |
089 |
public void pause() |
090 |
// |
091 |
if (videoView.isPlaying()){ |
092 |
videoView.pause(); |
093 |
} |
094 |
095 |
} |
096 |
097 |
@Override |
098 |
public void seekTo( int arg0) |
099 |
// |
100 |
videoView.seekTo(arg0); |
101 |
102 |
} |
103 |
104 |
@Override |
105 |
public void start() |
106 |
// |
107 |
if (!videoView.isPlaying()) |
108 |
videoView.start(); |
109 |
} |
110 |
111 |
} |
112 |
113 |
} |
时间: 2024-12-17 00:41:23