use of android.widget.MediaController in project android by nextcloud.
the class PreviewVideoActivity method onAccountSet.
@Override
protected void onAccountSet(boolean stateWasRecovered) {
super.onAccountSet(stateWasRecovered);
if (getAccount() != null) {
OCFile file = getFile();
// / Validate handled file (first image to preview)
if (file == null) {
throw new IllegalStateException("Instanced with a NULL OCFile");
}
if (!MimeTypeUtil.isVideo(file)) {
throw new IllegalArgumentException("Non-video file passed as argument");
}
file = getStorageManager().getFileById(file.getFileId());
if (file != null) {
if (file.isDown()) {
mVideoPlayer.setVideoURI(file.getStorageUri());
} else {
// not working yet
String url;
try {
url = AccountUtils.constructFullURLForAccount(this, getAccount()) + file.getRemotePath();
mVideoPlayer.setVideoURI(Uri.parse(url));
} catch (AccountNotFoundException e) {
onError(null, MediaService.OC_MEDIA_ERROR, R.string.media_err_no_account);
}
}
// create and prepare control panel for the user
mMediaController = new MediaController(this);
mMediaController.setMediaPlayer(mVideoPlayer);
mMediaController.setAnchorView(mVideoPlayer);
mVideoPlayer.setMediaController(mMediaController);
} else {
finish();
}
} else {
finish();
}
}
use of android.widget.MediaController in project android_frameworks_base by crdroidandroid.
the class VideoDumpActivity method createView.
private View createView() {
mVideoView = new VideoDumpView(this);
mVideoView.setMediaController(new MediaController(context));
LinearLayout mainLayout = new LinearLayout(this);
mainLayout.addView(mVideoView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
return mainLayout;
}
use of android.widget.MediaController in project AisenWeiBo by wangdan.
the class VideoPlayerActivity method initPlayer.
private void initPlayer(Uri uri) {
videoUri = uri;
mediaController = new MediaController(this);
mediaController.setAnchorView(mVideoPlayer);
mVideoPlayer.setMediaController(mediaController);
mVideoPlayer.requestFocus();
mVideoPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
// if (mPlayingWhenPaused)
mVideoPlayer.start();
layoutContent.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
invalidateOptionsMenu();
}
});
mVideoPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Logger.w(TAG, "onError what=%d, extra=%d", what, extra);
String err = getResources().getString(R.string.toast_video_play_error, what);
showMessage(err);
return false;
}
});
mVideoPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
Logger.w(TAG, "onCompletion");
mVideoPlayer.seekTo(1);
}
});
mVideoPlayer.setVideoURI(uri);
invalidateOptionsMenu();
mDownloadProxy.attach(this);
}
use of android.widget.MediaController in project instructure-android by instructure.
the class MediaUploadFragment method setupViews.
private void setupViews(final View rootView) {
mediaController = new MediaController(getActivity());
videoView = (VideoViewWithBackground) rootView.findViewById(R.id.videoView);
}
use of android.widget.MediaController in project weiui by kuaifan.
the class PictureVideoPlayActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
super.onCreate(savedInstanceState);
setContentView(R.layout.picture_activity_video_play);
video_path = getIntent().getStringExtra("video_path");
picture_left_back = (ImageView) findViewById(R.id.picture_left_back);
mVideoView = (VideoView) findViewById(R.id.video_view);
mVideoView.setBackgroundColor(Color.BLACK);
iv_play = (ImageView) findViewById(R.id.iv_play);
mMediaController = new MediaController(this);
mVideoView.setOnCompletionListener(this);
mVideoView.setOnPreparedListener(this);
mVideoView.setMediaController(mMediaController);
picture_left_back.setOnClickListener(this);
iv_play.setOnClickListener(this);
}
Aggregations