Commit 3a21168e authored by HanRuisong's avatar HanRuisong

升级到2.4.0

1.SDK新增编辑视频特效功能。
parent 896e75fc
No preview for this file type
......@@ -228,6 +228,6 @@ header, .context-menu, .megamenu-content, footer { font-family: "Segoe UI", Aria
</style>
</head>
<body class='typora-export os-windows' >
<div id='write' class = 'is-node'><p>短视频Android SDK是基于Android API实现的类库,开发者可通过此SDK录制、编辑短视频。</p><h2><a name='header-n2' class='md-header-anchor '></a>1.1 功能特性</h2><figure><table><thead><tr><th style='text-align:left;' >功能</th><th style='text-align:left;' >描述</th></tr></thead><tbody><tr><td style='text-align:left;' >录制视频</td><td style='text-align:left;' >支持断点录制短视频</td></tr><tr><td style='text-align:left;' >摄像头切换</td><td style='text-align:left;' >支持切换摄像头录制视频</td></tr><tr><td style='text-align:left;' >视频美颜</td><td style='text-align:left;' >支持拍摄视频和编辑视频时进行美颜</td></tr><tr><td style='text-align:left;' >视频滤镜</td><td style='text-align:left;' >支持拍摄视频和编辑视频时添加滤镜</td></tr><tr><td style='text-align:left;' >倒计时录制</td><td style='text-align:left;' >支持设置倒计时录制视频</td></tr><tr><td style='text-align:left;' >编辑视频</td><td style='text-align:left;' >支持选择本地视频进行编辑</td></tr><tr><td style='text-align:left;' >视频剪辑</td><td style='text-align:left;' >支持剪辑视频画面大小和时长</td></tr><tr><td style='text-align:left;' >视频变速</td><td style='text-align:left;' >支持改变视频速度</td></tr><tr><td style='text-align:left;' >添加音乐</td><td style='text-align:left;' >支持裁剪音乐、调整原声和配乐音量</td></tr><tr><td style='text-align:left;' >添加贴纸</td><td style='text-align:left;' >支持为视频添加贴纸</td></tr><tr><td style='text-align:left;' >气泡文字</td><td style='text-align:left;' >支持为视频添加气泡文字</td></tr><tr><td style='text-align:left;' >固定比例(9:16)视频合成</td><td style='text-align:left;' >支持为视频添加黑边合成9:16的视频</td></tr><tr><td style='text-align:left;' >图片合成视频</td><td style='text-align:left;' >支持将图片合成视频</td></tr></tbody></table></figure><h2><a name='header-n46' class='md-header-anchor '></a>1.2 阅读对象</h2><p>本文档为技术文档,需要阅读者:</p><ul><li>具备基本的Android开发能力。</li><li>准备接入短视频SDK功能。</li><li>对短视频使用方法有基础的了解。</li></ul></div>
<div id='write' class = 'is-node'><p>短视频Android SDK是基于Android API实现的类库,开发者可通过此SDK录制、编辑短视频。</p><h2><a name='header-n2' class='md-header-anchor '></a>1.1 功能特性</h2><figure><table><thead><tr><th style='text-align:left;' >功能</th><th style='text-align:left;' >描述</th></tr></thead><tbody><tr><td style='text-align:left;' >录制视频</td><td style='text-align:left;' >支持断点录制短视频</td></tr><tr><td style='text-align:left;' >摄像头切换</td><td style='text-align:left;' >支持切换摄像头录制视频</td></tr><tr><td style='text-align:left;' >视频美颜</td><td style='text-align:left;' >支持拍摄视频和编辑视频时进行美颜</td></tr><tr><td style='text-align:left;' >视频滤镜</td><td style='text-align:left;' >支持拍摄视频和编辑视频时添加滤镜</td></tr><tr><td style='text-align:left;' >倒计时录制</td><td style='text-align:left;' >支持设置倒计时录制视频</td></tr><tr><td style='text-align:left;' >编辑视频</td><td style='text-align:left;' >支持选择本地视频进行编辑</td></tr><tr><td style='text-align:left;' >视频剪辑</td><td style='text-align:left;' >支持剪辑视频画面大小和时长</td></tr><tr><td style='text-align:left;' >视频变速</td><td style='text-align:left;' >支持改变视频速度</td></tr><tr><td style='text-align:left;' >添加音乐</td><td style='text-align:left;' >支持裁剪音乐、调整原声和配乐音量</td></tr><tr><td style='text-align:left;' >添加贴纸</td><td style='text-align:left;' >支持为视频添加贴纸</td></tr><tr><td style='text-align:left;' >气泡文字</td><td style='text-align:left;' >支持为视频添加气泡文字</td></tr><tr><td style='text-align:left;' >固定比例(9:16)视频合成</td><td style='text-align:left;' >支持为视频添加黑边合成9:16的视频</td></tr><tr><td style='text-align:left;' >图片合成视频</td><td style='text-align:left;' >支持将图片合成视频</td></tr><tr><td style='text-align:left;' >视频特效</td><td style='text-align:left;' >支持给视频添加特效</td></tr></tbody></table></figure><h2><a name='header-n49' class='md-header-anchor '></a>1.2 阅读对象</h2><p>本文档为技术文档,需要阅读者:</p><ul><li>具备基本的Android开发能力。</li><li>准备接入短视频SDK功能。</li><li>对短视频使用方法有基础的了解。</li></ul></div>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -228,6 +228,6 @@ header, .context-menu, .megamenu-content, footer { font-family: "Segoe UI", Aria
</style>
</head>
<body class='typora-export os-windows' >
<div id='write' class = 'is-node'><h2><a name='header-n0' class='md-header-anchor '></a>Version 2.3.0</h2><p>发布时间:2020-03-04</p><p>更新内容:</p><ol start='' ><li>SDK新增图片合成视频功能,支持为图片添加转场和动画效果。</li><li>Demo新增通过自定义相册选取视频和图片。</li></ol><h2><a name='header-n9' class='md-header-anchor '></a>Version 2.2.2</h2><p>发布时间:2019-11-21</p><p>更新内容:</p><ol start='' ><li>SDK增加设置录制时长的方法。</li><li>Demo修复原比例下拖动裁剪框,裁剪视频不生效的问题。</li><li>Demo优化裁剪视频画面不准确的问题。</li><li>Demo优化拍摄流程。</li></ol><h2><a name='header-n22' class='md-header-anchor '></a>Version 2.2.1</h2><p>发布时间:2019-11-14</p><p>更新内容:</p><ol start='' ><li>SDK增加拍摄视频和编辑视频时进行美颜。</li><li>SDK增加编辑视频时添加滤镜。</li><li>Demo新增设置倒计时录制视频。</li><li>Demo增加选择本地视频进行编辑。</li><li>SDK新增改变视频速度。</li><li>SDK新增添加音乐、调整原声和配乐音量。</li><li>SDK新增添加贴纸和气泡文字。</li><li>SDK新增合成新分辨视频。</li></ol></div>
<div id='write' class = 'is-node'><h2><a name='header-n0' class='md-header-anchor '></a>Version 2.4.0</h2><p>发布时间:2020-05-20</p><p>更新内容:</p><ol start='' ><li>SDK新增编辑视频特效功能。</li></ol><h2><a name='header-n7' class='md-header-anchor '></a>Version 2.3.0</h2><p>发布时间:2020-03-04</p><p>更新内容:</p><ol start='' ><li>SDK新增图片合成视频功能,支持为图片添加转场和动画效果。</li><li>Demo新增通过自定义相册选取视频和图片。</li></ol><h2><a name='header-n15' class='md-header-anchor '></a>Version 2.2.2</h2><p>发布时间:2019-11-21</p><p>更新内容:</p><ol start='' ><li>SDK增加设置录制时长的方法。</li><li>Demo修复原比例下拖动裁剪框,裁剪视频不生效的问题。</li><li>Demo优化裁剪视频画面不准确的问题。</li><li>Demo优化拍摄流程。</li></ol><h2><a name='header-n28' class='md-header-anchor '></a>Version 2.2.1</h2><p>发布时间:2019-11-14</p><p>更新内容:</p><ol start='' ><li>SDK增加拍摄视频和编辑视频时进行美颜。</li><li>SDK增加编辑视频时添加滤镜。</li><li>Demo新增设置倒计时录制视频。</li><li>Demo增加选择本地视频进行编辑。</li><li>SDK新增改变视频速度。</li><li>SDK新增添加音乐、调整原声和配乐音量。</li><li>SDK新增添加贴纸和气泡文字。</li><li>SDK新增合成新分辨视频。</li></ol></div>
</body>
</html>
\ No newline at end of file
......@@ -46,8 +46,8 @@ dependencies {
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.bokecc:speedplay:2.19.3'
implementation(name:'shortvideo2.3.0', ext:'aar')
implementation(name:'camerafilter2.3.0', ext:'aar')
implementation(name:'shortvideo2.4.0', ext:'aar')
implementation(name:'camerafilter2.4.0', ext:'aar')
implementation 'com.github.bumptech.glide:glide:3.7.0'
......
......@@ -54,6 +54,10 @@
android:name=".editvideo.CombineImagesActivity"
android:screenOrientation="portrait" />
<activity
android:name=".editvideo.EditSpecialEffectActivity"
android:screenOrientation="portrait" />
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
......
......@@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.SurfaceTexture;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
......
package bokecc.shortvideosdk.adapter;
import android.graphics.Bitmap;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import java.util.List;
import bokecc.shortvideosdk.R;
public class EffectImagesPreviewAdapter extends RecyclerView.Adapter<EffectImagesPreviewAdapter.ViewHolder> {
private List<Bitmap> mData;
private EffectImagesPreviewAdapter.OnItemClickListener onItemClickListener;
public EffectImagesPreviewAdapter(List<Bitmap> mData) {
this.mData = mData;
}
public interface OnItemClickListener {
void onItemClick(Bitmap item, int position);
}
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_effect_images_preview, parent, false);
ViewHolder viewHolder = new ViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
Bitmap bitmap = mData.get(position);
holder.iv_image.setImageBitmap(bitmap);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
if (onItemClickListener != null) {
int pos = holder.getLayoutPosition();
onItemClickListener.onItemClick(mData.get(pos), pos);
}
}
});
}
@Override
public int getItemCount() {
return mData == null ? 0 : mData.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
ImageView iv_image;
public ViewHolder(View itemView) {
super(itemView);
iv_image = itemView.findViewById(R.id.iv_image);
}
}
}
package bokecc.shortvideosdk.adapter;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import bokecc.shortvideosdk.R;
import bokecc.shortvideosdk.model.SpecialEffectRes;
public class SpecialEffectAdapter extends RecyclerView.Adapter<SpecialEffectAdapter.ViewHolder> {
private List<SpecialEffectRes> mData;
private SpecialEffectAdapter.OnItemClickListener onItemClickListener;
private OnOnTouchListener onOnTouchListener;
public SpecialEffectAdapter(List<SpecialEffectRes> mData) {
this.mData = mData;
}
public interface OnItemClickListener {
void onItemClick(SpecialEffectRes item, int position);
}
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
public interface OnOnTouchListener {
void onActionDown(SpecialEffectRes item, int position);
void onActionUp(SpecialEffectRes item, int position);
}
public void setOnOnTouchListener(OnOnTouchListener onOnTouchListener) {
this.onOnTouchListener = onOnTouchListener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_special_effect, parent, false);
ViewHolder viewHolder = new ViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
SpecialEffectRes specialEffectRes = mData.get(position);
holder.tv_effect_name.setText(specialEffectRes.getSpEffectName());
if (specialEffectRes.isSelected()) {
holder.iv_special_effect.setImageResource(specialEffectRes.getSelectdImgRes());
holder.tv_effect_name.setTextColor(Color.parseColor("#FF9520"));
} else {
holder.iv_special_effect.setImageResource(specialEffectRes.getNormalImgRes());
holder.tv_effect_name.setTextColor(Color.parseColor("#B3FFFFFF"));
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
if (onItemClickListener != null) {
int pos = holder.getLayoutPosition();
onItemClickListener.onItemClick(mData.get(pos), pos);
}
}
});
holder.itemView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
if (onOnTouchListener != null) {
int pos = holder.getLayoutPosition();
onOnTouchListener.onActionDown(mData.get(pos), pos);
}
break;
case MotionEvent.ACTION_UP:
if (onOnTouchListener != null) {
int pos = holder.getLayoutPosition();
onOnTouchListener.onActionUp(mData.get(pos), pos);
}
break;
case MotionEvent.ACTION_CANCEL:
if (onOnTouchListener != null) {
int pos = holder.getLayoutPosition();
onOnTouchListener.onActionUp(mData.get(pos), pos);
}
break;
}
return true;
}
});
}
@Override
public int getItemCount() {
return mData == null ? 0 : mData.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
ImageView iv_special_effect;
TextView tv_effect_name;
public ViewHolder(View itemView) {
super(itemView);
iv_special_effect = itemView.findViewById(R.id.iv_special_effect);
tv_effect_name = itemView.findViewById(R.id.tv_effect_name);
}
}
}
......@@ -18,9 +18,9 @@ import com.bokecc.shortvideo.combineimages.ImagesToVideoHelper;
import com.bokecc.shortvideo.combineimages.ImagesVideo;
import com.bokecc.shortvideo.combineimages.ImagesVideoPlayer;
import com.bokecc.shortvideo.combineimages.model.SelectImageInfo;
import com.bokecc.shortvideo.combineimages.render.IVTextureView;
import com.bokecc.shortvideo.combineimages.render.SurfaceImagesVideoRenderer;
import com.bokecc.shortvideo.combineimages.render.TextureImagesVideoRender;
import com.bokecc.shortvideo.combineimages.render.IVTextureView;
import com.bokecc.shortvideo.combineimages.timer.IVideoTimer;
import com.bokecc.shortvideo.combineimages.videorecord.ImagesVideoMaker;
......@@ -578,7 +578,7 @@ public class CombineImagesActivity extends Activity implements IVideoTimer.Image
}
private void combineImagesToVideo() {
//合成视频
//渲染合成视频
imagesVideoPlayer.pause();
CustomProgressDialog handleProgressDialog = new CustomProgressDialog(activity);
handleProgressDialog.show();
......
......@@ -8,6 +8,7 @@ import android.content.res.Resources;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
......@@ -46,6 +47,7 @@ import bokecc.shortvideosdk.MainActivity;
import bokecc.shortvideosdk.R;
import bokecc.shortvideosdk.cutvideo.TimeSliderView;
import bokecc.shortvideosdk.cutvideo.VideoBean;
import bokecc.shortvideosdk.model.SpecialEffectInfo;
import bokecc.shortvideosdk.model.StickerRes;
import bokecc.shortvideosdk.util.FileUtils;
import bokecc.shortvideosdk.util.MultiUtils;
......@@ -70,14 +72,14 @@ import bokecc.shortvideosdk.widget.sticker.ZoomIconEvent;
import static android.opengl.GLSurfaceView.RENDERMODE_WHEN_DIRTY;
public class EditVideoActivity extends Activity implements MediaPlayer.OnPreparedListener, GLSurfaceView.Renderer, View.OnClickListener {
private String videoPath, originalPath, bacMusicPath;
private String videoPath, originalPath, bacMusicPath, recordPath, effectPath;
private GLSurfaceView gl_view;
private MediaPlayer mediaPlayer;
private VideoDrawer mDrawer;
private Activity activity;
private int videoWidth, videoHeight, windowWidth, windowHeight, afterChangeVideoHeight;
private LinearLayout ll_edit_operation, ll_edit_filter, ll_edit_beauty, ll_edit_music, ll_edit_volume,
ll_origin_volume, ll_music_volume, ll_cut_music, ll_sticker, ll_text, ll_set_sticker_time;
ll_origin_volume, ll_music_volume, ll_cut_music, ll_sticker, ll_text, ll_set_sticker_time, ll_special_effect;
private int currentBeautyWhiteValue = 0, currentBeautySkinValue = 0, filterPosition = 0;
private int videoDuration, musicDuration;
private boolean isRecord = false, isClickNext = false;
......@@ -110,6 +112,8 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
private FrameLayout fl_sticker;
private Surface surface;
private boolean isFromCombineImages = false;
private SurfaceTexture surfaceTexture;
private ArrayList<SpecialEffectInfo> effects;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -125,6 +129,8 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
private void initPlay() {
mediaPlayer = new MediaPlayer();
mediaPlayer.setOnPreparedListener(this);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setScreenOnWhilePlaying(true);
mediaPlayer.setLooping(true);
try {
mediaPlayer.setDataSource(videoPath);
......@@ -136,8 +142,10 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
private void initView() {
videoPath = getIntent().getStringExtra("videoPath");
recordPath = videoPath;
isRecord = getIntent().getBooleanExtra("isRecord", false);
originalPath = getIntent().getStringExtra("originalPath");
rotation = getIntent().getIntExtra("rotation", 0);
originalRotation = getIntent().getIntExtra("originalRotation", 0);
isFromCombineImages = getIntent().getBooleanExtra("combineImages", false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
......@@ -168,6 +176,9 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
ll_edit_volume = findViewById(R.id.ll_edit_volume);
ll_edit_volume.setOnClickListener(this);
ll_special_effect = findViewById(R.id.ll_special_effect);
ll_special_effect.setOnClickListener(this);
tv_music_volume_value = findViewById(R.id.tv_music_volume_value);
tv_origin_volume_value = findViewById(R.id.tv_origin_volume_value);
sb_music_volume = findViewById(R.id.sb_music_volume);
......@@ -233,6 +244,7 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
}
}
});
}
private void editStickerShowTime() {
......@@ -336,6 +348,7 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
gl_view.setCameraDistance(100);
mDrawer = new VideoDrawer(activity, getResources());
mDrawer.setRotation(rotation);
}
@Override
......@@ -369,7 +382,7 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
mDrawer.onSurfaceCreated(gl, config);
SurfaceTexture surfaceTexture = mDrawer.getSurfaceTexture();
surfaceTexture = mDrawer.getSurfaceTexture();
surfaceTexture.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
......@@ -379,6 +392,7 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
surface = new Surface(surfaceTexture);
mediaPlayer.setSurface(surface);
}
@Override
......@@ -452,6 +466,16 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
case R.id.iv_confirm_set_sticker_time:
confirmSetStickerTime();
break;
case R.id.ll_special_effect:
Intent intent = new Intent(activity, EditSpecialEffectActivity.class);
intent.putExtra("videoPath", recordPath);
if (effects != null) {
intent.putParcelableArrayListExtra("effects", effects);
effectPath = videoPath;
}
startActivityForResult(intent, 1);
break;
}
}
......@@ -639,6 +663,32 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
mediaPlayer.setVolume(originVolume, originVolume);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != Activity.RESULT_OK) {
return;
}
if (requestCode == 1) {
videoPath = data.getStringExtra("path");
effects = data.getParcelableArrayListExtra("effects");
if (mediaPlayer != null) {
try {
mediaPlayer.pause();
mediaPlayer.stop();
mediaPlayer.reset();
mediaPlayer.setLooping(true);
mediaPlayer.setDataSource(videoPath);
mediaPlayer.prepare();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//编辑贴纸
private void editSticker() {
ll_edit_operation.setVisibility(View.GONE);
......@@ -1024,7 +1074,7 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
if (hideEditMusic()) return true;
if (isRecord) {
startActivity(new Intent(activity, MainActivity.class));
}else if(isFromCombineImages){
} else if (isFromCombineImages) {
} else {
startActivity(new Intent(activity, CutVideoActivity.class).putExtra("videoPath", originalPath).putExtra("rotation", originalRotation));
......@@ -1045,10 +1095,11 @@ public class EditVideoActivity extends Activity implements MediaPlayer.OnPrepare
@Override
public Resources getResources() {
Resources resources = super.getResources();
Resources resources = super.getResources();
Configuration configuration = new Configuration();
configuration.setToDefaults();
resources.updateConfiguration(configuration,resources.getDisplayMetrics());
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return resources;
}
}
package bokecc.shortvideosdk.model;
import android.os.Parcel;
import android.os.Parcelable;
public class SpecialEffectInfo implements Parcelable {
private long startTime;
private long endTime;
private int effectType;
public SpecialEffectInfo() {
}
protected SpecialEffectInfo(Parcel in) {
startTime = in.readLong();
endTime = in.readLong();
effectType = in.readInt();
}
public static final Creator<SpecialEffectInfo> CREATOR = new Creator<SpecialEffectInfo>() {
@Override
public SpecialEffectInfo createFromParcel(Parcel in) {
return new SpecialEffectInfo(in);
}
@Override
public SpecialEffectInfo[] newArray(int size) {
return new SpecialEffectInfo[size];
}
};
public long getStartTime() {
return startTime;
}
public void setStartTime(long startTime) {
this.startTime = startTime;
}
public long getEndTime() {
return endTime;
}
public void setEndTime(long endTime) {
this.endTime = endTime;
}
public int getEffectType() {
return effectType;
}
public void setEffectType(int effectType) {
this.effectType = effectType;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(startTime);
dest.writeLong(endTime);
dest.writeInt(effectType);
}
}
package bokecc.shortvideosdk.model;
public class SpecialEffectRes {
private int normalImgRes;
private int selectdImgRes;
private boolean isSelected = false;
private String spEffectName;
public int getNormalImgRes() {
return normalImgRes;
}
public void setNormalImgRes(int normalImgRes) {
this.normalImgRes = normalImgRes;
}
public int getSelectdImgRes() {
return selectdImgRes;
}
public void setSelectdImgRes(int selectdImgRes) {
this.selectdImgRes = selectdImgRes;
}
public boolean isSelected() {
return isSelected;
}
public void setSelected(boolean selected) {
isSelected = selected;
}
public String getSpEffectName() {
return spEffectName;
}
public void setSpEffectName(String spEffectName) {
this.spEffectName = spEffectName;
}
}
package bokecc.shortvideosdk.util;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
......@@ -9,11 +11,18 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Environment;
import android.os.storage.StorageManager;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
......@@ -23,6 +32,9 @@ import com.bokecc.shortvideo.combineimages.model.SelectVideoInfo;
import com.bumptech.glide.Glide;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
......@@ -34,6 +46,7 @@ import bokecc.shortvideosdk.ShortVideoApplication;
import bokecc.shortvideosdk.cutvideo.VideoBean;
import bokecc.shortvideosdk.model.AnimRes;
import bokecc.shortvideosdk.model.MusicInfo;
import bokecc.shortvideosdk.model.SpecialEffectRes;
import bokecc.shortvideosdk.model.TransitionRes;
public class MultiUtils {
......@@ -175,6 +188,18 @@ public class MultiUtils {
return outPutVideo.getAbsolutePath();
}
//获得输出视频的路径
public static String getEffectOutputVideoPath() {
String outPath = Environment.getExternalStorageDirectory().getPath() + File.separator + APP_FILE_PATH;
File file = new File(outPath);
if (!file.exists()) {
file.mkdirs();
}
File outPutVideo = new File(outPath, "effect.mp4");
return outPutVideo.getAbsolutePath();
}
//获得屏幕可用的宽度
public static int getScreenWidth(Context context) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
......@@ -407,6 +432,47 @@ public class MultiUtils {
return datas;
}
public static List<SpecialEffectRes> getSpecialEffectResDatas() {
List<SpecialEffectRes> datas = new ArrayList<>();
SpecialEffectRes SpecialEffectRes1 = new SpecialEffectRes();
SpecialEffectRes1.setNormalImgRes(R.mipmap.iv_shake_normal);
SpecialEffectRes1.setSelectdImgRes(R.mipmap.iv_shake_selected);
SpecialEffectRes1.setSelected(false);
SpecialEffectRes1.setSpEffectName("抖动");
datas.add(SpecialEffectRes1);
SpecialEffectRes SpecialEffectRes2 = new SpecialEffectRes();
SpecialEffectRes2.setNormalImgRes(R.mipmap.iv_splash_screen_normal);
SpecialEffectRes2.setSelectdImgRes(R.mipmap.iv_splash_screen_selected);
SpecialEffectRes2.setSelected(false);
SpecialEffectRes2.setSpEffectName("闪屏");
datas.add(SpecialEffectRes2);
SpecialEffectRes SpecialEffectRes3 = new SpecialEffectRes();
SpecialEffectRes3.setNormalImgRes(R.mipmap.iv_sprinkle_gold_normal);
SpecialEffectRes3.setSelectdImgRes(R.mipmap.iv_sprinkle_gold_selected);
SpecialEffectRes3.setSelected(false);
SpecialEffectRes3.setSpEffectName("幻觉");
datas.add(SpecialEffectRes3);
SpecialEffectRes SpecialEffectRes4 = new SpecialEffectRes();
SpecialEffectRes4.setNormalImgRes(R.mipmap.iv_fly_flower_normal);
SpecialEffectRes4.setSelectdImgRes(R.mipmap.iv_fly_flower_selected);
SpecialEffectRes4.setSelected(false);