use of android.widget.VideoView in project android_packages_apps_Gallery2 by LineageOS.
the class TrimVideo method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
mContext = getApplicationContext();
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_ACTION_BAR);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
ActionBar actionBar = getActionBar();
int displayOptions = ActionBar.DISPLAY_SHOW_HOME;
actionBar.setDisplayOptions(0, displayOptions);
displayOptions = ActionBar.DISPLAY_SHOW_CUSTOM;
actionBar.setDisplayOptions(displayOptions, displayOptions);
actionBar.setCustomView(R.layout.trim_menu);
mExitImageView = (ImageView) findViewById(R.id.exit_trim);
mExitImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mExitDialog = new AlertDialog.Builder(TrimVideo.this, AlertDialog.THEME_DEVICE_DEFAULT_LIGHT).setTitle(R.string.trim_video_exit_title).setMessage(R.string.trim_video_exit_msg).setPositiveButton(R.string.trim_video_exit_discard, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).setNegativeButton(R.string.review_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).create();
mExitDialog.show();
}
});
mSaveVideoTextView = (TextView) findViewById(R.id.start_trim);
mSaveVideoTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
trimVideo();
}
});
mSaveVideoTextView.setVisibility(View.GONE);
Intent intent = getIntent();
mUri = intent.getData();
mSrcVideoPath = intent.getStringExtra(PhotoPage.KEY_MEDIA_ITEM_PATH);
setContentView(R.layout.trim_view);
View rootView = findViewById(R.id.trim_view_root);
mVideoView = (VideoView) rootView.findViewById(R.id.surface_view);
mController = new TrimControllerOverlay(mContext);
((ViewGroup) rootView).addView(mController.getView());
mController.setListener(this);
mController.setCanReplay(true);
mVideoView.setOnErrorListener(this);
mVideoView.setOnCompletionListener(this);
mVideoView.setVideoURI(mUri);
playVideo();
}
use of android.widget.VideoView in project CameraView by CJT2325.
the class JCameraView method initView.
private void initView() {
setWillNotDraw(false);
View view = LayoutInflater.from(mContext).inflate(R.layout.camera_view, this);
mVideoView = (VideoView) view.findViewById(R.id.video_preview);
mPhoto = (ImageView) view.findViewById(R.id.image_photo);
mSwitchCamera = (ImageView) view.findViewById(R.id.image_switch);
mSwitchCamera.setImageResource(iconSrc);
mFlashLamp = (ImageView) view.findViewById(R.id.image_flash);
setFlashRes();
mFlashLamp.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
type_flash++;
if (type_flash > 0x023)
type_flash = TYPE_FLASH_AUTO;
setFlashRes();
}
});
mCaptureLayout = (CaptureLayout) view.findViewById(R.id.capture_layout);
mCaptureLayout.setDuration(duration);
mCaptureLayout.setIconSrc(iconLeft, iconRight);
mFoucsView = (FoucsView) view.findViewById(R.id.fouce_view);
mVideoView.getHolder().addCallback(this);
// 切换摄像头
mSwitchCamera.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
machine.swtich(mVideoView.getHolder(), screenProp);
}
});
// 拍照 录像
mCaptureLayout.setCaptureLisenter(new CaptureListener() {
@Override
public void takePictures() {
mSwitchCamera.setVisibility(INVISIBLE);
mFlashLamp.setVisibility(INVISIBLE);
machine.capture();
}
@Override
public void recordStart() {
mSwitchCamera.setVisibility(INVISIBLE);
mFlashLamp.setVisibility(INVISIBLE);
machine.record(mVideoView.getHolder().getSurface(), screenProp);
}
@Override
public void recordShort(final long time) {
mCaptureLayout.setTextWithAnimation("录制时间过短");
mSwitchCamera.setVisibility(VISIBLE);
mFlashLamp.setVisibility(VISIBLE);
postDelayed(new Runnable() {
@Override
public void run() {
machine.stopRecord(true, time);
}
}, 1500 - time);
}
@Override
public void recordEnd(long time) {
machine.stopRecord(false, time);
}
@Override
public void recordZoom(float zoom) {
LogUtil.i("recordZoom");
machine.zoom(zoom, CameraInterface.TYPE_RECORDER);
}
@Override
public void recordError() {
if (errorLisenter != null) {
errorLisenter.AudioPermissionError();
}
}
});
// 确认 取消
mCaptureLayout.setTypeLisenter(new TypeListener() {
@Override
public void cancel() {
machine.cancle(mVideoView.getHolder(), screenProp);
}
@Override
public void confirm() {
machine.confirm();
}
});
// 退出
// mCaptureLayout.setReturnLisenter(new ReturnListener() {
// @Override
// public void onReturn() {
// if (jCameraLisenter != null) {
// jCameraLisenter.quit();
// }
// }
// });
mCaptureLayout.setLeftClickListener(new ClickListener() {
@Override
public void onClick() {
if (leftClickListener != null) {
leftClickListener.onClick();
}
}
});
mCaptureLayout.setRightClickListener(new ClickListener() {
@Override
public void onClick() {
if (rightClickListener != null) {
rightClickListener.onClick();
}
}
});
}
use of android.widget.VideoView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ToggleScreenMagnificationPreferenceFragment method onResume.
@Override
public void onResume() {
super.onResume();
VideoView videoView = (VideoView) getView().findViewById(R.id.video);
if (videoView != null) {
videoView.start();
}
updateConfigurationWarningIfNeeded();
}
use of android.widget.VideoView in project android-aosp-mms by slvn.
the class SlideView method setVideo.
public void setVideo(String name, Uri video) {
if (mVideoView == null) {
mVideoView = new VideoView(mContext);
addView(mVideoView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0, 0));
if (DEBUG) {
mVideoView.setBackgroundColor(0xFFFF0000);
}
}
if (LOCAL_LOGV) {
Log.v(TAG, "Changing video source to " + video);
}
mVideoView.setVisibility(View.VISIBLE);
mVideoView.setVideoURI(video);
}
use of android.widget.VideoView in project AndroidFrame by tongxiaoyun.
the class MyApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
m.getInstance().setFloatView(LayoutInflater.from(this).inflate(R.layout.float_window, null));
m.getInstance().setCallback(new LayoutInitCallback() {
@Override
public void initView(View v, String path) {
VideoView vv = (VideoView) v.findViewById(R.id.vv);
vv.setVideoURI(Uri.parse(path));
vv.start();
}
@Override
public void reStart(View v, String path) {
VideoView vv = (VideoView) v.findViewById(R.id.vv);
vv.setVideoURI(Uri.parse(path));
vv.start();
}
@Override
public void stop(View v) {
VideoView vv = (VideoView) v.findViewById(R.id.vv);
vv.pause();
}
@Override
public void destory(View v) {
}
});
}
Aggregations