Giter Site home page Giter Site logo

recordvideo's Introduction

RecordVideo

Android - 录制小视频View Demo(拍照 + 视频) 支持前、后置,录制拉近以及横竖屏翻转处理

预览

  

  

  • MediaRecorderView 类, 主要是显示Camera预览画面,以及录制代码、拍照代码,包括横竖屏、屏幕翻转等逻辑代码
  • MediaDealUtils 类, 是对录制视频后缩略图生成、缩放处理
  • CameraUtils 类, 摄像头资源操作
  • MediaRecordActivity 录制、拍照页面,MediaResultPreActivity 录制、拍照结果预览页面

注意实现

录制视频, 如果手机支持 480x640、360x640, 则默认使用该分辨率录制, 可在 MediaRecorderView 中进行修改判断

    /**
     * 设置配置大小(不同比例控制不同)
     * @param params
     */
    private void setConfigSize(Camera.Parameters params){
        // 计算预览大小
        setPreviewSize(params);
        // 计算录制大小
        setVideoSize(params);
    }

预览默认使用最符合屏幕分辨率的大小, 拍照相同

存在的缺陷:

该 Demo 使用的是 MediaRecorder 进行录制视频

并且该效果要求 点击拍照, 长按超过0.x秒则实现为录制, 而录制视频的时候需要切换Camera配置,会导致录制一瞬间导致卡顿

	// 拍照的时候, 不能调用该方法, 但是录制视频必须调用该方法, 导致需要重新初始化Camera, 并重新配置参数
	
	initCamera(){ // 该方法中
		// 导致无法拍照
		mCamera.unlock();
	}
	
	// 具体实现代码, 看 MediaRecorderView 类处理了翻转对应视频、图片旋转角度摆正,并且支持摄像头手势上下滑动,缩放摄像头

recordvideo's People

Contributors

afkt avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.