本文整理汇总了Java中android.widget.VideoView.setOnPreparedListener方法的典型用法代码示例。如果您正苦于以下问题:Java VideoView.setOnPreparedListener方法的具体用法?Java VideoView.setOnPreparedListener怎么用?Java VideoView.setOnPreparedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.VideoView
的用法示例。
在下文中一共展示了VideoView.setOnPreparedListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected final void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContentView = new VideoView(this);
mContentView.setVisibility(View.GONE);
mContentView.setOnPreparedListener(new OnPreparedListener());
final FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT,
Gravity.CENTER);
mContentView.setLayoutParams(layoutParams);
setContentView(mContentView);
startEncode(new File(getFilesDir(), OUTPUT_FILE_NAME).getAbsolutePath());
}
示例2: go
import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
VideoView v=(VideoView)findViewById(R.id.videoView) ;
final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar3);
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
p.setVisibility(View.GONE);
}
});
String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/flood.mp4?alt=media&token=179d7e4e-7171-4a87-b1f8-b1fc3d976c60";
Uri uri=Uri.parse(s);
v.setVideoURI(uri);
v.setVideoPath(s);
v.requestFocus();
v.start();
}
示例3: go
import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar2);
VideoView v=(VideoView)findViewById(R.id.videoView2) ;
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
p.setVisibility(View.GONE);
}
});
String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/earthquake.mp4?alt=media&token=98993371-823d-4b81-adc7-d9d87ec841a9";
Uri uri=Uri.parse(s);
v.setVideoURI(uri);
v.setVisibility(View.VISIBLE);
v.setVideoPath(s);
v.requestFocus();
v.start();
}
示例4: initPlayer
import android.widget.VideoView; //导入方法依赖的package包/类
public static void initPlayer(VideoView videoView, OnPreparedListener onPreparedListener,
OnCompletionListener onCompletionListener, OnErrorListener
onErrorListener) {
if (onPreparedListener != null) {
videoView.setOnPreparedListener(onPreparedListener);
}
if (onCompletionListener != null) {
videoView.setOnCompletionListener(onCompletionListener);
}
if (onErrorListener != null) {
videoView.setOnErrorListener(onErrorListener);
}
}
示例5: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String url = getIntent().getExtras().getString(Constants.URL);
setContentView(R.layout.fragment_video_gallery);
final VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
View progress = findViewById(R.id.videoProgress);
progress.setVisibility(View.GONE);
videoView.requestFocus();
MediaController vidControl = new MediaController(VideoPlayerActivity.this);
vidControl.setAnchorView(videoView);
videoView.setMediaController(vidControl);
videoView.start();
}
});
videoView.setVideoURI(Uri.parse(url));
}
示例6: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_full);
videofull=(VideoView)findViewById(R.id.videofull);
videofull.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
videofull.setMediaController(new MediaController(VideoFull.this));
videofull.start();
videofull.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
videofull.requestFocus();
}
示例7: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String url = getIntent().getExtras().getString(Constants.URL);
setContentView(R.layout.video_fragment);
final VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
View progress = findViewById(R.id.videoProgress);
progress.setVisibility(View.GONE);
videoView.requestFocus();
MediaController vidControl = new MediaController(VideoPlayerActivity.this);
vidControl.setAnchorView(videoView);
videoView.setMediaController(vidControl);
videoView.start();
}
});
videoView.setVideoURI(Uri.parse(url));
}
示例8: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
VideoView videoView = (VideoView) findViewById(R.id.video_view);
final String uri = "android.resource://" + getPackageName() + "/" + R.raw.fix_429;
videoView.setVideoURI(Uri.parse(uri));
// Loop
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
// Play
videoView.start();
}
示例9: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.example_layout);
getActionBar().setLogo(R.drawable.ic_launcher);
mController = (VideoController)findViewById(R.id.controller);
mVideoView = (VideoView)findViewById(R.id.video_view);
mVideoView.setOnPreparedListener(onPreparedListener);
mController.setMediaPlayer(mVideoView);
mController.setOnControllerShowListener(controllerShowListener);
Options options = new Options();
options.tag = "default";
options.key = "test_key";
mProxyServer = new ProxyServer(options,this,abstractMediaPlayer);
findViewById(R.id.frame).setOnTouchListener(controllerToggler);
mProxyServer.open();
}
示例10: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SettingUtilities.onActivityCreateSetTheme(this);
setContentView(R.layout.activity_help);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
findViewById(R.id.btnFeedback).setOnClickListener(this);
try {
final VideoView videoView = (VideoView) findViewById(R.id.videoView);
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.trimme);
videoView.setVideoURI(uri);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
videoView.start();
}
});
} catch (Exception ex) {
Log.e("Help video", ex.getMessage(), ex);
}
}
示例11: init
import android.widget.VideoView; //导入方法依赖的package包/类
private void init() {
//Authentication and authorization of App and SDK
MemeLib.setAppClientID(getApplicationContext(), APP_ID, APP_SECRET);
memeLib = MemeLib.getInstance();
blinkLayout = (FrameLayout)findViewById(R.id.blink_layout);
blinkImage = (ImageView)findViewById(R.id.blink_image);
blinkView = (VideoView)findViewById(R.id.blink_view);
blinkView.setZOrderOnTop(true);
blinkView.setVideoPath("android.resource://" + this.getPackageName() + "/" + R.raw.blink);
blinkView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaPlayer.seekTo(0);
}
});
bodyLayout = (FrameLayout)findViewById(R.id.body_layout);
bodyImage = (ImageView)findViewById(R.id.body_image);
statusLabel = (TextView)findViewById(R.id.status_label);
connectButton = (Button)findViewById(R.id.connect_button);
connectButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (memeLib.isConnected()) {
memeLib.disconnect();
} else {
Intent intent = new Intent(LiveViewActivity.this, ConnectActivity.class);
startActivity(intent);
}
}
});
changeViewStatus(memeLib.isConnected());
}
示例12: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
videoView = (VideoView) findViewById(R.id.video_background);
Controller controller = new Controller(getApplicationContext());
controller.setRandomNumber();
TextView text_welcome = (TextView) findViewById(R.id.text_welcome);
text_welcome.setText(controller.getWelcomeText());
Uri path = Uri.parse("android.resource://co.encuentralofacil/" + controller.getVideo());
videoView.setVideoURI(path);
videoView.start();
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
Button button_sign_up = (Button) findViewById(R.id.button_sign_up);
button_sign_up.setOnClickListener(this);
Button button_log_in = (Button) findViewById(R.id.button_log_in);
button_log_in.setOnClickListener(this);
TextView text_later = (TextView) findViewById(R.id.text_later);
text_later.setOnClickListener(this);
}
示例13: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
/**
* Called when the activity is first created.
*
* Searches for an {@link OCFile} and ownCloud {@link Account} holding it in the starting {@link Intent}.
*
* The {@link Account} is unnecessary if the file is downloaded; else, the {@link Account} is used to
* try to stream the remote file - TODO get the streaming works
*
* {@inheritDoc}
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log_OC.v(TAG, "onCreate");
setContentView(R.layout.video_layout);
if (savedInstanceState == null) {
Bundle extras = getIntent().getExtras();
mSavedPlaybackPosition = extras.getInt(EXTRA_START_POSITION);
mAutoplay = extras.getBoolean(EXTRA_AUTOPLAY);
} else {
mSavedPlaybackPosition = savedInstanceState.getInt(EXTRA_START_POSITION);
mAutoplay = savedInstanceState.getBoolean(EXTRA_AUTOPLAY);
}
mVideoPlayer = (VideoView) findViewById(R.id.videoPlayer);
// set listeners to get more contol on the playback
mVideoPlayer.setOnPreparedListener(this);
mVideoPlayer.setOnCompletionListener(this);
mVideoPlayer.setOnErrorListener(this);
// keep the screen on while the playback is performed (prevents screen off by battery save)
mVideoPlayer.setKeepScreenOn(true);
}
示例14: onViewCreated
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState);
calibrationProgress = (ProgressBar) view.findViewById(R.id.compass_calibration_progress);
instructionsContainer = view.findViewById(R.id.compass_calibration_instructions_container);
calibrationInstructions = (TextView) view.findViewById(R.id.compass_calibration_instructions);
calibrationImage = (ImageView) view.findViewById(R.id.compass_calibration_image);
calibrationVideo = (VideoView) view.findViewById(R.id.compass_calibration_video);
calibrationVideo.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
calibrationVideo.setVideoURI(Uri.parse("android.resource://" + getContext().getPackageName() + "/" +
R.raw.compass_cal_white));
calibrationButton = (TextView) view.findViewById(R.id.compass_calibration_button);
calibrationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
proceedWithCalibration(calibrationStep);
}
});
advicesContainer = view.findViewById(R.id.compass_calibration_advices_container);
@CompassCalibrationStep int currentStep = savedInstanceState == null
? STEP_BEGIN_CALIBRATION
: savedInstanceState.getInt(EXTRA_CALIBRATION_STEP, STEP_BEGIN_CALIBRATION);
calibrationStep = currentStep;
}
示例15: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_play);
// Get a reference to the VideoView
mVideoView = (VideoView) findViewById(R.id.videoViewer);
// Add a Media controller to allow forward/reverse/pause/resume
final MediaController mMediaController = new MediaController(
VideoPlayActivity.this, true);
mMediaController.setEnabled(false);
mVideoView.setMediaController(mMediaController);
mVideoView
.setVideoURI(Uri
.parse("android.resource://qa.edu.qu.cse.cmps312.multimedia/raw/theeb"));
// Add an OnPreparedListener to enable the MediaController once the video is ready
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mMediaController.setEnabled(true);
}
});
}