Search in sources :

Example 36 with VideoView

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();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) ViewGroup(android.view.ViewGroup) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) VideoView(android.widget.VideoView) TextView(android.widget.TextView) ActionBar(android.app.ActionBar)

Example 37 with VideoView

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();
            }
        }
    });
}
Also used : CaptureListener(com.cjt2325.cameralibrary.listener.CaptureListener) TypeListener(com.cjt2325.cameralibrary.listener.TypeListener) ImageView(android.widget.ImageView) View(android.view.View) CameraView(com.cjt2325.cameralibrary.view.CameraView) VideoView(android.widget.VideoView) ClickListener(com.cjt2325.cameralibrary.listener.ClickListener)

Example 38 with VideoView

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();
}
Also used : VideoView(android.widget.VideoView)

Example 39 with VideoView

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);
}
Also used : VideoView(android.widget.VideoView)

Example 40 with VideoView

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) {
        }
    });
}
Also used : VideoView(android.widget.VideoView) LayoutInitCallback(com.risenb.expand.floatwindow.interfaces.LayoutInitCallback) View(android.view.View) VideoView(android.widget.VideoView)

Aggregations

VideoView (android.widget.VideoView)44 View (android.view.View)25 MediaPlayer (android.media.MediaPlayer)13 TextView (android.widget.TextView)12 FrameLayout (android.widget.FrameLayout)10 ImageView (android.widget.ImageView)9 Uri (android.net.Uri)8 Button (android.widget.Button)7 Bitmap (android.graphics.Bitmap)6 LinearLayout (android.widget.LinearLayout)6 MediaController (android.widget.MediaController)6 Intent (android.content.Intent)5 WebView (android.webkit.WebView)5 MotionEvent (android.view.MotionEvent)3 OnClickListener (android.view.View.OnClickListener)3 AdapterView (android.widget.AdapterView)3 FileOutputStream (java.io.FileOutputStream)3 KeyEvent (android.view.KeyEvent)2 AutoCompleteTextView (android.widget.AutoCompleteTextView)2 HorizontalScrollView (android.widget.HorizontalScrollView)2