🔥screen record helper https://github.com/nanchen2251/ScreenRecordHelper
- screen record
- audio record
- support stripping environment volume
- support saving to album
- support for custom duration
- support for custom path and name
- resist the test of DAU 1 million users
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.nanchen2251:ScreenRecordHelper:1.0.2'
}
// start screen record
if (screenRecordHelper == null) {
screenRecordHelper = ScreenRecordHelper(this, null, PathUtils.getExternalStoragePath() + "/nanchen")
}
screenRecordHelper?.apply {
if (!isRecording) {
// if you want to record the audio,you can set the recordAudio as true
screenRecordHelper?.startRecord()
}
}
// You must rewrite the onActivityResult
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && data != null) {
screenRecordHelper?.onActivityResult(requestCode, resultCode, data)
}
}
// just stop screen record
screenRecordHelper?.apply {
if (isRecording) {
stopRecord()
}
}
// parameter1 -> The last video length you want
// parameter2 -> the audio's duration
// parameter2 -> assets resource
stopRecord(duration, audioDuration, afdd)
nanchen
Chengdu,China
其它开源
个人博客
简书
博客园
交流群:118116509
欢迎投稿(关注)我的唯一公众号,公众号搜索 nanchen 或者扫描下方二维码:
Copyright 2019 nanchen(刘世麟)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.